utils/vlog: Tests for vlog_to_XXX based around DSP style blocks. Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
diff --git a/tests/dsp_combinational/dsp_comb.model.xml b/tests/dsp_combinational/dsp_comb.model.xml new file mode 100644 index 0000000..b7f6ad2 --- /dev/null +++ b/tests/dsp_combinational/dsp_comb.model.xml
@@ -0,0 +1,13 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#sequential-block-no-internal-paths --> + <model name="dsp_comb"> + <input_ports> + <port name="a" combinational_sink_ports="out"/> + <port name="b" combinational_sink_ports="out"/> + <port name="m" combinational_sink_ports="out"/> + </input_ports> + <output_ports> + <port name="out"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_combinational/dsp_comb.pb_type.xml b/tests/dsp_combinational/dsp_comb.pb_type.xml new file mode 100644 index 0000000..235a4a2 --- /dev/null +++ b/tests/dsp_combinational/dsp_comb.pb_type.xml
@@ -0,0 +1,14 @@ +<pb_type name="adder" blif_model=".subckt adder" num_pb="1"> + <input name="a" num_pins="1"/> + <input name="b" num_pins="1"/> + <input name="cin" num_pins="1"/> + <output name="cout" num_pins="1"/> + <output name="sum" num_pins="1"/> + + <delay_constant max="300e-12" in_port="adder.a" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.b" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.cin" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.a" out_port="adder.cout"/> + <delay_constant max="300e-12" in_port="adder.b" out_port="adder.cout"/> + <delay_constant max="10e-12" in_port="adder.cin" out_port="adder.cout"/> +</pb_type>
diff --git a/tests/dsp_combinational/dsp_comb.sim.v b/tests/dsp_combinational/dsp_comb.sim.v new file mode 100644 index 0000000..a1b1541 --- /dev/null +++ b/tests/dsp_combinational/dsp_comb.sim.v
@@ -0,0 +1,18 @@ +`ifndef DSP_COMB +`define DSP_COMB +module dsp_comb ( + a, b, m, + out +); + localparam DATA_WIDTH = 64; + + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + + output wire [DATA_WIDTH-1:0] out; + + // Full adder combinational logic + assign out = m ? a * b : a / b; +endmodule +`endif
diff --git a/tests/dsp_in_registered/dsp_regi.model.xml b/tests/dsp_in_registered/dsp_regi.model.xml new file mode 100644 index 0000000..6934652 --- /dev/null +++ b/tests/dsp_in_registered/dsp_regi.model.xml
@@ -0,0 +1,15 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_comb.model.xml" xpointer="xpointer(models/child::node())"/> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <model name="dsp_regi"> + <input_ports> + <port name="a" combinational_sink_ports="out" clock="clk"/> + <port name="b" combinational_sink_ports="out" clock="clk"/> + <port name="clk" is_clock="1"/> + <port name="m" combinational_sink_ports="out" clock="clk"/> + </input_ports> + <output_ports> + <port name="out"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_in_registered/dsp_regi.pb_type.xml b/tests/dsp_in_registered/dsp_regi.pb_type.xml new file mode 100644 index 0000000..c1f9b7a --- /dev/null +++ b/tests/dsp_in_registered/dsp_regi.pb_type.xml
@@ -0,0 +1,22 @@ +<pb_type name="mem_sp" blif_model=".subckt single_port_ram_mixed" num_pb="1"> + <input name="addr" num_pins="9"/> + <input name="data" num_pins="64"/> + <input name="we" num_pins="1"/> + <output name="out" num_pins="64"/> + <clock name="clk" num_pins="1"/> + + <!-- External input register timing --> + <T_setup value="50e-12" port="mem_sp.addr" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.data" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal input register timing --> + <T_clock_to_Q max="200e-12" port="mem_sp.addr" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.data" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal combinational delay --> + <delay_constant max="800e-12" in_port="mem_sp.addr" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.data" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.we" out_port="mem_sp.out"/> +</pb_type>
diff --git a/tests/dsp_in_registered/dsp_regi.sim.v b/tests/dsp_in_registered/dsp_regi.sim.v new file mode 100644 index 0000000..cc37128 --- /dev/null +++ b/tests/dsp_in_registered/dsp_regi.sim.v
@@ -0,0 +1,22 @@ +`include "../dsp_combinational/dsp_comb.sim.v" + +module dsp_regi (clk, a, b, m, out); + localparam DATA_WIDTH = 64; + + input wire clk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + reg [DATA_WIDTH/2-1:0] q_a; + reg [DATA_WIDTH/2-1:0] q_b; + reg q_m; + always @(posedge clk) begin + q_a <= a; + q_b <= b; + q_m <= m; + end + + dsp_comb comb (.a(q_a), .b(q_b), .m(q_m), .out(out)); +endmodule
diff --git a/tests/dsp_inout_registered/dsp_regio.model.xml b/tests/dsp_inout_registered/dsp_regio.model.xml new file mode 100644 index 0000000..ca29c9c --- /dev/null +++ b/tests/dsp_inout_registered/dsp_regio.model.xml
@@ -0,0 +1,15 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_comb.model.xml" xpointer="xpointer(models/child::node())"/> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <model name="dsp_regio"> + <input_ports> + <port name="a" combinational_sink_ports="out" clock="clk"/> + <port name="b" combinational_sink_ports="out" clock="clk"/> + <port name="clk" is_clock="1"/> + <port name="m" combinational_sink_ports="out" clock="clk"/> + </input_ports> + <output_ports> + <port name="out" clock="clk"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_inout_registered/dsp_regio.pb_type.xml b/tests/dsp_inout_registered/dsp_regio.pb_type.xml new file mode 100644 index 0000000..c1f9b7a --- /dev/null +++ b/tests/dsp_inout_registered/dsp_regio.pb_type.xml
@@ -0,0 +1,22 @@ +<pb_type name="mem_sp" blif_model=".subckt single_port_ram_mixed" num_pb="1"> + <input name="addr" num_pins="9"/> + <input name="data" num_pins="64"/> + <input name="we" num_pins="1"/> + <output name="out" num_pins="64"/> + <clock name="clk" num_pins="1"/> + + <!-- External input register timing --> + <T_setup value="50e-12" port="mem_sp.addr" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.data" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal input register timing --> + <T_clock_to_Q max="200e-12" port="mem_sp.addr" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.data" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal combinational delay --> + <delay_constant max="800e-12" in_port="mem_sp.addr" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.data" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.we" out_port="mem_sp.out"/> +</pb_type>
diff --git a/tests/dsp_inout_registered/dsp_regio.sim.v b/tests/dsp_inout_registered/dsp_regio.sim.v new file mode 100644 index 0000000..0bc4ba7 --- /dev/null +++ b/tests/dsp_inout_registered/dsp_regio.sim.v
@@ -0,0 +1,33 @@ +`include "../dsp_combinational/dsp_comb.sim.v" + +/* DSP Block with register on both the inputs and the output */ +module dsp_regio (clk, a, b, m, out); + localparam DATA_WIDTH = 64; + + input wire clk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + /* Input registers */ + reg [DATA_WIDTH/2-1:0] q_a; + reg [DATA_WIDTH/2-1:0] q_b; + reg q_m; + always @(posedge clk) begin + q_a <= a; + q_b <= b; + end + + wire [DATA_WIDTH-1:0] c_out; + dsp_comb comb (.a(a), .b(b), .m(m), .out(c_out)); + //dsp_comb comb (.a(q_a), .b(q_b), .m(q_m), .out(c_out)); + + /* Output register */ + reg [DATA_WIDTH-1:0] q_out; + always @(posedge clk) begin + q_out <= c_out; + end + + assign out = q_out; +endmodule
diff --git a/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.model.xml b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.model.xml new file mode 100644 index 0000000..cd21824 --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.model.xml
@@ -0,0 +1,16 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_comb.model.xml" xpointer="xpointer(models/child::node())"/> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <model name="dsp_regio_dualclk"> + <input_ports> + <port name="a" combinational_sink_ports="out" clock="iclk"/> + <port name="b" combinational_sink_ports="out" clock="iclk"/> + <port name="iclk" is_clock="1"/> + <port name="m" combinational_sink_ports="out" clock="iclk"/> + <port name="oclk" is_clock="1"/> + </input_ports> + <output_ports> + <port name="out" clock="oclk"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.pb_type.xml b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.pb_type.xml new file mode 100644 index 0000000..c1f9b7a --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.pb_type.xml
@@ -0,0 +1,22 @@ +<pb_type name="mem_sp" blif_model=".subckt single_port_ram_mixed" num_pb="1"> + <input name="addr" num_pins="9"/> + <input name="data" num_pins="64"/> + <input name="we" num_pins="1"/> + <output name="out" num_pins="64"/> + <clock name="clk" num_pins="1"/> + + <!-- External input register timing --> + <T_setup value="50e-12" port="mem_sp.addr" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.data" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal input register timing --> + <T_clock_to_Q max="200e-12" port="mem_sp.addr" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.data" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal combinational delay --> + <delay_constant max="800e-12" in_port="mem_sp.addr" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.data" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.we" out_port="mem_sp.out"/> +</pb_type>
diff --git a/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.sim.v b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.sim.v new file mode 100644 index 0000000..13e3d15 --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/dsp_regio_dualclk.sim.v
@@ -0,0 +1,34 @@ +`include "../dsp_combinational/dsp_comb.sim.v" + +/* DSP Block with register on both the inputs and the output */ +module dsp_regio_dualclk (iclk, oclk, a, b, m, out); + localparam DATA_WIDTH = 64; + + input wire iclk; + input wire oclk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + /* Input registers on iclk */ + reg [DATA_WIDTH/2-1:0] q_a; + reg [DATA_WIDTH/2-1:0] q_b; + reg q_m; + always @(posedge iclk) begin + q_a <= a; + q_b <= b; + q_m <= m; + end + + wire [DATA_WIDTH-1:0] c_out; + dsp_comb comb (.a(a), .b(b), .m(m), .out(c_out)); + + /* Output register on oclk */ + reg [DATA_WIDTH-1:0] q_out; + always @(posedge oclk) begin + q_out <= c_out; + end + + assign out = q_out; +endmodule
diff --git a/tests/dsp_modes/dsp_modes.model.xml b/tests/dsp_modes/dsp_modes.model.xml new file mode 100644 index 0000000..133ccd5 --- /dev/null +++ b/tests/dsp_modes/dsp_modes.model.xml
@@ -0,0 +1,16 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_in_registered/dsp_regi.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_inout_registered/dsp_regio.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_out_registered/dsp_rego.model.xml" xpointer="xpointer(models/child::node())"/> + <model name="dsp_modes"> + <input_ports> + <port clock="clk" combinational_sink_ports="out" name="a"/> + <port clock="clk" combinational_sink_ports="out" name="b"/> + <port is_clock="1" name="clk"/> + <port clock="clk" combinational_sink_ports="out" name="m"/> + </input_ports> + <output_ports> + <port clock="clk" name="out"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_modes/dsp_modes.sim.v b/tests/dsp_modes/dsp_modes.sim.v new file mode 100644 index 0000000..9c82379 --- /dev/null +++ b/tests/dsp_modes/dsp_modes.sim.v
@@ -0,0 +1,28 @@ +`include "../dsp_in_registered/dsp_regi.sim.v" +`include "../dsp_out_registered/dsp_rego.sim.v" +`include "../dsp_inout_registered/dsp_regio.sim.v" + +/* DSP Block with register on both the inputs and the output */ +(* MODES="REGISTERED_IN; REGISTERED_OUT; REGISTERED_INOUT" *) +module dsp_modes (clk, a, b, m, out); + localparam DATA_WIDTH = 64; + + parameter MODE = "REGISTERED_INOUT"; + + input wire clk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + /* Input registers */ + generate + if (MODE == "REGISTERED_IN") begin + dsp_regi dsp_int_regi (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_OUT") begin + dsp_rego dsp_int_rego (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_INOUT") begin + dsp_regio dsp_int_regio (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end + endgenerate +endmodule
diff --git a/tests/dsp_out_registered/dsp_rego.model.xml b/tests/dsp_out_registered/dsp_rego.model.xml new file mode 100644 index 0000000..7b596e1 --- /dev/null +++ b/tests/dsp_out_registered/dsp_rego.model.xml
@@ -0,0 +1,15 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_comb.model.xml" xpointer="xpointer(models/child::node())"/> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <model name="dsp_rego"> + <input_ports> + <port name="a" combinational_sink_ports="out"/> + <port name="b" combinational_sink_ports="out"/> + <port name="clk" is_clock="1"/> + <port name="m" combinational_sink_ports="out"/> + </input_ports> + <output_ports> + <port name="out" clock="clk"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_out_registered/dsp_rego.pb_type.xml b/tests/dsp_out_registered/dsp_rego.pb_type.xml new file mode 100644 index 0000000..c1f9b7a --- /dev/null +++ b/tests/dsp_out_registered/dsp_rego.pb_type.xml
@@ -0,0 +1,22 @@ +<pb_type name="mem_sp" blif_model=".subckt single_port_ram_mixed" num_pb="1"> + <input name="addr" num_pins="9"/> + <input name="data" num_pins="64"/> + <input name="we" num_pins="1"/> + <output name="out" num_pins="64"/> + <clock name="clk" num_pins="1"/> + + <!-- External input register timing --> + <T_setup value="50e-12" port="mem_sp.addr" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.data" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal input register timing --> + <T_clock_to_Q max="200e-12" port="mem_sp.addr" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.data" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal combinational delay --> + <delay_constant max="800e-12" in_port="mem_sp.addr" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.data" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.we" out_port="mem_sp.out"/> +</pb_type>
diff --git a/tests/dsp_out_registered/dsp_rego.sim.v b/tests/dsp_out_registered/dsp_rego.sim.v new file mode 100644 index 0000000..6557f03 --- /dev/null +++ b/tests/dsp_out_registered/dsp_rego.sim.v
@@ -0,0 +1,22 @@ +`include "../dsp_combinational/dsp_comb.sim.v" + +/* DSP Block with register on the output */ +module dsp_rego (clk, a, b, m, out); + localparam DATA_WIDTH = 64; + + input wire clk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + wire [DATA_WIDTH-1:0] c_out; + dsp_comb comb (.a(a), .b(b), .m(m), .out(c_out)); + + reg [DATA_WIDTH-1:0] q_out; + always @(posedge clk) begin + q_out <= c_out; + end + + assign out = q_out; +endmodule
diff --git a/tests/dsp_partial_registered/dsp_partial_registered.model.xml b/tests/dsp_partial_registered/dsp_partial_registered.model.xml new file mode 100644 index 0000000..f7d2be6 --- /dev/null +++ b/tests/dsp_partial_registered/dsp_partial_registered.model.xml
@@ -0,0 +1,15 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_comb.model.xml" xpointer="xpointer(models/child::node())"/> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <model name="dsp_regio"> + <input_ports> + <port name="a" combinational_sink_ports="out" clock="clk"/> + <port name="b" combinational_sink_ports="out" clock="clk"/> + <port name="clk" is_clock="1"/> + <port name="m" combinational_sink_ports="out"/> + </input_ports> + <output_ports> + <port name="out" clock="clk"/> + </output_ports> + </model> +</models>
diff --git a/tests/dsp_partial_registered/dsp_partial_registered.pb_type.xml b/tests/dsp_partial_registered/dsp_partial_registered.pb_type.xml new file mode 100644 index 0000000..c1f9b7a --- /dev/null +++ b/tests/dsp_partial_registered/dsp_partial_registered.pb_type.xml
@@ -0,0 +1,22 @@ +<pb_type name="mem_sp" blif_model=".subckt single_port_ram_mixed" num_pb="1"> + <input name="addr" num_pins="9"/> + <input name="data" num_pins="64"/> + <input name="we" num_pins="1"/> + <output name="out" num_pins="64"/> + <clock name="clk" num_pins="1"/> + + <!-- External input register timing --> + <T_setup value="50e-12" port="mem_sp.addr" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.data" clock="clk"/> + <T_setup value="50e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal input register timing --> + <T_clock_to_Q max="200e-12" port="mem_sp.addr" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.data" clock="clk"/> + <T_clock_to_Q max="200e-12" port="mem_sp.we" clock="clk"/> + + <!-- Internal combinational delay --> + <delay_constant max="800e-12" in_port="mem_sp.addr" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.data" out_port="mem_sp.out"/> + <delay_constant max="800e-12" in_port="mem_sp.we" out_port="mem_sp.out"/> +</pb_type>
diff --git a/tests/dsp_partial_registered/dsp_partial_registered.sim.v b/tests/dsp_partial_registered/dsp_partial_registered.sim.v new file mode 100644 index 0000000..eab72c3 --- /dev/null +++ b/tests/dsp_partial_registered/dsp_partial_registered.sim.v
@@ -0,0 +1,32 @@ +`include "../dsp_combinational/dsp_comb.sim.v" + +/* DSP Block with register on both the inputs and the output */ +module dsp_partial_registered (clk, a, b, m, out); + localparam DATA_WIDTH = 64; + + input wire clk; + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + output wire [DATA_WIDTH-1:0] out; + + /* Input registers */ + reg [DATA_WIDTH/2-1:0] q_a; + reg [DATA_WIDTH/2-1:0] q_b; + reg q_m; + always @(posedge clk) begin + q_a <= a; + q_b <= b; + end + + wire [DATA_WIDTH-1:0] c_out; + dsp_comb comb (.a(a), .b(b), .m(m), .out(c_out)); + + /* Output register */ + reg [DATA_WIDTH-1:0] q_out; + always @(posedge clk) begin + q_out <= c_out; + end + + assign out = q_out; +endmodule
diff --git a/tests/fig41-full-adder/adder.model.xml b/tests/fig41-full-adder/adder.model.xml new file mode 100644 index 0000000..5ac3aef --- /dev/null +++ b/tests/fig41-full-adder/adder.model.xml
@@ -0,0 +1,14 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#sequential-block-no-internal-paths --> + <model name="adder"> + <input_ports> + <port name="a" combinational_sink_ports="cout sum"/> + <port name="b" combinational_sink_ports="cout sum"/> + <port name="cin" combinational_sink_ports="cout sum"/> + </input_ports> + <output_ports> + <port name="cout"/> + <port name="sum"/> + </output_ports> + </model> +</models>
diff --git a/tests/fig41-full-adder/adder.pb_type.xml b/tests/fig41-full-adder/adder.pb_type.xml new file mode 100644 index 0000000..235a4a2 --- /dev/null +++ b/tests/fig41-full-adder/adder.pb_type.xml
@@ -0,0 +1,14 @@ +<pb_type name="adder" blif_model=".subckt adder" num_pb="1"> + <input name="a" num_pins="1"/> + <input name="b" num_pins="1"/> + <input name="cin" num_pins="1"/> + <output name="cout" num_pins="1"/> + <output name="sum" num_pins="1"/> + + <delay_constant max="300e-12" in_port="adder.a" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.b" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.cin" out_port="adder.sum"/> + <delay_constant max="300e-12" in_port="adder.a" out_port="adder.cout"/> + <delay_constant max="300e-12" in_port="adder.b" out_port="adder.cout"/> + <delay_constant max="10e-12" in_port="adder.cin" out_port="adder.cout"/> +</pb_type>
diff --git a/tests/fig41-full-adder/adder.sdf b/tests/fig41-full-adder/adder.sdf new file mode 100644 index 0000000..9b897d2 --- /dev/null +++ b/tests/fig41-full-adder/adder.sdf
@@ -0,0 +1,17 @@ +(DELAYFILE + (CELL + (CELLTYPE "adder") + (INSTANCE *) + (DELAY + (ABSOLUTE + (IOPATH a sum (::300) (::300)) + (IOPATH b sum (::300) (::300)) + (IOPATH cin sum (::300) (::300)) + + (IOPATH a cout (::300) (::300)) + (IOPATH b cout (::300) (::300)) + (IOPATH cin cout (::10) (::10)) + ) + ) + ) +)
diff --git a/tests/fig41-full-adder/adder.sim.v b/tests/fig41-full-adder/adder.sim.v new file mode 100644 index 0000000..8d6f351 --- /dev/null +++ b/tests/fig41-full-adder/adder.sim.v
@@ -0,0 +1,35 @@ +module adder ( + a, b, cin, + sum, cout +); + input wire a; + input wire b; + input wire cin; + + output wire sum; + output wire cout; + + // Full adder combinational logic + assign sum = a ^ b ^ cin; + assign cout = ((a ^ b) & cin) | (a & b); + + // Timing parameters, not supported by Yosys at the moment. +`ifndef YOSYS + `timescale 1ps/1ps + specify + specparam T1 300; + specparam T2 10; + // (input->output) min:typ:max + + (a => sum) = T1; + (b => sum) = T1; + (cin => sum) = T1; + + (a => cout) = T1; + (b => cout) = T1; + (cin => cout) = T2; + + endspecify +`endif +endmodule +
diff --git a/tests/fig42-dff/dff.model.xml b/tests/fig42-dff/dff.model.xml new file mode 100644 index 0000000..f830c23 --- /dev/null +++ b/tests/fig42-dff/dff.model.xml
@@ -0,0 +1,12 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#sequential-block-no-internal-paths --> + <model name="dff"> + <input_ports> + <port name="d" clock="clk"/> + <port name="clk" is_clock="1"/> + </input_ports> + <output_ports> + <port name="q" clock="clk"/> + </output_ports> + </model> +</models>
diff --git a/tests/fig42-dff/dff.sim.v b/tests/fig42-dff/dff.sim.v new file mode 100644 index 0000000..205f8fc --- /dev/null +++ b/tests/fig42-dff/dff.sim.v
@@ -0,0 +1,51 @@ +//`include "../../../../vpr/ff/vpr_ff.sim.v" + +module dff (d, clk, q); + input wire d; + input wire clk; + output wire q; + + always @ ( posedge clk ) begin + q <= d; + end + /* + VPR_FF ff( + .D(d), + .clk(clk), + .Q(q), + ); + */ + +`ifndef YOSYS + specify + specparam + tplh$CLK$QP = 1.0, + tphl$CLK$QP = 1.0, + tplh$CLK$QN = 1.0, + tphl$CLK$QN = 1.0, + tsetup$D$CLK = 1.0, + thold$D$CLK = 1.0, + tminpwl$CLK = 1.0, + tminpwh$CLK = 1.0; + + // PATH DELAYS + if (flag) + // Polarity of QP is positive referenced to D + (posedge CLK *> (QP +: D)) = (tplh$CLK$QP, tphl$CLK$QP); + if (flag) + // Polarity of QN is negative referenced to D + (posedge CLK *> (QN -: D)) = (tplh$CLK$QN, tphl$CLK$QN); + + // SETUP AND HOLD CHECKS + $setuphold(posedge CLK &&& (flag == 1), posedge D, tsetup$D$CLK, thold$D$CLK, NOTIFIER); + + $setuphold(posedge CLK &&& (flag == 1), negedge D, tsetup$D$CLK, thold$D$CLK, NOTIFIER); + + // MINIMUM WIDTH CHECKING + $width(negedge CLK, tminpwl$CLK, 0, NOTIFIER); + $width(posedge CLK, tminpwh$CLK, 0, NOTIFIER); + + endspecify +`endif + +endmodule
diff --git a/tests/simple_pll/simple_pll.model.xml b/tests/simple_pll/simple_pll.model.xml new file mode 100644 index 0000000..356e686 --- /dev/null +++ b/tests/simple_pll/simple_pll.model.xml
@@ -0,0 +1,10 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <model name="simple_pll"> + <input_ports> + <port name="in_clock" is_clock="1"/> + </input_ports> + <output_ports> + <port name="out_clock" is_clock="1"/> + </output_ports> + </model> +</models>
diff --git a/tests/simple_pll/simple_pll.sim.v b/tests/simple_pll/simple_pll.sim.v new file mode 100644 index 0000000..d8a0cb5 --- /dev/null +++ b/tests/simple_pll/simple_pll.sim.v
@@ -0,0 +1,15 @@ +/* Simple model of a PLL which divides the input block by 64 */ +module simple_pll (in_clock, out_clock); + + input wire in_clock; + + (* CLOCK *) + output wire out_clock; + + reg [63:0] counter; + always @(posedge in_clock) begin + counter = counter + 1; + end + + assign out_clock = counter[63]; +endmodule