Add support for combinational delay specification in Verilog Signed-off-by: David Shah <davey1576@gmail.com>
diff --git a/adder/pb_type.xml b/adder/pb_type.xml index 05124b1..e675790 100644 --- a/adder/pb_type.xml +++ b/adder/pb_type.xml
@@ -5,4 +5,10 @@ <output equivalent="false" name="y" num_pins="1"/> <output equivalent="false" name="co" num_pins="1"/> <interconnect/> + <delay_constant in_port="adder.a" max="20e-12" out_port="adder.y"/> + <delay_constant in_port="adder.b" max="20e-12" out_port="adder.y"/> + <delay_constant in_port="adder.ci" max="10e-12" out_port="adder.y"/> + <delay_constant in_port="adder.a" max="10e-12" out_port="adder.co"/> + <delay_constant in_port="adder.b" max="10e-12" out_port="adder.co"/> + <delay_constant in_port="adder.ci" max="7e-12" out_port="adder.co"/> </pb_type>
diff --git a/adder/sim.v b/adder/sim.v index a454237..2d9be56 100644 --- a/adder/sim.v +++ b/adder/sim.v
@@ -1,3 +1,14 @@ -module adder(input a, b, ci, output y, co); +module adder( + input a, + input b, + input ci, + (* DELAY_CONST_a = "20e-12" *) + (* DELAY_CONST_b = "20e-12" *) + (* DELAY_CONST_ci = "10e-12" *) + output y, + (* DELAY_CONST_a = "10e-12" *) + (* DELAY_CONST_b = "10e-12" *) + (* DELAY_CONST_ci = "7e-12" *) + output co); assign {co, y} = a + b + ci; endmodule
diff --git a/lut2/model.xml b/lut2/model.xml index cb6470d..f062f9f 100644 --- a/lut2/model.xml +++ b/lut2/model.xml
@@ -1,8 +1,7 @@ <models> <model name="lut2"> <input_ports> - <port combinational_sink_ports="y" name="a"/> - <port combinational_sink_ports="y" name="b"/> + <port combinational_sink_ports="y" name="in"/> </input_ports> <output_ports> <port name="y"/>
diff --git a/lut2/pb_type.xml b/lut2/pb_type.xml index 96896f1..953d8f3 100644 --- a/lut2/pb_type.xml +++ b/lut2/pb_type.xml
@@ -1,7 +1,10 @@ <pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="lut2" num_pb="1"> - <input equivalent="false" name="a" num_pins="1"/> - <input equivalent="false" name="b" num_pins="1"/> + <input equivalent="false" name="in" num_pins="2"/> <output equivalent="false" name="y" num_pins="1"/> <output equivalent="false" name="co" num_pins="1"/> <interconnect/> + <delay_matrix in_port="lut2.in" out_port="lut2.y" type="max"> +10e-12 + 10e-12 +</delay_matrix> </pb_type>
diff --git a/lut2/sim.v b/lut2/sim.v index a1143b3..34c235d 100644 --- a/lut2/sim.v +++ b/lut2/sim.v
@@ -1,5 +1,9 @@ -module lut2 (input a, b, output y, co); +module lut2 ( + input [1:0] in, + (* DELAY_MATRIX_in = "10e-12; 10e-12" *) + output y, + output co); parameter [3:0] content = 4'b1000; -assign y = content[{b, a}]; +assign y = content[in]; assign co = 1'b0; endmodule
diff --git a/pb_type.xml b/pb_type.xml index 095c270..83bcaf3 100644 --- a/pb_type.xml +++ b/pb_type.xml
@@ -28,8 +28,8 @@ <direct input="lut2.y" name="dff_d" output="dff.d"/> <direct input="test_lut.rst" name="dff_rst" output="dff.rst"/> <direct input="dff.q" name="test_lut_q" output="test_lut.q"/> - <direct input="test_lut.a" name="lut2_a" output="lut2.a"/> - <direct input="test_lut.b" name="lut2_b" output="lut2.b"/> + <direct input="test_lut.a" name="lut2_in[2]" output="lut2.in[2]"/> + <direct input="test_lut.b" name="lut2_in[2]" output="lut2.in[2]"/> <direct input="lut2.co" name="test_lut_co" output="test_lut.co"/> </interconnect> </mode>
diff --git a/sim.v b/sim.v index 0500920..ed6ceff 100644 --- a/sim.v +++ b/sim.v
@@ -20,7 +20,7 @@ module test_lut(input clk, rst, a, b, ci, output q, co); wire d; -lut2 lut2_i(.a(a), .b(b), .y(d), .co(co)); +lut2 lut2_i(.in({b, a}), .y(d), .co(co)); dff dff_i(.clk(clk), .rst(rst), .d(d), .q(q)); endmodule