wave_gen_vhd_s6工程ucf分析

使用多个UCF文件

在ISE的工程中能够包含多个UCF文件,如下所示,
wave_gen_vhd_s6工程ucf分析
类似操作的说明如下
wave_gen_vhd_s6工程ucf分析

利用通配符简化UCF

在ISE的示例工程wave_gen中,UCF中对时序的约束如下

NET “clk_pin” TNM_NET = clk_pin;
TIMESPEC TS_clk_pin = PERIOD “clk_pin” 37.037 ns HIGH 50%;
OFFSET = IN 15 ns VALID 20 ns BEFORE “clk_pin” RISING;
OFFSET = OUT 15 ns AFTER “clk_pin”;
NET “spi_clk_pin” OFFSET = OUT 15 ns AFTER “clk_pin” RISING;
NET “spi_clk_pin” OFFSET = OUT 15 ns AFTER “clk_pin” FALLING;
INST “cmd_parse_i0/send_resp_data_0” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_1” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_2” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_3” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_4” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_5” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_6” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_7” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_8” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_9” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_10” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_11” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_12” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_13” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_14” TNM = TNM_send_resp_data;
INST “cmd_parse_i0/send_resp_data_15” TNM = TNM_send_resp_data;
INST “resp_gen_i0/to_bcd_i0/bcd_out_0” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_1” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_2” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_3” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_4” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_5” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_6” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_7” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_8” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_9” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_10” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_11” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_12” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_13” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_14” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_15” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_16” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_17” TNM = TNM_to_bcd_flops;
INST “resp_gen_i0/to_bcd_i0/bcd_out_18” TNM = TNM_to_bcd_flops;
TIMESPEC TS_to_bcd = FROM “TNM_send_resp_data” TO “TNM_to_bcd_flops” TS_clk_gen_i0_clk_core_i0_clk0 * 2;
INST “uart_rx_i0/uart_rx_ctl_i0” TNM = TNM_uart_rx_ctl;
INST “uart_tx_i0/uart_tx_ctl_i0” TNM = TNM_uart_tx_ctl;
NET “clk_samp” TNM_NET = TNM_clk_samp;
TIMESPEC TS_uart_rx_ctl = FROM “TNM_uart_rx_ctl” TO “TNM_uart_rx_ctl” TS_clk_gen_i0_clk_core_i0_clk0 * 54;
TIMESPEC TS_uart_tx_ctl = FROM “TNM_uart_tx_ctl” TO “TNM_uart_tx_ctl” TS_clk_gen_i0_clkout_fx * 54;
TIMESPEC TS_clk_samp = FROM “TNM_clk_samp” TO “TNM_clk_samp” TS_clk_gen_i0_clkout_fx * 32;
NET “clkx_nsamp_i0/meta_harden_bus_new_i0/signal_meta” MAXDELAY = 2 ns;
NET “clkx_pre_i0/meta_harden_bus_new_i0/signal_meta” MAXDELAY = 2 ns;
NET “clkx_spd_i0/meta_harden_bus_new_i0/signal_meta” MAXDELAY = 2 ns;
NET “lb_ctl_i0/debouncer_i0/meta_harden_signal_in_i0/signal_meta” MAXDELAY = 2 ns;
NET “samp_gen_i0/meta_harden_samp_gen_go_i0/signal_meta” MAXDELAY = 2 ns;
NET “uart_rx_i0/meta_harden_rxd_i0/signal_meta” MAXDELAY = 2 ns;
NET “clk_rx” TNM_NET = TNM_clk0;
NET “clk_gen_i0/clkout_fx” TNM_NET = TNM_clkfx;
TIMESPEC TS_clk0_to_clkfx = FROM “TNM_clk0” TO “TNM_clkfx” 5 ns DATAPATHONLY;
TIMESPEC TS_clkfx_to_clk0 = FROM “TNM_clkfx” TO “TNM_clk0” 5 ns DATAPATHONLY;

观察约束语句可以看到,在约束语句中,对多比特数据进行了多次重复,这可以使用通配符来简化

修改前
INST “cmd_parse_i0/send_resp_data_0” TNM = TNM_send_resp_data;

INST “resp_gen_i0/to_bcd_i0/bcd_out_0” TNM = TNM_to_bcd_flops;
修改后
INST “cmd_parse_i0/send_resp_data_0” TNM = TNM_send_resp_data;
INST “resp_gen_i0/to_bcd_i0/bcd_out*” TNM = TNM_to_bcd_flops;

INST和NET的释义

cmd_parse是wave_gen的一个子模块,端口定义如下
wave_gen_vhd_s6工程ucf分析
mete-harden是wave_gen的另一个子模块,模块如下
wave_gen_vhd_s6工程ucf分析

UCF中有约束语句

INST “cmd_parse_i0/send_resp_data*” TNM = TNM_send_resp_data;
INST “resp_gen_i0/to_bcd_i0/bcd_out*” TNM = TNM_to_bcd_flops;

NET “clkx_nsamp_i0/meta_harden_bus_new_i0/signal_meta” MAXDELAY = 2 ns;

INST和NET的区分我不甚明晰,到网上荡相关资料,官网提到,INST对应于primitive instance或者hierarchical instance(模块例化名),看到这我更迷糊了,因为send_resp_data是cmd_parse模块的一个端口,它不是一个模块,怎么能使用INST呢?而且,诡异的是,我将INST修改为NET,约束也能应用到工程中。后来打开planhead查看布局布线后的网表,发现在primitive中有send_resp_data,类型是FDRE,我才恍然大悟,在布局布线之后,子模块的端口、子模块内的signal等都已经被映射到特定原语上了,因此,在“INST “cmd_parse_i0/send_resp_data*” TNM = TNM_send_resp_data;”中,send_resp_data不是指子模块的端口,它就是对应信号映射的寄存器而已,如下图,
wave_gen_vhd_s6工程ucf分析
那么INST和NET的区别呢?在下图中,A对应的是***INST***bcd_out_0,B对应的是自bcd_out_0应用TNM属性的***NET***,这样的话,INST对应的是一个点(单个primitive或单个模块整体),NET对应的是一个网络,它可以是一对一(下有图)、一对多、多对多(下有图)的PATH。值得注意的是,NET配合TNM/TNM_NET使用时,约束应用到从该网络向前扇出的所有路径,这些前向路径在FFS、RAMS、LATCHES、PADS、CPUS、HSIOS和MULT元件上停止。
wave_gen_vhd_s6工程ucf分析
wave_gen_vhd_s6工程ucf分析

网上一些解释

An INST is an instance - it refers either to a primitive instance (like a flip-flop or BRAM or SRL or LUT) or to a hierarchical instance (the instantiation of a module/entity).
A PIN is a pin on an instance - again, either a primitive instance or a hierarchical instance. So the D and Q on a flip-flop are pins. Also when you instantiate a module/entity that has a port (say, named A), when the module/entity is instantiated, the instance has a PIN named A.
A NET is something that connects pins together.

Now, the more important thing to ask is “what can you do with them”. For timing constraints like the TIMESPEC command you can only place constraints on paths; these start and end at clocked elements. The TNM command is for Timing NaMe, which is the way that we create groups of endpoints for the TIMESPEC. Therefore, only clocked elements can be in the TNM. The INST/PIN/NET format for TNMs mean different thing,

  • INST on a primitive object - put that object in the TNM - but only if it is a clocked element (FF, LATCH, SRL, RAM, DSP…)
  • INST on a hierarchical object - put all clocked elements in that hierarchical object in the group
  • NET - put all clocked elements that are combinatorially reachable from that NET into the group
  • PIN - put all clocked elements that are combinatorially reachable from that PIN into the group