SDC: Add PERIOD format check test Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/sdc-plugin/tests/Makefile b/sdc-plugin/tests/Makefile index b5f7f96..3d602b7 100644 --- a/sdc-plugin/tests/Makefile +++ b/sdc-plugin/tests/Makefile
@@ -2,6 +2,10 @@ # set_false_path - test the set_false_path command # set_max_delay - test the set_max_delay command # set_clock_groups - test the set_clock_groups command +# restore_from_json - test clock propagation when design restored from json instead verilog +# period_check - test if the clock propagation fails if a clock wire is missing the PERIOD attribute +# waveform_check - test if the WAVEFORM attribute value is correct on wire +# period_format_check - test if PERIOD attribute value is correct on wire TESTS = counter \ counter2 \ @@ -14,7 +18,8 @@ set_clock_groups \ restore_from_json \ period_check \ - waveform_check + waveform_check \ + period_format_check UNIT_TESTS = escaping @@ -34,3 +39,5 @@ period_check_negative = 1 waveform_check_verify = true waveform_check_negative = 1 +period_format_check_verify = true +period_format_check_negative = 1
diff --git a/sdc-plugin/tests/period_format_check/period_format_check.tcl b/sdc-plugin/tests/period_format_check/period_format_check.tcl new file mode 100644 index 0000000..bc613de --- /dev/null +++ b/sdc-plugin/tests/period_format_check/period_format_check.tcl
@@ -0,0 +1,17 @@ +yosys -import +plugin -i sdc +# Import the commands from the plugins to the tcl interpreter +yosys -import + +read_verilog $::env(DESIGN_TOP).v +read_verilog -specify -lib -D_EXPLICIT_CARRY +/xilinx/cells_sim.v +read_verilog -lib +/xilinx/cells_xtra.v +hierarchy -check -auto-top +# Start flow after library reading +synth_xilinx -vpr -flatten -abc9 -nosrl -nodsp -iopad -run prepare:check + +# Propagate the clocks +propagate_clocks + +# Write out the SDC file after the clock propagation step +write_sdc $::env(DESIGN_TOP).sdc
diff --git a/sdc-plugin/tests/period_format_check/period_format_check.v b/sdc-plugin/tests/period_format_check/period_format_check.v new file mode 100644 index 0000000..e6ab294 --- /dev/null +++ b/sdc-plugin/tests/period_format_check/period_format_check.v
@@ -0,0 +1,36 @@ +module top((* CLOCK_SIGNAL = "yes", PERIOD = "bad value", WAVEFORM = "0 5" *) input clk, + input clk2, + input [1:0] in, + output [5:0] out ); + +reg [1:0] cnt = 0; +wire clk_int_1, clk_int_2; +IBUF ibuf_proxy(.I(clk), .O(ibuf_proxy_out)); +IBUF ibuf_inst(.I(ibuf_proxy_out), .O(ibuf_out)); +assign clk_int_1 = ibuf_out; +assign clk_int_2 = clk_int_1; + +always @(posedge clk_int_2) begin + cnt <= cnt + 1; +end + +middle middle_inst_1(.clk(ibuf_out), .out(out[2])); +middle middle_inst_2(.clk(clk_int_1), .out(out[3])); +middle middle_inst_3(.clk(clk_int_2), .out(out[4])); +middle middle_inst_4(.clk(clk2), .out(out[5])); + +assign out[1:0] = {cnt[0], in[0]}; +endmodule + +module middle(input clk, + output out); + +reg [1:0] cnt = 0; +wire clk_int; +assign clk_int = clk; +always @(posedge clk_int) begin + cnt <= cnt + 1; +end + +assign out = cnt[0]; +endmodule