I2C器件接口IP核的CPLD设计
WHEN t0 =>
本文链接地址:http://www.oyaya.net/fanwen/view/156573.html
IF Cmd_reg2 OR Cmd_reg3 THEN
SDA = SDA_tmp; --开始传送数据
SCL = GND;
St = t1;
ELSE
St = t0;
END IF;
WHEN t1 =>
SCL = VCC;
SDA = SDA_tmp;
St = t1a;
WHEN t1a =>
SCL = VCC;
SDA = SDA_tmp;
St = t2;
WHEN t2 =>
Sh_reg[7..1] = Sh_reg[6..0]; --数据左移,取高位
Sh_reg[0] = GND;
Sh_reg[].ena = EXU;
SCL = GND;
SDA = SDA_tmp;
IF Bit[] == 7 THEN --若8位传完,则发应答位;否则继续
St = t3;
ELSE
St = t0;
END IF;
WHEN t3 => --发应答位
SDA =GND;
St = t4;
WHEN t4 =>
SDA = GND;
SCL = VCC;
St = t4a;
WHEN t4a =>
SDA = GND;
SCL = VCC;
St = t5;
WHEN t5 =>
SCL = GND;
St = t6;
WHEN t6 =>
SDA = GND;
FINISHED = VCC;
St = t0;
END CASE;
《I2C器件接口IP核的CPLD设计(第2页)》