2021-11-20 FIFO Generatorを用いたLED点灯 (Cora Z7)

2021-11-20 FIFO Generatorを用いたLED点灯

### 動作環境

```
Windows 10 Pro (21H1) 
Cora Z7 (Z7-07S)
Vivado v2019.1 (64-bit)
```

### 設定など

- wr_en : 1MHzのクロック (FCLK_CLK1を設定)
- rd_en : wr_enとは逆位相のクロック (Utility Vector Logicで反転)

このあたりはまだわかっていないことが多い。wr_enとrd_enが同時に成立しないようにしただけ。

- LED
    - Cora Z7のTri Color LEDのRedを二つ割り当てした

### Block Design

<img width="1325" alt="image.png (73.0 kB)" src="https://img.esa.io/uploads/production/attachments/6206/2021/11/20/21741/1aa90489-8a49-4d42-9a43-fabe04ed6fce.png">

LEDの点灯はConstantで指定。

### XDC

ILAの設定もあるが、実際に必要なのは上の4つだけ。

```FIFO_gen.xdc
set_property IOSTANDARD LVCMOS33 [get_ports {led_0[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {led_0[0]}]
set_property PACKAGE_PIN N15 [get_ports {led_0[1]}]
set_property PACKAGE_PIN M15 [get_ports {led_0[0]}]

create_debug_core u_ila_0 ila
set_property ALL_PROBE_SAME_MU true [get_debug_cores u_ila_0]
set_property ALL_PROBE_SAME_MU_CNT 1 [get_debug_cores u_ila_0]
set_property C_ADV_TRIGGER false [get_debug_cores u_ila_0]
set_property C_DATA_DEPTH 8192 [get_debug_cores u_ila_0]
set_property C_EN_STRG_QUAL false [get_debug_cores u_ila_0]
set_property C_INPUT_PIPE_STAGES 0 [get_debug_cores u_ila_0]
set_property C_TRIGIN_EN false [get_debug_cores u_ila_0]
set_property C_TRIGOUT_EN false [get_debug_cores u_ila_0]
set_property port_width 1 [get_debug_ports u_ila_0/clk]
connect_debug_port u_ila_0/clk [get_nets [list design_1_i/processing_system7_0/inst/FCLK_CLK0]]
set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe0]
set_property port_width 2 [get_debug_ports u_ila_0/probe0]
connect_debug_port u_ila_0/probe0 [get_nets [list {design_1_i/fifo_generator_0/din[0]} {design_1_i/fifo_generator_0/din[1]}]]
create_debug_port u_ila_0 probe
set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_0/probe1]
set_property port_width 1 [get_debug_ports u_ila_0/probe1]
connect_debug_port u_ila_0/probe1 [get_nets [list design_1_i/fifo_generator_0/wr_en]]
create_debug_core u_ila_1 ila
set_property ALL_PROBE_SAME_MU true [get_debug_cores u_ila_1]
set_property ALL_PROBE_SAME_MU_CNT 1 [get_debug_cores u_ila_1]
set_property C_ADV_TRIGGER false [get_debug_cores u_ila_1]
set_property C_DATA_DEPTH 8192 [get_debug_cores u_ila_1]
set_property C_EN_STRG_QUAL false [get_debug_cores u_ila_1]
set_property C_INPUT_PIPE_STAGES 0 [get_debug_cores u_ila_1]
set_property C_TRIGIN_EN false [get_debug_cores u_ila_1]
set_property C_TRIGOUT_EN false [get_debug_cores u_ila_1]
set_property port_width 1 [get_debug_ports u_ila_1/clk]
connect_debug_port u_ila_1/clk [get_nets [list design_1_i/processing_system7_0/inst/FCLK_CLK1]]
set_property PROBE_TYPE DATA_AND_TRIGGER [get_debug_ports u_ila_1/probe0]
set_property port_width 1 [get_debug_ports u_ila_1/probe0]
connect_debug_port u_ila_1/probe0 [get_nets [list design_1_i/fifo_generator_0/rd_en]]
set_property C_CLK_INPUT_FREQ_HZ 300000000 [get_debug_cores dbg_hub]
set_property C_ENABLE_CLK_DIVIDER false [get_debug_cores dbg_hub]
set_property C_USER_SCAN_CHAIN 1 [get_debug_cores dbg_hub]
connect_debug_port dbg_hub/clk [get_nets u_ila_1_FCLK_CLK1]
```

###  実行例

PSのクロックを使っているため、XSDKのアプリケーションを走らせる。
そうすると、以下のようにTri Color LEDが赤点灯する。

<img width="819.2" alt="IMG_2952.JPG (862.2 kB)" src="https://img.esa.io/uploads/production/attachments/6206/2021/11/20/21741/196a2922-813c-4098-817d-edf1f39279f6.JPG">