fpga项目: i2c读写eeprom(zynq) - minichao9901/TangNano-20k-Zynq-7020 GitHub Wiki
1)说明
- 此例程直接参考野火的Spartan-6的例程,做了如下修改:
- 换成AT24C02,因此地址是1byte宽度的,代码如下修改:
create_clock -period 20.000 [get_ports sys_clk]
set_property -dict {PACKAGE_PIN N18 IOSTANDARD LVCMOS33} [get_ports sys_clk]
set_property -dict {PACKAGE_PIN P14 IOSTANDARD LVCMOS33} [get_ports sys_rst_n]
set_property -dict {PACKAGE_PIN F17 IOSTANDARD LVCMOS33} [get_ports {sel[3]}]
set_property -dict {PACKAGE_PIN E17 IOSTANDARD LVCMOS33} [get_ports scl]
set_property -dict {PACKAGE_PIN D18 IOSTANDARD LVCMOS33} [get_ports {sel[2]}]
set_property -dict {PACKAGE_PIN E18 IOSTANDARD LVCMOS33} [get_ports sda]
set_property -dict {PACKAGE_PIN E19 IOSTANDARD LVCMOS33} [get_ports {sel[1]}]
set_property -dict {PACKAGE_PIN G18 IOSTANDARD LVCMOS33} [get_ports {sel[0]}]
set_property -dict {PACKAGE_PIN H17 IOSTANDARD LVCMOS33} [get_ports {seg[0]}]
set_property -dict {PACKAGE_PIN A20 IOSTANDARD LVCMOS33} [get_ports {seg[1]}]
set_property -dict {PACKAGE_PIN B20 IOSTANDARD LVCMOS33} [get_ports {seg[2]}]
set_property -dict {PACKAGE_PIN D20 IOSTANDARD LVCMOS33} [get_ports {seg[3]}]
set_property -dict {PACKAGE_PIN H18 IOSTANDARD LVCMOS33} [get_ports {seg[4]}]
set_property -dict {PACKAGE_PIN F20 IOSTANDARD LVCMOS33} [get_ports {seg[5]}]
set_property -dict {PACKAGE_PIN G20 IOSTANDARD LVCMOS33} [get_ports {seg[6]}]
set_property -dict {PACKAGE_PIN H20 IOSTANDARD LVCMOS33} [get_ports {seg[7]}]
set_property -dict {PACKAGE_PIN J19 IOSTANDARD LVCMOS33} [get_ports {sel[5]}]
set_property -dict {PACKAGE_PIN L16 IOSTANDARD LVCMOS33} [get_ports {sel[4]}]
set_property -dict {PACKAGE_PIN L19 IOSTANDARD LVCMOS33 PULLUP true } [get_ports key_wr]
set_property -dict {PACKAGE_PIN L20 IOSTANDARD LVCMOS33 PULLUP true} [get_ports key_rd]
2)总结
- 因为vivado非常强大,它能够自动识别.v的层次关系。可以直接读入野火的rtl文件夹,非常方便。
- IP创建一个ILA,一个probe,宽度64bit(可以更宽)就可以了。把所有需要观察的线都往上接,不用管宽度是否匹配(如果超过会自动截断,如果不够会自动补零)
- 因为vidado的仿真功能非常强大,因此野火的testbench可以直接仿真