Merge remote-tracking branch 'origin/master' into rework
diff --git a/tests/carry/README.md b/tests/carry/README.md new file mode 100644 index 0000000..54c81a8 --- /dev/null +++ b/tests/carry/README.md
@@ -0,0 +1,15 @@ +## CARRY tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model defined in CBLOCK tests. +Those tests should check the following features: + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files + +## Carry chain inference + + - [ ] automatic inference of carry chains - carry chains defined on ports of included blocks should be propagated to top level module
diff --git a/tests/carry/carry.sim.v b/tests/carry/carry.sim.v new file mode 100644 index 0000000..9263abd --- /dev/null +++ b/tests/carry/carry.sim.v
@@ -0,0 +1,28 @@ +`default_nettype none +`include "cblock/cblock.sim.v" + +module CARRY ( + I0, + I1, + O0, + O1, + CIN, + COUT +); + input wire [3:0] I0; + input wire [3:0] I1; + + output wire O0; + output wire O1; + + // Implicit carry pins + input wire CIN; + output wire COUT; + + // Carry between the two blocks + wire c; + + CBLOCK cblock0 (.I(I0), .O(O0), .CIN(CIN), .COUT(c)); + CBLOCK cblock1 (.I(I1), .O(O1), .CIN(c), .COUT(COUT)); + +endmodule
diff --git a/tests/carry/cblock/README.md b/tests/carry/cblock/README.md new file mode 100644 index 0000000..ea82a59 --- /dev/null +++ b/tests/carry/cblock/README.md
@@ -0,0 +1,22 @@ +## CARRY tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +Those tests should check the following features: + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files + +## Combinational connections + + - [ ] automatic inference of combinational connections between input and output ports + +## Carry chain inference + + - [ ] carry chains inference - carry chains defined on wires with `carry` attribute should be propagated to pb\_type xml file + +## Timings + + - [ ] all the timings defined in Verilog should be propagated to result pb\_type file
diff --git a/tests/carry/cblock/cblock.sim.v b/tests/carry/cblock/cblock.sim.v new file mode 100644 index 0000000..b73ddbb --- /dev/null +++ b/tests/carry/cblock/cblock.sim.v
@@ -0,0 +1,28 @@ +`default_nettype none + +(* whitebox *) +module CBLOCK ( + I, + O, + CIN, + COUT +); + input wire [3:0] I; + (* carry="C" *) + input wire CIN; + + (* DELAY_MATRIX_I="30e-12 30e-12 30e-12 30e-12" *) + (* DELAY_CONST_CIN="30e-12" *) + output wire O; + + (* carry="C" *) + (* DELAY_MATRIX_I="30e-12 30e-12 30e-12 30e-12" *) + (* DELAY_CONST_CIN="30e-12" *) + output wire COUT; + + wire [4:0] internal_sum; + + assign internal_sum = I + CIN; + assign O = internal_sum[4]; + assign COUT = internal_sum[3]; +endmodule
diff --git a/tests/carry/cblock/golden.model.xml b/tests/carry/cblock/golden.model.xml new file mode 100644 index 0000000..a490dc9 --- /dev/null +++ b/tests/carry/cblock/golden.model.xml
@@ -0,0 +1,12 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <model name="CBLOCK"> + <input_ports> + <port combinational_sink_ports="COUT O" name="CIN"/> + <port combinational_sink_ports="COUT O" name="I"/> + </input_ports> + <output_ports> + <port name="COUT"/> + <port name="O"/> + </output_ports> + </model> +</models>
diff --git a/tests/carry/cblock/golden.pb_type.xml b/tests/carry/cblock/golden.pb_type.xml new file mode 100644 index 0000000..7068655 --- /dev/null +++ b/tests/carry/cblock/golden.pb_type.xml
@@ -0,0 +1,19 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" blif_model=".subckt CBLOCK" name="CBLOCK" num_pb="1"> + <input name="CIN" num_pins="1"> + <pack_pattern name="C" type="carry"/> + </input> + <input name="I" num_pins="4"/> + <output name="COUT" num_pins="1"> + <pack_pattern name="C" type="carry"/> + </output> + <output name="O" num_pins="1"/> + <delay_constant in_port="CBLOCK.CIN" max="30e-12" out_port="CBLOCK.COUT"/> + <delay_matrix in_port="CBLOCK.I" out_port="CBLOCK.COUT" type="max"> +30e-12 30e-12 30e-12 30e-12 +</delay_matrix> + <delay_constant in_port="CBLOCK.CIN" max="30e-12" out_port="CBLOCK.O"/> + <delay_matrix in_port="CBLOCK.I" out_port="CBLOCK.O" type="max"> +30e-12 30e-12 30e-12 30e-12 +</delay_matrix> +</pb_type>
diff --git a/tests/carry/golden.model.xml b/tests/carry/golden.model.xml new file mode 100644 index 0000000..9c960ee --- /dev/null +++ b/tests/carry/golden.model.xml
@@ -0,0 +1,3 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="cblock/cblock.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/carry/golden.pb_type.xml b/tests/carry/golden.pb_type.xml new file mode 100644 index 0000000..705b575 --- /dev/null +++ b/tests/carry/golden.pb_type.xml
@@ -0,0 +1,81 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="CARRY" num_pb="1"> + <input name="CIN" num_pins="1"/> + <input name="I0" num_pins="4"/> + <input name="I1" num_pins="4"/> + <output name="COUT" num_pins="1"/> + <output name="O0" num_pins="1"/> + <output name="O1" num_pins="1"/> + <pb_type name="cblock0" num_pb="1"> + <xi:include href="cblock/cblock.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type name="cblock1" num_pb="1"> + <xi:include href="cblock/cblock.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="CIN" type="input"/> + <port from="cblock0" name="CIN" type="output"/> + <pack_pattern name="C" type="carry"> + <port name="CIN" type="input"/> + <port from="cblock0" name="CIN" type="output"/> + </pack_pattern> + </direct> + <direct> + <port name="I0[0]" type="input"/> + <port from="cblock0" name="I[0]" type="output"/> + </direct> + <direct> + <port name="I0[1]" type="input"/> + <port from="cblock0" name="I[1]" type="output"/> + </direct> + <direct> + <port name="I0[2]" type="input"/> + <port from="cblock0" name="I[2]" type="output"/> + </direct> + <direct> + <port name="I0[3]" type="input"/> + <port from="cblock0" name="I[3]" type="output"/> + </direct> + <direct> + <port from="cblock0" name="O" type="input"/> + <port name="O0" type="output"/> + </direct> + <direct> + <port from="cblock0" name="COUT" type="input"/> + <port from="cblock1" name="CIN" type="output"/> + <pack_pattern name="C" type="carry"> + <port from="cblock0" name="COUT" type="input"/> + <port from="cblock1" name="CIN" type="output"/> + </pack_pattern> + </direct> + <direct> + <port name="I1[0]" type="input"/> + <port from="cblock1" name="I[0]" type="output"/> + </direct> + <direct> + <port name="I1[1]" type="input"/> + <port from="cblock1" name="I[1]" type="output"/> + </direct> + <direct> + <port name="I1[2]" type="input"/> + <port from="cblock1" name="I[2]" type="output"/> + </direct> + <direct> + <port name="I1[3]" type="input"/> + <port from="cblock1" name="I[3]" type="output"/> + </direct> + <direct> + <port from="cblock1" name="COUT" type="input"/> + <port name="COUT" type="output"/> + <pack_pattern name="C" type="carry"> + <port from="cblock1" name="COUT" type="input"/> + <port name="COUT" type="output"/> + </pack_pattern> + </direct> + <direct> + <port from="cblock1" name="O" type="input"/> + <port name="O1" type="output"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/clocks/README.md b/tests/clocks/README.md new file mode 100644 index 0000000..752921f --- /dev/null +++ b/tests/clocks/README.md
@@ -0,0 +1,21 @@ +## Clock detection tests + +This directory contains test for the clock detection functionality for the +`v2x_to_model.py` tool. + + +## Detection of clock signals + + - [ ] Signal is named `clk`. + - [ ] Signal has `clk` in the name. + - [ ] Manually set via the `(* CLOCK *)` Verilog attribute. + - [ ] Signal drives synchronous logic (IE flipflop). + - [ ] Detection in recursive module includes. + +## Detection of clock association + + - [ ] Clock comes from synchronous logic + - [ ] Manually associated via `(* ASSOC_CLOCK="<clock signal"> *)` Verilog + attribute. + - [ ] Detection in recursive module includes. +
diff --git a/tests/clocks/dff_comb_one_clock/dff_comb_one_clock.sim.v b/tests/clocks/dff_comb_one_clock/dff_comb_one_clock.sim.v new file mode 100644 index 0000000..a1e60c2 --- /dev/null +++ b/tests/clocks/dff_comb_one_clock/dff_comb_one_clock.sim.v
@@ -0,0 +1,16 @@ +/* + * `input wire a` should be detected as a clock because it drives the flip + * flop. + */ +module BLOCK(a, b, c, d); + input wire a; + input wire b; + input wire c; + output wire d; + + reg r; + always @ ( posedge a ) begin + r <= b | ~c; + end + assign d = r; +endmodule
diff --git a/tests/clocks/dff_comb_one_clock/golden.model.xml b/tests/clocks/dff_comb_one_clock/golden.model.xml new file mode 100644 index 0000000..dab8f40 --- /dev/null +++ b/tests/clocks/dff_comb_one_clock/golden.model.xml
@@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a" is_clock="1" /> + <port name="b" combinational_sink_ports="d" clock="a" /> + <port name="c" combinational_sink_ports="d" clock="a" /> + </input_ports> + <output_ports> + <port name="d" clock="a" /> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/dff_one_clock/dff_one_clock.sim.v b/tests/clocks/dff_one_clock/dff_one_clock.sim.v new file mode 100644 index 0000000..d6e2c39 --- /dev/null +++ b/tests/clocks/dff_one_clock/dff_one_clock.sim.v
@@ -0,0 +1,15 @@ +/* + * `input wire a` should be detected as a clock because it drives the flip + * flop. + */ +module BLOCK(a, b, c); + input wire a; + input wire b; + output wire c; + + reg r; + always @ ( posedge a ) begin + r <= b; + end + assign c = r; +endmodule
diff --git a/tests/clocks/dff_one_clock/golden.model.xml b/tests/clocks/dff_one_clock/golden.model.xml new file mode 100644 index 0000000..f582f0b --- /dev/null +++ b/tests/clocks/dff_one_clock/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a" is_clock="1" /> + <port name="b" clock="a" /> + </input_ports> + <output_ports> + <port name="c" clock="a" /> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/dff_two_clocks/dff_two_clocks.sim.v b/tests/clocks/dff_two_clocks/dff_two_clocks.sim.v new file mode 100644 index 0000000..c9bcb0f --- /dev/null +++ b/tests/clocks/dff_two_clocks/dff_two_clocks.sim.v
@@ -0,0 +1,21 @@ +module BLOCK(c1, c2, a, b, c, o1, o2); + input wire c1; + input wire c2; + input wire a; + input wire b; + input wire c; + output wire o1; + output wire o2; + + reg r1; + reg r2; + always @ ( posedge c1 ) begin + r1 <= a | b; + end + always @ ( posedge c2 ) begin + r2 <= b | c; + end + + assign o1 = r1; + assign o2 = r2; +endmodule
diff --git a/tests/clocks/dff_two_clocks/golden.model.xml b/tests/clocks/dff_two_clocks/golden.model.xml new file mode 100644 index 0000000..1ca3456 --- /dev/null +++ b/tests/clocks/dff_two_clocks/golden.model.xml
@@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port clock="c1" combinational_sink_ports="o1" name="a"/> + <port clock="c2 c1" combinational_sink_ports="o2 o1" name="b"/> + <port clock="c2" combinational_sink_ports="o2" name="c"/> + <port is_clock="1" name="c1"/> + <port is_clock="1" name="c2"/> + </input_ports> + <output_ports> + <port clock="c1" name="o1"/> + <port clock="c2" name="o2"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/input_attr_clock/golden.model.xml b/tests/clocks/input_attr_clock/golden.model.xml new file mode 100644 index 0000000..91bc492 --- /dev/null +++ b/tests/clocks/input_attr_clock/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a" is_clock="1" /> + <port name="b"/> + </input_ports> + <output_ports> + <port name="o"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/input_attr_clock/input_attr_clock.sim.v b/tests/clocks/input_attr_clock/input_attr_clock.sim.v new file mode 100644 index 0000000..819cb8f --- /dev/null +++ b/tests/clocks/input_attr_clock/input_attr_clock.sim.v
@@ -0,0 +1,11 @@ +/* + * `input wire a` should be detected as a clock because of the `(* CLOCK *)` + * attribute. + */ +(* whitebox *) +module BLOCK(a, b, o); + (* CLOCK *) + input wire a; + input wire b; + output wire o; +endmodule
diff --git a/tests/clocks/input_named_clk/golden.model.xml b/tests/clocks/input_named_clk/golden.model.xml new file mode 100644 index 0000000..bdf49fb --- /dev/null +++ b/tests/clocks/input_named_clk/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="clk" is_clock="1" /> + </input_ports> + <output_ports> + <port name="o"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/input_named_clk/input_named_clk.sim.v b/tests/clocks/input_named_clk/input_named_clk.sim.v new file mode 100644 index 0000000..7d5b619 --- /dev/null +++ b/tests/clocks/input_named_clk/input_named_clk.sim.v
@@ -0,0 +1,10 @@ +/* + * `input wire clk` should be detected as a clock despite this being a black + * box module. + */ +(* whitebox *) +module BLOCK(clk, a, o); + input wire clk; + input wire a; + output wire o; +endmodule
diff --git a/tests/clocks/input_named_rdclk/golden.model.xml b/tests/clocks/input_named_rdclk/golden.model.xml new file mode 100644 index 0000000..26faddf --- /dev/null +++ b/tests/clocks/input_named_rdclk/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="rdclk" is_clock="1" /> + </input_ports> + <output_ports> + <port name="o"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v b/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v new file mode 100644 index 0000000..70d827a --- /dev/null +++ b/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v
@@ -0,0 +1,10 @@ +/* + * `input wire rdclk` should be detected as a clock despite this being a black + * box module. + */ +(* whitebox *) +module BLOCK(rdclk, a, o); + input wire rdclk; + input wire a; + output wire o; +endmodule
diff --git a/tests/clocks/multiple_inputs_named_clk/golden.model.xml b/tests/clocks/multiple_inputs_named_clk/golden.model.xml new file mode 100644 index 0000000..a0625c3 --- /dev/null +++ b/tests/clocks/multiple_inputs_named_clk/golden.model.xml
@@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="b"/> + <port name="c"/> + <port name="rdclk" is_clock="1"/> + <port name="wrclk" is_clock="1"/> + </input_ports> + <output_ports> + <port name="o"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v b/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v new file mode 100644 index 0000000..076d630 --- /dev/null +++ b/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v
@@ -0,0 +1,13 @@ +/* + * `input wire rdclk` and `input wire wrclk` should be detected as a clock + * despite this being a black box module. + */ +(* whitebox *) +module BLOCK(a, rdclk, b, wrclk, c, o); + input wire a; + input wire rdclk; + input wire b; + input wire wrclk; + input wire c; + output wire o; +endmodule
diff --git a/tests/clocks/multiple_outputs_named_clk/golden.model.xml b/tests/clocks/multiple_outputs_named_clk/golden.model.xml new file mode 100644 index 0000000..dff333d --- /dev/null +++ b/tests/clocks/multiple_outputs_named_clk/golden.model.xml
@@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="b"/> + </input_ports> + <output_ports> + <port name="o"/> + <port name="rdclk" is_clock="1"/> + <port name="wrclk" is_clock="1"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v b/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v new file mode 100644 index 0000000..42899f8 --- /dev/null +++ b/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v
@@ -0,0 +1,12 @@ +/* + * `output wire rdclk` and `output wire wrclk` should be detected as a clock + * despite this being a black box module. + */ +(* whitebox *) +module BLOCK(a, b, rdclk, o, wrclk); + input wire a; + input wire b; + output wire rdclk; + output wire o; + output wire wrclk; +endmodule
diff --git a/tests/clocks/output_attr_clock/golden.model.xml b/tests/clocks/output_attr_clock/golden.model.xml new file mode 100644 index 0000000..cd2a735 --- /dev/null +++ b/tests/clocks/output_attr_clock/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a" /> + <port name="b"/> + </input_ports> + <output_ports> + <port name="o" is_clock="1" /> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/output_attr_clock/output_attr_clock.sim.v b/tests/clocks/output_attr_clock/output_attr_clock.sim.v new file mode 100644 index 0000000..bdf4747 --- /dev/null +++ b/tests/clocks/output_attr_clock/output_attr_clock.sim.v
@@ -0,0 +1,11 @@ +/* + * `output wire o` should be detected as a clock because of the `(* CLOCK *)` + * attribute. + */ +(* whitebox *) +module BLOCK(a, b, o); + input wire a; + input wire b; + (* CLOCK *) + output wire o; +endmodule
diff --git a/tests/clocks/output_named_clk/golden.model.xml b/tests/clocks/output_named_clk/golden.model.xml new file mode 100644 index 0000000..5c534ca --- /dev/null +++ b/tests/clocks/output_named_clk/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="b" /> + </input_ports> + <output_ports> + <port name="clk" is_clock="1"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/output_named_clk/output_named_clk.sim.v b/tests/clocks/output_named_clk/output_named_clk.sim.v new file mode 100644 index 0000000..fcf775b --- /dev/null +++ b/tests/clocks/output_named_clk/output_named_clk.sim.v
@@ -0,0 +1,10 @@ +/* + * `output wire clk` should be detected as a clock despite this being a black + * box module. + */ +(* whitebox *) +module BLOCK(a, b, clk); + input wire a; + input wire b; + output wire clk; +endmodule
diff --git a/tests/clocks/output_named_rdclk/golden.model.xml b/tests/clocks/output_named_rdclk/golden.model.xml new file mode 100644 index 0000000..b0fa908 --- /dev/null +++ b/tests/clocks/output_named_rdclk/golden.model.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<models> + <model name="BLOCK"> + <input_ports> + <port name="a"/> + <port name="b"/> + </input_ports> + <output_ports> + <port name="rdclk" is_clock="1"/> + </output_ports> + </model> +</models>
diff --git a/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v b/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v new file mode 100644 index 0000000..4b72b6f --- /dev/null +++ b/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v
@@ -0,0 +1,10 @@ +/* + * `output wire rdclk` should be detected as a clock despite this being a black + * box module. + */ +(* whitebox *) +module BLOCK(a, b, rdclk); + input wire a; + input wire b; + output wire rdclk; +endmodule
diff --git a/tests/dsp_combinational/README.md b/tests/dsp_combinational/README.md new file mode 100644 index 0000000..d83bc78 --- /dev/null +++ b/tests/dsp_combinational/README.md
@@ -0,0 +1,16 @@ +## dsp\_combinational tests + +This directory contains test for the blackbox detection for the +`v2x_to_model.py` and `v2x_to_pb_type` tools. + +Model from this test is used by other dsp tests + +## Detection of combinational connections + + - [ ] output has combinational connection with input + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated +
diff --git a/tests/dsp_combinational/dsp_combinational.sim.v b/tests/dsp_combinational/dsp_combinational.sim.v new file mode 100644 index 0000000..bbfa953 --- /dev/null +++ b/tests/dsp_combinational/dsp_combinational.sim.v
@@ -0,0 +1,22 @@ +`ifndef DSP_COMB +`define DSP_COMB +(* whitebox *) +module DSP_COMBINATIONAL ( + a, b, m, + out +); + localparam DATA_WIDTH = 4; + + input wire [DATA_WIDTH/2-1:0] a; + input wire [DATA_WIDTH/2-1:0] b; + input wire m; + + (* DELAY_CONST_a="30e-12" *) + (* DELAY_CONST_b="30e-12" *) + (* DELAY_CONST_m="10e-12" *) + 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_combinational/golden.model.xml b/tests/dsp_combinational/golden.model.xml new file mode 100644 index 0000000..f958147 --- /dev/null +++ b/tests/dsp_combinational/golden.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_COMBINATIONAL"> + <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/golden.pb_type.xml b/tests/dsp_combinational/golden.pb_type.xml new file mode 100644 index 0000000..7ad8cc9 --- /dev/null +++ b/tests/dsp_combinational/golden.pb_type.xml
@@ -0,0 +1,11 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_COMBINATIONAL"> + <blif_model>.subckt DSP_COMBINATIONAL</blif_model> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <delay_constant in_port="a" out_port="out" max="30e-12"/> + <delay_constant in_port="b" out_port="out" max="30e-12"/> + <delay_constant in_port="m" out_port="out" max="10e-12"/> +</pb_type>
diff --git a/tests/dsp_in_registered/README.md b/tests/dsp_in_registered/README.md new file mode 100644 index 0000000..15da4a4 --- /dev/null +++ b/tests/dsp_in_registered/README.md
@@ -0,0 +1,18 @@ +## dsp\_in\_registered tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model from fig42-dff and dps\_combinational tests. +Those tests should check the following features: + + +## Detection of combinational connections + + - [ ] output has combinational connection with input + - [ ] pack\_pattern defined on wire connections with `pack` attribute + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files +
diff --git a/tests/dsp_in_registered/dsp_in_registered.sim.v b/tests/dsp_in_registered/dsp_in_registered.sim.v new file mode 100644 index 0000000..d81f4c8 --- /dev/null +++ b/tests/dsp_in_registered/dsp_in_registered.sim.v
@@ -0,0 +1,31 @@ +`include "../fig42-dff/dff.sim.v" +`include "../dsp_combinational/dsp_combinational.sim.v" + +/* DSP Block with register on all inputs */ +module DSP_IN_REGISTERED (clk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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 */ + (* pack="DFF2DSP" *) + wire [DATA_WIDTH/2-1:0] q_a; + (* pack="DFF2DSP" *) + wire [DATA_WIDTH/2-1:0] q_b; + (* pack="DFF2DSP" *) + wire q_m; + + genvar i; + for (i=0; i<DATA_WIDTH/2; i=i+1) begin + DFF q_a_ff(.D(a[i]), .Q(q_a[i]), .CLK(clk)); + DFF q_b_ff(.D(b[i]), .Q(q_b[i]), .CLK(clk)); + end + DFF m_ff(.D(m), .Q(q_m), .CLK(clk)); + + /* Combinational Logic */ + DSP_COMBINATIONAL comb (.a(q_a), .b(q_b), .m(q_m), .out(out)); +endmodule
diff --git a/tests/dsp_in_registered/golden.model.xml b/tests/dsp_in_registered/golden.model.xml new file mode 100644 index 0000000..0073b45 --- /dev/null +++ b/tests/dsp_in_registered/golden.model.xml
@@ -0,0 +1,4 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../fig42-dff/dff.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_in_registered/golden.pb_type.xml b/tests/dsp_in_registered/golden.pb_type.xml new file mode 100644 index 0000000..977ec50 --- /dev/null +++ b/tests/dsp_in_registered/golden.pb_type.xml
@@ -0,0 +1,122 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_IN_REGISTERED"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="2" name="q_a_ff"> + <!--old_name DFF old_num_pb 1--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="2" name="q_b_ff"> + <!--old_name DFF old_num_pb 1--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="m_ff"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="m_ff"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="q_a_ff[0]"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="q_a_ff[1]"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="q_b_ff[0]"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="q_b_ff[1]"/> + </direct> + <direct> + <port name="a[0]" type="input"/> + <port name="D" type="output" from="q_a_ff[0]"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="D" type="output" from="q_b_ff[0]"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="D" type="output" from="q_a_ff[1]"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="D" type="output" from="q_b_ff[1]"/> + </direct> + <direct> + <port name="Q" type="input" from="q_a_ff[0]"/> + <port name="a[0]" type="output" from="comb"/> + <pack_pattern name="DFF2DSP" type="pack"> + <port name="Q" type="input" from="q_a_ff[0]"/> + <port name="a[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="q_a_ff[1]"/> + <port name="a[1]" type="output" from="comb"/> + <pack_pattern name="DFF2DSP" type="pack"> + <port name="Q" type="input" from="q_a_ff[1]"/> + <port name="a[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="q_b_ff[0]"/> + <port name="b[0]" type="output" from="comb"/> + <pack_pattern name="DFF2DSP" type="pack"> + <port name="Q" type="input" from="q_b_ff[0]"/> + <port name="b[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="q_b_ff[1]"/> + <port name="b[1]" type="output" from="comb"/> + <pack_pattern name="DFF2DSP" type="pack"> + <port name="Q" type="input" from="q_b_ff[1]"/> + <port name="b[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + <pack_pattern name="DFF2DSP" type="pack"> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="out[0]" type="input" from="comb"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="comb"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="comb"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="comb"/> + <port name="out[3]" type="output"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="D" type="output" from="m_ff"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/dsp_inout_registered/README.md b/tests/dsp_inout_registered/README.md new file mode 100644 index 0000000..950806c --- /dev/null +++ b/tests/dsp_inout_registered/README.md
@@ -0,0 +1,18 @@ +## dsp\_inout\_registered tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model from fig42-dff and dps\_combinational tests. +Those tests should check the following features: + + +## Detection of combinational connections + + - [ ] output has combinational connection with input + - [ ] pack\_pattern defined on wire connections with `pack` attribute + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files +
diff --git a/tests/dsp_inout_registered/dsp_inout_registered.sim.v b/tests/dsp_inout_registered/dsp_inout_registered.sim.v new file mode 100644 index 0000000..0d06b8b --- /dev/null +++ b/tests/dsp_inout_registered/dsp_inout_registered.sim.v
@@ -0,0 +1,41 @@ +`include "../fig42-dff/dff.sim.v" +`include "../dsp_combinational/dsp_combinational.sim.v" + +/* DSP Block with register on both the inputs and the output */ +module DSP_INOUT_REGISTERED (clk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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 */ + (* pack = "DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_a; + (* pack = "DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_b; + (* pack = "DFF-DSP" *) + wire q_m; + + genvar i; + for (i=0; i<DATA_WIDTH/2; i=i+1) begin: input_dffs_gen + DFF q_a_ff(.D(a[i]), .Q(q_a[i]), .CLK(clk)); + DFF q_b_ff(.D(b[i]), .Q(q_b[i]), .CLK(clk)); + end + DFF m_ff(.D(m), .Q(q_m), .CLK(clk)); + + /* Combinational logic */ + (* pack = "DFF-DSP" *) + wire [DATA_WIDTH-1:0] c_out; + DSP_COMBINATIONAL comb (.a(q_a), .b(q_b), .m(q_m), .out(c_out)); + + /* Output register */ + wire [DATA_WIDTH-1:0] q_out; + genvar j; + for (j=0; j<DATA_WIDTH; j=j+1) begin: output_dffs_gen + DFF q_out_ff(.D(c_out[j]), .Q(out[j]), .CLK(clk)); + end + +endmodule
diff --git a/tests/dsp_inout_registered/golden.model.xml b/tests/dsp_inout_registered/golden.model.xml new file mode 100644 index 0000000..0073b45 --- /dev/null +++ b/tests/dsp_inout_registered/golden.model.xml
@@ -0,0 +1,4 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../fig42-dff/dff.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_inout_registered/golden.pb_type.xml b/tests/dsp_inout_registered/golden.pb_type.xml new file mode 100644 index 0000000..5c2e747 --- /dev/null +++ b/tests/dsp_inout_registered/golden.pb_type.xml
@@ -0,0 +1,194 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_INOUT_REGISTERED"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_a_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_b_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_a_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_b_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="m_ff"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_2"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_3"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_b_ff_1"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="m_ff"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_1"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_2"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_3"/> + </direct> + <direct> + <port name="a[0]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_b_ff_1"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="D" type="output" from="m_ff"/> + </direct> + <direct> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_0"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_1"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_2"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_3"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/dsp_inout_registered_dualclk/README.md b/tests/dsp_inout_registered_dualclk/README.md new file mode 100644 index 0000000..39fc8a9 --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/README.md
@@ -0,0 +1,18 @@ +## dsp\_inout\_registered\_dualclk tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model from fig42-dff and dps\_combinational tests. +Those tests should check the following features: + + +## Detection of combinational connections + + - [ ] output has combinational connection with input + - [ ] pack\_pattern defined on wire connections with `pack` attribute + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files +
diff --git a/tests/dsp_inout_registered_dualclk/dsp_inout_registered_dualclk.sim.v b/tests/dsp_inout_registered_dualclk/dsp_inout_registered_dualclk.sim.v new file mode 100644 index 0000000..5cad5bb --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/dsp_inout_registered_dualclk.sim.v
@@ -0,0 +1,42 @@ +`include "../fig42-dff/dff.sim.v" +`include "../dsp_combinational/dsp_combinational.sim.v" + +/* DSP Block with register on both the inputs and the output, which use different clocks */ +module DSP_INOUT_REGISTERED_DUALCLK (iclk, oclk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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 */ + (* pack="DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_a; + (* pack="DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_b; + (* pack="DFF-DSP" *) + wire q_m; + + genvar i; + for (i=0; i<DATA_WIDTH/2; i=i+1) begin: input_dffs_gen + DFF q_a_ff(.D(a[i]), .Q(q_a[i]), .CLK(iclk)); + DFF q_b_ff(.D(b[i]), .Q(q_b[i]), .CLK(iclk)); + end + DFF m_ff(.D(m), .Q(q_m), .CLK(iclk)); + + /* Combinational logic */ + (* pack="DFF-DSP" *) + wire [DATA_WIDTH-1:0] c_out; + DSP_COMBINATIONAL comb (.a(q_a), .b(q_b), .m(q_m), .out(c_out)); + + /* Output register on oclk */ + wire [DATA_WIDTH-1:0] q_out; + genvar j; + for (j=0; j<DATA_WIDTH; j=j+1) begin: output_dffs_gen + DFF q_out_ff(.D(c_out[j]), .Q(out[j]), .CLK(oclk)); + end + +endmodule
diff --git a/tests/dsp_inout_registered_dualclk/golden.model.xml b/tests/dsp_inout_registered_dualclk/golden.model.xml new file mode 100644 index 0000000..0073b45 --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/golden.model.xml
@@ -0,0 +1,4 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../fig42-dff/dff.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_inout_registered_dualclk/golden.pb_type.xml b/tests/dsp_inout_registered_dualclk/golden.pb_type.xml new file mode 100644 index 0000000..c5c69e0 --- /dev/null +++ b/tests/dsp_inout_registered_dualclk/golden.pb_type.xml
@@ -0,0 +1,195 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_INOUT_REGISTERED_DUALCLK"> + <clock name="iclk" num_pins="1"/> + <clock name="oclk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_a_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_b_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_a_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="input_dffs_gen_q_b_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="m_ff"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_2"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_3"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="input_dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="m_ff"/> + <port name="m" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="iclk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="iclk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="iclk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="iclk" type="input"/> + <port name="CLK" type="output" from="input_dffs_gen_q_b_ff_1"/> + </direct> + <direct> + <port name="iclk" type="input"/> + <port name="CLK" type="output" from="m_ff"/> + </direct> + <direct> + <port name="a[0]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="D" type="output" from="input_dffs_gen_q_b_ff_1"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="D" type="output" from="m_ff"/> + </direct> + <direct> + <port name="oclk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_0"/> + </direct> + <direct> + <port name="oclk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_1"/> + </direct> + <direct> + <port name="oclk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_2"/> + </direct> + <direct> + <port name="oclk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_3"/> + </direct> + <direct> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_0"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_1"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_2"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_3"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/dsp_modes/README.md b/tests/dsp_modes/README.md new file mode 100644 index 0000000..728a5c4 --- /dev/null +++ b/tests/dsp_modes/README.md
@@ -0,0 +1,17 @@ +## dsp\_modes tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use models from other DSP test. +Those tests should check the following features: + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files + +## Modes generation + + - [ ] all the modes from list defined with `MODES` attribute + - [ ] mode setting is included in pb\_type generation (correct part of logic is used) + - [ ] modes connections are generated correctly
diff --git a/tests/dsp_modes/dsp_modes.sim.v b/tests/dsp_modes/dsp_modes.sim.v new file mode 100644 index 0000000..cd7f69b --- /dev/null +++ b/tests/dsp_modes/dsp_modes.sim.v
@@ -0,0 +1,34 @@ +`include "../dsp_combinational/dsp_combinational.sim.v" +`include "../dsp_inout_registered/dsp_inout_registered.sim.v" +`include "../dsp_in_registered/dsp_in_registered.sim.v" +`include "../dsp_out_registered/dsp_out_registered.sim.v" +`include "../dsp_partial_registered/dsp_partial_registered.sim.v" + +/* DSP Block with register on both the inputs and the output */ +(* MODES="REGISTERED_NONE; REGISTERED_IN; REGISTERED_OUT; REGISTERED_INOUT; REGISTERED_PARTIAL" *) +module DSP_MODES (clk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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; + + /* Register modes */ + generate + if (MODE == "REGISTERED_NONE") begin + DSP_COMBINATIONAL dsp_int_comb (.a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_INOUT") begin + DSP_INOUT_REGISTERED dsp_int_regio (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_IN") begin + DSP_IN_REGISTERED dsp_int_regi (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_OUT") begin + DSP_OUT_REGISTERED dsp_int_rego (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end if (MODE == "REGISTERED_PARTIAL") begin + DSP_PARTIAL_REGISTERED dsp_int_part (.clk(clk), .a(a), .b(b), .m(m), .out(out)); + end + endgenerate +endmodule
diff --git a/tests/dsp_modes/golden.model.xml b/tests/dsp_modes/golden.model.xml new file mode 100644 index 0000000..e69422e --- /dev/null +++ b/tests/dsp_modes/golden.model.xml
@@ -0,0 +1,7 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_in_registered/dsp_in_registered.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_inout_registered/dsp_inout_registered.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_out_registered/dsp_out_registered.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../dsp_partial_registered/dsp_partial_registered.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_modes/golden.pb_type.xml b/tests/dsp_modes/golden.pb_type.xml new file mode 100644 index 0000000..46a0108 --- /dev/null +++ b/tests/dsp_modes/golden.pb_type.xml
@@ -0,0 +1,389 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_MODES"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <mode name="REGISTERED_NONE"> + <pb_type num_pb="1" name="REGISTERED_NONE"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="dsp_int_comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="dsp_int_comb"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="dsp_int_comb"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="dsp_int_comb"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="dsp_int_comb"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="dsp_int_comb"/> + </direct> + <direct> + <port name="out[0]" type="input" from="dsp_int_comb"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="dsp_int_comb"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="dsp_int_comb"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="dsp_int_comb"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port name="a" type="output" from="REGISTERED_NONE"/> + </direct> + <direct> + <port name="b" type="input"/> + <port name="b" type="output" from="REGISTERED_NONE"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="REGISTERED_NONE"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="REGISTERED_NONE"/> + </direct> + <direct> + <port name="out" type="input" from="REGISTERED_NONE"/> + <port name="out" type="output"/> + </direct> + </interconnect> + </mode> + <mode name="REGISTERED_IN"> + <pb_type num_pb="1" name="REGISTERED_IN"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="dsp_int_regi"> + <!--old_name DSP_IN_REGISTERED--> + <xi:include href="../dsp_in_registered/dsp_in_registered.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="dsp_int_regi"/> + </direct> + <direct> + <port name="out[0]" type="input" from="dsp_int_regi"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="dsp_int_regi"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="dsp_int_regi"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="dsp_int_regi"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port name="a" type="output" from="REGISTERED_IN"/> + </direct> + <direct> + <port name="b" type="input"/> + <port name="b" type="output" from="REGISTERED_IN"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="REGISTERED_IN"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="REGISTERED_IN"/> + </direct> + <direct> + <port name="out" type="input" from="REGISTERED_IN"/> + <port name="out" type="output"/> + </direct> + </interconnect> + </mode> + <mode name="REGISTERED_OUT"> + <pb_type num_pb="1" name="REGISTERED_OUT"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="dsp_int_rego"> + <!--old_name DSP_OUT_REGISTERED--> + <xi:include href="../dsp_out_registered/dsp_out_registered.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="dsp_int_rego"/> + </direct> + <direct> + <port name="out[0]" type="input" from="dsp_int_rego"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="dsp_int_rego"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="dsp_int_rego"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="dsp_int_rego"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port name="a" type="output" from="REGISTERED_OUT"/> + </direct> + <direct> + <port name="b" type="input"/> + <port name="b" type="output" from="REGISTERED_OUT"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="REGISTERED_OUT"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="REGISTERED_OUT"/> + </direct> + <direct> + <port name="out" type="input" from="REGISTERED_OUT"/> + <port name="out" type="output"/> + </direct> + </interconnect> + </mode> + <mode name="REGISTERED_INOUT"> + <pb_type num_pb="1" name="REGISTERED_INOUT"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="dsp_int_regio"> + <!--old_name DSP_INOUT_REGISTERED--> + <xi:include href="../dsp_inout_registered/dsp_inout_registered.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="dsp_int_regio"/> + </direct> + <direct> + <port name="out[0]" type="input" from="dsp_int_regio"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="dsp_int_regio"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="dsp_int_regio"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="dsp_int_regio"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port name="a" type="output" from="REGISTERED_INOUT"/> + </direct> + <direct> + <port name="b" type="input"/> + <port name="b" type="output" from="REGISTERED_INOUT"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="REGISTERED_INOUT"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="REGISTERED_INOUT"/> + </direct> + <direct> + <port name="out" type="input" from="REGISTERED_INOUT"/> + <port name="out" type="output"/> + </direct> + </interconnect> + </mode> + <mode name="REGISTERED_PARTIAL"> + <pb_type num_pb="1" name="REGISTERED_PARTIAL"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="dsp_int_part"> + <!--old_name DSP_PARTIAL_REGISTERED--> + <xi:include href="../dsp_partial_registered/dsp_partial_registered.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="dsp_int_part"/> + </direct> + <direct> + <port name="out[0]" type="input" from="dsp_int_part"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="dsp_int_part"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="dsp_int_part"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="dsp_int_part"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port name="a" type="output" from="REGISTERED_PARTIAL"/> + </direct> + <direct> + <port name="b" type="input"/> + <port name="b" type="output" from="REGISTERED_PARTIAL"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="clk" type="output" from="REGISTERED_PARTIAL"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="REGISTERED_PARTIAL"/> + </direct> + <direct> + <port name="out" type="input" from="REGISTERED_PARTIAL"/> + <port name="out" type="output"/> + </direct> + </interconnect> + </mode> +</pb_type>
diff --git a/tests/dsp_out_registered/README.md b/tests/dsp_out_registered/README.md new file mode 100644 index 0000000..59b24f7 --- /dev/null +++ b/tests/dsp_out_registered/README.md
@@ -0,0 +1,18 @@ +## dsp\_out\_registered tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model from fig42-dff and dps\_combinational tests. +Those tests should check the following features: + + +## Detection of combinational connections + + - [ ] output has combinational connection with input + - [ ] pack\_pattern defined on wire connections with `pack` attribute + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files +
diff --git a/tests/dsp_out_registered/dsp_out_registered.sim.v b/tests/dsp_out_registered/dsp_out_registered.sim.v new file mode 100644 index 0000000..6588797 --- /dev/null +++ b/tests/dsp_out_registered/dsp_out_registered.sim.v
@@ -0,0 +1,24 @@ +`include "../fig42-dff/dff.sim.v" +`include "../dsp_combinational/dsp_combinational.sim.v" + +/* DSP Block with register on the output */ +module DSP_OUT_REGISTERED (clk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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; + + /* Combinational logic */ + (* pack="DSP-DFF" *) + wire [DATA_WIDTH-1:0] c_out; + DSP_COMBINATIONAL comb (.a(a), .b(b), .m(m), .out(c_out)); + + /* Output register on clk */ + genvar j; + for (j=0; j<DATA_WIDTH; j=j+1) begin: output_dffs_gen + DFF q_out_ff(.D(c_out[j]), .Q(out[j]), .CLK(clk)); + end +endmodule
diff --git a/tests/dsp_out_registered/golden.model.xml b/tests/dsp_out_registered/golden.model.xml new file mode 100644 index 0000000..e9b223a --- /dev/null +++ b/tests/dsp_out_registered/golden.model.xml
@@ -0,0 +1,5 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <!-- https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#mixed-sequential-combinational-block --> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../fig42-dff/dff.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_out_registered/golden.pb_type.xml b/tests/dsp_out_registered/golden.pb_type.xml new file mode 100644 index 0000000..b52c2f6 --- /dev/null +++ b/tests/dsp_out_registered/golden.pb_type.xml
@@ -0,0 +1,114 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_OUT_REGISTERED"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_2"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="output_dffs_gen_q_out_ff_3"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a[0]" type="input"/> + <port name="a[0]" type="output" from="comb"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="a[1]" type="output" from="comb"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="b[0]" type="output" from="comb"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="b[1]" type="output" from="comb"/> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="comb"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_1"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_2"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="output_dffs_gen_q_out_ff_3"/> + </direct> + <direct> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + <pack_pattern name="DSP-DFF" type="pack"> + <port name="out[0]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_0"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_0"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + <pack_pattern name="DSP-DFF" type="pack"> + <port name="out[1]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_1"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_1"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + <pack_pattern name="DSP-DFF" type="pack"> + <port name="out[2]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_2"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_2"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + <pack_pattern name="DSP-DFF" type="pack"> + <port name="out[3]" type="input" from="comb"/> + <port name="D" type="output" from="output_dffs_gen_q_out_ff_3"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="output_dffs_gen_q_out_ff_3"/> + <port name="out[3]" type="output"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/dsp_partial_registered/README.md b/tests/dsp_partial_registered/README.md new file mode 100644 index 0000000..373bbf9 --- /dev/null +++ b/tests/dsp_partial_registered/README.md
@@ -0,0 +1,18 @@ +## dsp\_partial\_registered tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use model from fig42-dff and dps\_combinational tests. +Those tests should check the following features: + + +## Detection of combinational connections + + - [ ] output has combinational connection with input + - [ ] pack\_pattern defined on wire connections with `pack` attribute + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files +
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..3b51f68 --- /dev/null +++ b/tests/dsp_partial_registered/dsp_partial_registered.sim.v
@@ -0,0 +1,28 @@ +`include "../fig42-dff/dff.sim.v" +`include "../dsp_combinational/dsp_combinational.sim.v" + +/* DSP Block with register on only some inputs */ +module DSP_PARTIAL_REGISTERED (clk, a, b, m, out); + localparam DATA_WIDTH = 4; + + 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 */ + (* pack="DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_a; + (* pack="DFF-DSP" *) + wire [DATA_WIDTH/2-1:0] q_b; + + genvar i; + for (i=0; i<DATA_WIDTH/2; i=i+1) begin: dffs_gen + DFF q_a_ff(.D(a[i]), .Q(q_a[i]), .CLK(clk)); + DFF q_b_ff(.D(b[i]), .Q(q_b[i]), .CLK(clk)); + end + + /* Combinational Logic */ + DSP_COMBINATIONAL comb (.a(q_a), .b(q_b), .m(m), .out(out)); +endmodule
diff --git a/tests/dsp_partial_registered/golden.model.xml b/tests/dsp_partial_registered/golden.model.xml new file mode 100644 index 0000000..0073b45 --- /dev/null +++ b/tests/dsp_partial_registered/golden.model.xml
@@ -0,0 +1,4 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../dsp_combinational/dsp_combinational.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../fig42-dff/dff.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/dsp_partial_registered/golden.pb_type.xml b/tests/dsp_partial_registered/golden.pb_type.xml new file mode 100644 index 0000000..759393b --- /dev/null +++ b/tests/dsp_partial_registered/golden.pb_type.xml
@@ -0,0 +1,114 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="DSP_PARTIAL_REGISTERED"> + <clock name="clk" num_pins="1"/> + <input name="a" num_pins="2"/> + <input name="b" num_pins="2"/> + <input name="m" num_pins="1"/> + <output name="out" num_pins="4"/> + <pb_type num_pb="1" name="comb"> + <!--old_name DSP_COMBINATIONAL--> + <xi:include href="../dsp_combinational/dsp_combinational.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="dffs_gen_q_a_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="dffs_gen_q_b_ff_0"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="dffs_gen_q_a_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type num_pb="1" name="dffs_gen_q_b_ff_1"> + <!--old_name DFF--> + <xi:include href="../fig42-dff/dff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="Q" type="input" from="dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="dffs_gen_q_a_ff_0"/> + <port name="a[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="dffs_gen_q_a_ff_1"/> + <port name="a[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="dffs_gen_q_b_ff_0"/> + <port name="b[0]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="Q" type="input" from="dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + <pack_pattern name="DFF-DSP" type="pack"> + <port name="Q" type="input" from="dffs_gen_q_b_ff_1"/> + <port name="b[1]" type="output" from="comb"/> + </pack_pattern> + </direct> + <direct> + <port name="m" type="input"/> + <port name="m" type="output" from="comb"/> + </direct> + <direct> + <port name="out[0]" type="input" from="comb"/> + <port name="out[0]" type="output"/> + </direct> + <direct> + <port name="out[1]" type="input" from="comb"/> + <port name="out[1]" type="output"/> + </direct> + <direct> + <port name="out[2]" type="input" from="comb"/> + <port name="out[2]" type="output"/> + </direct> + <direct> + <port name="out[3]" type="input" from="comb"/> + <port name="out[3]" type="output"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="clk" type="input"/> + <port name="CLK" type="output" from="dffs_gen_q_b_ff_1"/> + </direct> + <direct> + <port name="a[0]" type="input"/> + <port name="D" type="output" from="dffs_gen_q_a_ff_0"/> + </direct> + <direct> + <port name="b[0]" type="input"/> + <port name="D" type="output" from="dffs_gen_q_b_ff_0"/> + </direct> + <direct> + <port name="a[1]" type="input"/> + <port name="D" type="output" from="dffs_gen_q_a_ff_1"/> + </direct> + <direct> + <port name="b[1]" type="input"/> + <port name="D" type="output" from="dffs_gen_q_b_ff_1"/> + </direct> + </interconnect> +</pb_type>
diff --git a/tests/fig28-lutff-pair/README.md b/tests/fig28-lutff-pair/README.md new file mode 100644 index 0000000..765f972 --- /dev/null +++ b/tests/fig28-lutff-pair/README.md
@@ -0,0 +1,15 @@ +## PAIR tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +The tests use models defined in ff, lut and omux tests. +Those tests should check the following features: + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files + +## Carry chain inference + + - [ ] pack\_pattern inference - pack\_patterns defined on wires with `pack` attributes should be propagated to pb\_type xmls
diff --git a/tests/fig28-lutff-pair/ff/ff.sim.v b/tests/fig28-lutff-pair/ff/ff.sim.v new file mode 100644 index 0000000..2490547 --- /dev/null +++ b/tests/fig28-lutff-pair/ff/ff.sim.v
@@ -0,0 +1,17 @@ +(* whitebox *) +module DFF (CLK, D, Q); + + input wire CLK; + + (* SETUP="CLK 10e-12" *) + (* HOLD="CLK 10e-12" *) + input wire D; + + (* CLK_TO_Q="CLK 10e-12" *) + output reg Q; + (* ASSOC_CLOCK="CLK" *) + + always @ ( posedge CLK ) begin + Q <= D; + end +endmodule
diff --git a/tests/fig28-lutff-pair/ff/golden.model.xml b/tests/fig28-lutff-pair/ff/golden.model.xml new file mode 100644 index 0000000..e9eb08e --- /dev/null +++ b/tests/fig28-lutff-pair/ff/golden.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="CLK" is_clock="1"/> + <port name="D" clock="CLK"/> + </input_ports> + <output_ports> + <port name="Q" clock="CLK"/> + </output_ports> + </model> +</models>
diff --git a/tests/fig28-lutff-pair/ff/golden.pb_type.xml b/tests/fig28-lutff-pair/ff/golden.pb_type.xml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/fig28-lutff-pair/ff/golden.pb_type.xml
diff --git a/tests/fig28-lutff-pair/golden.model.xml b/tests/fig28-lutff-pair/golden.model.xml new file mode 100644 index 0000000..59092ef --- /dev/null +++ b/tests/fig28-lutff-pair/golden.model.xml
@@ -0,0 +1,5 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="ff/ff.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="lut/lut4.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="omux/omux.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/fig28-lutff-pair/golden.pb_type.xml b/tests/fig28-lutff-pair/golden.pb_type.xml new file mode 100644 index 0000000..2d667bf --- /dev/null +++ b/tests/fig28-lutff-pair/golden.pb_type.xml
@@ -0,0 +1,59 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="PAIR" num_pb="1"> + <clock name="CLK" num_pins="1"/> + <input name="I" num_pins="4"/> + <output name="O" num_pins="1"/> + <pb_type name="ff" num_pb="1"> + <xi:include href="ff/ff.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type name="lut" num_pb="1"> + <xi:include href="lut/lut4.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="CLK" type="input"/> + <port from="ff" name="CLK" type="output"/> + </direct> + <direct> + <port from="lut" name="O" type="input"/> + <port from="ff" name="D" type="output"/> + <pack_pattern name="LUT2FF" type="pack"> + <port from="lut" name="O" type="input"/> + <port from="ff" name="D" type="output"/> + </pack_pattern> + </direct> + <direct> + <port name="I[0]" type="input"/> + <port from="lut" name="I[0]" type="output"/> + </direct> + <direct> + <port name="I[1]" type="input"/> + <port from="lut" name="I[1]" type="output"/> + </direct> + <direct> + <port name="I[2]" type="input"/> + <port from="lut" name="I[2]" type="output"/> + </direct> + <direct> + <port name="I[3]" type="input"/> + <port from="lut" name="I[3]" type="output"/> + </direct> + <mux name="mux"> + <port from="lut" name="O" type="input"> + <metadata> + <meta name="fasm_mux">L</meta> + </metadata> + </port> + <port from="ff" name="Q" type="input"> + <metadata> + <meta name="fasm_mux">F</meta> + </metadata> + </port> + <port name="O" type="output"/> + <metadata> + <meta name="type">bel</meta> + <meta name="subtype">routing</meta> + </metadata> + </mux> + </interconnect> +</pb_type>
diff --git a/tests/fig28-lutff-pair/lut/README.md b/tests/fig28-lutff-pair/lut/README.md new file mode 100644 index 0000000..fc2da7b --- /dev/null +++ b/tests/fig28-lutff-pair/lut/README.md
@@ -0,0 +1,18 @@ +## LUT tests + +This directory contains test for the `v2x_to_model.py` and `v2x_to_pb_type` tools. +Those tests should check the following features: + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] all dependency models and pb\_types are included in the output files + +## Carry chain inference + + - [ ] pack\_pattern inference - pack\_patterns defined on wires with `pack` attributes should be propagated to pb\_type xmls + +## Timings + + - [ ] timings defined for wires with `DELAY_MATRIX` attribute should be propagated to pb\_type xml
diff --git a/tests/fig28-lutff-pair/lut/golden.model.xml b/tests/fig28-lutff-pair/lut/golden.model.xml new file mode 100644 index 0000000..2059f55 --- /dev/null +++ b/tests/fig28-lutff-pair/lut/golden.model.xml
@@ -0,0 +1,10 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <model name="LUT4"> + <input_ports> + <port combinational_sink_ports="O" name="I"/> + </input_ports> + <output_ports> + <port name="O"/> + </output_ports> + </model> +</models>
diff --git a/tests/fig28-lutff-pair/lut/golden.pb_type.xml b/tests/fig28-lutff-pair/lut/golden.pb_type.xml new file mode 100644 index 0000000..6f07c69 --- /dev/null +++ b/tests/fig28-lutff-pair/lut/golden.pb_type.xml
@@ -0,0 +1,9 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="LUT4" num_pb="1"> + <blif_model>.subckt LUT4</blif_model> + <input name="I" num_pins="4"/> + <output name="O" num_pins="1"/> + <delay_matrix in_port="LUT4.I" out_port="LUT4.O" type="max"> +30e-12 20e-12 11e-12 3e-12 +</delay_matrix> +</pb_type>
diff --git a/tests/fig28-lutff-pair/lut/lut4.sim.v b/tests/fig28-lutff-pair/lut/lut4.sim.v new file mode 100644 index 0000000..caa640b --- /dev/null +++ b/tests/fig28-lutff-pair/lut/lut4.sim.v
@@ -0,0 +1,9 @@ +(* whitebox *) +module LUT4 (I, O); + input wire [3:0] I; + (* DELAY_MATRIX_I="30e-12 20e-12 11e-12 3e-12" *) + output wire O; + + localparam INIT = 16'h0000; + assign O = INIT[I]; +endmodule
diff --git a/tests/fig28-lutff-pair/pair.sim.v b/tests/fig28-lutff-pair/pair.sim.v new file mode 100644 index 0000000..750cf65 --- /dev/null +++ b/tests/fig28-lutff-pair/pair.sim.v
@@ -0,0 +1,26 @@ +`include "lut/lut4.sim.v" +`include "ff/ff.sim.v" +`include "omux/omux.sim.v" + +module PAIR ( + I, + CLK, + O +); + input wire [3:0] I; + input wire CLK; + + output wire O; + + (* pack="LUT2FF" *) + wire lut_out; + + LUT4 lut (.I(I), .O(lut_out)); + + wire ff_out; + DFF ff (.CLK(CLK), .D(lut_out), .Q(ff_out)); + + parameter FF_BYPASS = "F"; + OMUX #(.MODE(FF_BYPASS)) mux(.L(lut_out), .F(ff_out), .O(O)); + +endmodule
diff --git a/tests/fig41-full-adder/README.md b/tests/fig41-full-adder/README.md new file mode 100644 index 0000000..2af60b0 --- /dev/null +++ b/tests/fig41-full-adder/README.md
@@ -0,0 +1,17 @@ +## Adder tests + +This directory contains test for the blackbox detection for the +`v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Detection of combinational connections + + - [ ] output has combinational connection with input + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + +## Timings + + - [ ] all the timings defined for wires with attributes should be included in pb\_type xml
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..2088a77 --- /dev/null +++ b/tests/fig41-full-adder/adder.sim.v
@@ -0,0 +1,44 @@ +(* whitebox *) +module ADDER ( + a, b, cin, + sum, cout +); + input wire a; + input wire b; + (* carry = "ADDER" *) + input wire cin; + + (* DELAY_CONST_a = "300e-12" *) + (* DELAY_CONST_b = "300e-12" *) + (* DELAY_CONST_cin = "300e-12" *) + output wire sum; + + (* carry = "ADDER" *) + (* DELAY_CONST_a = "300e-12" *) + (* DELAY_CONST_b = "300e-12" *) + (* DELAY_CONST_cin = "10e-12" *) + 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/fig41-full-adder/golden.model.xml b/tests/fig41-full-adder/golden.model.xml new file mode 100644 index 0000000..1aa88d8 --- /dev/null +++ b/tests/fig41-full-adder/golden.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/golden.pb_type.xml b/tests/fig41-full-adder/golden.pb_type.xml new file mode 100644 index 0000000..d6b50e8 --- /dev/null +++ b/tests/fig41-full-adder/golden.pb_type.xml
@@ -0,0 +1,13 @@ +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" 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="a" out_port="cout"/> + <delay_constant max="300e-12" in_port="b" out_port="cout"/> + <delay_constant max="10e-12" in_port="cin" out_port="cout"/> + <delay_constant max="300e-12" in_port="a" out_port="sum"/> + <delay_constant max="300e-12" in_port="b" out_port="sum"/> + <delay_constant max="300e-12" in_port="cin" out_port="sum"/> +</pb_type>
diff --git a/tests/fig42-dff/README.md b/tests/fig42-dff/README.md new file mode 100644 index 0000000..d3e6290 --- /dev/null +++ b/tests/fig42-dff/README.md
@@ -0,0 +1,17 @@ +## DFF tests + +This directory contains tests for the `v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Clock associations inference + + - [ ] automatic inference is signal is associated with any clock and include the info in the model + - [ ] automatic clock detection (signals named `clk` are considered as clocks) + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + +## Timings + + - [ ] all the timings defined for wires with attributes should be included in pb\_type xml
diff --git a/tests/fig42-dff/dff.sim.v b/tests/fig42-dff/dff.sim.v new file mode 100644 index 0000000..3927929 --- /dev/null +++ b/tests/fig42-dff/dff.sim.v
@@ -0,0 +1,49 @@ +(* whitebox *) +module DFF (D, CLK, Q); + + input wire CLK; + + (* SETUP="CLK 10e-12" *) + (* HOLD="CLK 10e-12" *) + input wire D; + + (* CLK_TO_Q="CLK 10e-12" *) + output reg Q; + + always @ ( posedge CLK ) begin + Q <= D; + end + +`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/fig42-dff/golden.model.xml b/tests/fig42-dff/golden.model.xml new file mode 100644 index 0000000..e9eb08e --- /dev/null +++ b/tests/fig42-dff/golden.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="CLK" is_clock="1"/> + <port name="D" clock="CLK"/> + </input_ports> + <output_ports> + <port name="Q" clock="CLK"/> + </output_ports> + </model> +</models>
diff --git a/tests/logicbox/README.md b/tests/logicbox/README.md new file mode 100644 index 0000000..fb085d6 --- /dev/null +++ b/tests/logicbox/README.md
@@ -0,0 +1,16 @@ +## DFF tests + +This directory contains tests for the `v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Combinational connection inference + + - [ ] automatic inference of combinational connection between input and output signals + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + +## Timings + + - [ ] all the timings defined for wires with attributes should be included in pb\_type xml
diff --git a/tests/logicbox/golden.model.xml b/tests/logicbox/golden.model.xml new file mode 100644 index 0000000..0bf72c1 --- /dev/null +++ b/tests/logicbox/golden.model.xml
@@ -0,0 +1,10 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <model name="LOGICBOX"> + <input_ports> + <port combinational_sink_ports="O" name="I"/> + </input_ports> + <output_ports> + <port name="O"/> + </output_ports> + </model> +</models>
diff --git a/tests/logicbox/golden.pb_type.xml b/tests/logicbox/golden.pb_type.xml new file mode 100644 index 0000000..e6ec22f --- /dev/null +++ b/tests/logicbox/golden.pb_type.xml
@@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="LOGICBOX" num_pb="1"> + <blif_model>.subckt LOGICBOX</blif_model> + <input name="I" num_pins="1"/> + <output name="O" num_pins="1"/> + <delay_constant in_port="LOGICBOX.I" max="30e-12" out_port="LOGICBOX.O"/> +</pb_type>
diff --git a/tests/logicbox/logicbox.sim.v b/tests/logicbox/logicbox.sim.v new file mode 100644 index 0000000..6ac2b93 --- /dev/null +++ b/tests/logicbox/logicbox.sim.v
@@ -0,0 +1,12 @@ +(* whitebox *) +module LOGICBOX (I, O); + input wire I; + + // we need this delay to make VPR see + // the connection between I and O + (* DELAY_CONST_I="30e-12" *) + output wire O; + + assign O=I; + +endmodule
diff --git a/tests/multiple_instance/README.md b/tests/multiple_instance/README.md new file mode 100644 index 0000000..40e9777 --- /dev/null +++ b/tests/multiple_instance/README.md
@@ -0,0 +1,13 @@ +## Multiple instance tests + +This directory contains tests for the `v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] automatic inclusion of sub modules in model and pb\_type files + +## Pack pattern inference + + - [ ] automatic pack pattern inference for all the direct internal module connections
diff --git a/tests/multiple_instance/golden.model.xml b/tests/multiple_instance/golden.model.xml new file mode 100644 index 0000000..29655ed --- /dev/null +++ b/tests/multiple_instance/golden.model.xml
@@ -0,0 +1,3 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../fig41-full-adder/adder.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/multiple_instance/golden.pb_type.xml b/tests/multiple_instance/golden.pb_type.xml new file mode 100644 index 0000000..6dea215 --- /dev/null +++ b/tests/multiple_instance/golden.pb_type.xml
@@ -0,0 +1,194 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="MULTIPLE_INSTANCE" num_pb="1"> + <input name="a" num_pins="4"/> + <input name="b" num_pins="4"/> + <input name="c" num_pins="4"/> + <!-- FIXME: cin/cout should be marked as carry --> + <input name="cin" num_pins="4"/> + <output name="cout" num_pins="4"/> + <input name="d" num_pins="4"/> + <output name="sum" num_pins="8"/> + <pb_type name="comb_apb" num_pb="4"> + <xi:include href="../fig41-full-adder/adder.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type name="comb_cpd" num_pb="4"> + <xi:include href="../fig41-full-adder/adder.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + + <!-- 1st - a+b -> sum --> + <direct> + <port name="a[0]" type="input" /> + <port from="comb_apb[0]" name="a" type="output" /> + </direct> + <direct> + <port name="b[0]" type="input" /> + <port from="comb_apb[0]" name="b" type="output" /> + </direct> + <direct> + <port from="comb_apb[0]" name="sum" type="input" /> + <port name="sum[0]" type="output" /> + </direct> + + <!-- 2nd - a+b -> sum --> + <direct> + <port name="a[1]" type="input" /> + <port from="comb_apb[1]" name="a" type="output" /> + </direct> + <direct> + <port name="b[1]" type="input" /> + <port from="comb_apb[1]" name="b" type="output" /> + </direct> + <direct> + <port from="comb_apb[1]" name="sum" type="input" /> + <port name="sum[1]" type="output" /> + </direct> + + <!-- 3rd - a+b -> sum --> + <direct> + <port name="a[2]" type="input"/> + <port from="comb_apb[2]" name="a" type="output"/> + </direct> + <direct> + <port name="b[2]" type="input"/> + <port from="comb_apb[2]" name="b" type="output"/> + </direct> + <direct> + <port from="comb_apb[2]" name="sum" type="input"/> + <port name="sum[2]" type="output"/> + </direct> + + <!-- 4th - a+b -> sum --> + <direct> + <port name="a[3]" type="input" /> + <port from="comb_apb[3]" name="a" type="output" /> + </direct> + <direct> + <port name="b[3]" type="input" /> + <port from="comb_apb[3]" name="b" type="output" /> + </direct> + <direct> + <port from="comb_apb[3]" name="sum" type="input" /> + <port name="sum[3]" type="output" /> + </direct> + + <!-- 1st - c+d -> sum --> + <direct> + <port name="c[0]" type="input"/> + <port from="comb_cpd[0]" name="a" type="output"/> + </direct> + <direct> + <port name="d[0]" type="input"/> + <port from="comb_cpd[0]" name="b" type="output"/> + </direct> + <direct> + <port from="comb_cpd[0]" name="sum" type="input"/> + <port name="sum[4]" type="output"/> + </direct> + + <!-- 2nd - c+d -> sum --> + <direct> + <port name="c[1]" type="input"/> + <port from="comb_cpd[1]" name="a" type="output"/> + </direct> + <direct> + <port name="d[1]" type="input"/> + <port from="comb_cpd[1]" name="b" type="output"/> + </direct> + <direct> + <port from="comb_cpd[1]" name="sum" type="input"/> + <port name="sum[5]" type="output"/> + </direct> + + <!-- 3rd - c+d -> sum --> + <direct> + <port name="c[2]" type="input"/> + <port from="comb_cpd[2]" name="a" type="output"/> + </direct> + <direct> + <port name="d[2]" type="input"/> + <port from="comb_cpd[2]" name="b" type="output"/> + </direct> + <direct> + <port from="comb_cpd[2]" name="sum" type="input"/> + <port name="sum[6]" type="output"/> + </direct> + + <!-- 4th - c+d -> sum --> + <direct> + <port name="c[3]" type="input"/> + <port from="comb_cpd[3]" name="a" type="output"/> + </direct> + <direct> + <port name="d[3]" type="input"/> + <port from="comb_cpd[3]" name="b" type="output"/> + </direct> + <direct> + <port from="comb_cpd[3]" name="sum" type="input"/> + <port name="sum[7]" type="output"/> + </direct> + + <!-- Carry chains --> + + <!-- cin -> 1st a+b -> 1st c+d -> cout --> + <direct> + <port name="cin[0]" type="input" /> + <port from="comb_apb[0]" name="cin" type="output" /> + </direct> + <direct> + <port from="comb_apb[0]" name="cout" type="input" /> + <port from="comb_cpd[0]" name="cin" type="output" /> + <pack_pattern name="carry-ADDER" /> + </direct> + <direct> + <port from="comb_cpd[0]" name="cout" type="input" /> + <port name="cout[0]" type="output" /> + </direct> + + <!-- cin -> 2nd a+b -> 2nd c+d -> cout --> + <direct> + <port name="cin[1]" type="input" /> + <port from="comb_apb[1]" name="cin" type="output" /> + </direct> + <direct> + <port from="comb_apb[1]" name="cout" type="input" /> + <port from="comb_cpd[1]" name="cin" type="output" /> + <pack_pattern name="carry-ADDER" /> + </direct> + <direct> + <port from="comb_cpd[1]" name="cout" type="input" /> + <port name="cout[1]" type="output" /> + </direct> + + <!-- cin -> 3rd a+b -> 3rd c+d -> cout --> + <direct> + <port name="cin[2]" type="input" /> + <port from="comb_apb[2]" name="cin" type="output" /> + </direct> + <direct> + <port from="comb_apb[2]" name="cout" type="input" /> + <port from="comb_cpd[2]" name="cin" type="output" /> + <pack_pattern name="carry-ADDER" /> + </direct> + <direct> + <port from="comb_cpd[2]" name="cout" type="input" /> + <port name="cout[2]" type="output" /> + </direct> + + <!-- cin -> 4th a+b -> 4th c+d -> cout --> + <direct> + <port name="cin[3]" type="input" /> + <port from="comb_apb[3]" name="cin" type="output" /> + </direct> + <direct> + <port from="comb_apb[3]" name="cout" type="input" /> + <port from="comb_cpd[3]" name="cin" type="output" /> + <pack_pattern name="carry-ADDER" /> + </direct> + <direct> + <port from="comb_cpd[3]" name="cout" type="input" /> + <port name="cout[3]" type="output" /> + </direct> + + </interconnect> +</pb_type>
diff --git a/tests/multiple_instance/multiple_instance.sim.v b/tests/multiple_instance/multiple_instance.sim.v new file mode 100644 index 0000000..cf31a68 --- /dev/null +++ b/tests/multiple_instance/multiple_instance.sim.v
@@ -0,0 +1,32 @@ +`include "../fig41-full-adder/adder.sim.v" +module MULTIPLE_INSTANCE (a, b, c, d, cin, cout, sum); + localparam DATA_WIDTH = 4; + + input wire [DATA_WIDTH-1:0] a; + input wire [DATA_WIDTH-1:0] b; + input wire [DATA_WIDTH-1:0] c; + input wire [DATA_WIDTH-1:0] d; + output wire [DATA_WIDTH*2-1:0] sum; + + input wire [DATA_WIDTH-1:0] cin; + output wire [DATA_WIDTH-1:0] cout; + + wire [DATA_WIDTH-1:0] a2b; + + genvar i; + /* n = 0..DATA_WIDTH + * + * cin[n] + * ↓ + * a[n] + b[n] → sum[n] + * ↓ + * c[n] + d[n] → sum[4+n] + * ↓ + * cout[n] + */ + for(i=0; i<DATA_WIDTH; i=i+1) begin + ADDER comb_apb (.a(a[i]), .b(b[i]), .cin(cin[i]), .cout(a2b[i]), .sum(sum[i])); + ADDER comb_cpd (.a(c[i]), .b(d[i]), .cin(a2b[i]), .cout(cout[i]), .sum(sum[DATA_WIDTH+i])); + end + +endmodule
diff --git a/tests/muxes/README.md b/tests/muxes/README.md new file mode 100644 index 0000000..ad84528 --- /dev/null +++ b/tests/muxes/README.md
@@ -0,0 +1,13 @@ +## Routing muxes tests + +This directory contains tests for the `v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated + - [ ] automatic inclusion of sub modules in model and pb\_type files + +## Routing muxes inference + + - [ ] routing muxes should not generate model files and pb\_types but rather routing elements
diff --git a/tests/muxes/golden.model.xml b/tests/muxes/golden.model.xml new file mode 100644 index 0000000..cfc9bc9 --- /dev/null +++ b/tests/muxes/golden.model.xml
@@ -0,0 +1,4 @@ +<models xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="routing/rmux.model.xml" xpointer="xpointer(models/child::node())"/> + <xi:include href="../logicbox/logicbox.model.xml" xpointer="xpointer(models/child::node())"/> +</models>
diff --git a/tests/muxes/golden.pb_type.xml b/tests/muxes/golden.pb_type.xml new file mode 100644 index 0000000..aecccfb --- /dev/null +++ b/tests/muxes/golden.pb_type.xml
@@ -0,0 +1,65 @@ +<?xml version='1.0' encoding='utf-8'?> +<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" name="USE_MUX" num_pb="1"> + <input name="a" num_pins="1"/> + <input name="b" num_pins="1"/> + <input name="c" num_pins="1"/> + <output name="o1" num_pins="1"/> + <output name="o2" num_pins="1"/> + <pb_type name="lboxa" num_pb="1"> + <xi:include href="../logicbox/logicbox.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type name="lboxb" num_pb="1"> + <xi:include href="../logicbox/logicbox.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <pb_type name="lboxc" num_pb="1"> + <xi:include href="../logicbox/logicbox.pb_type.xml" xpointer="xpointer(pb_type/child::node())"/> + </pb_type> + <interconnect> + <direct> + <port name="a" type="input"/> + <port from="lboxa" name="I" type="output"/> + </direct> + <direct> + <port name="b" type="input"/> + <port from="lboxb" name="I" type="output"/> + </direct> + <direct> + <port name="c" type="input"/> + <port from="lboxc" name="I" type="output"/> + </direct> + <mux name="mux1"> + <port from="lboxa" name="O" type="input"> + <metadata> + <meta name="fasm_mux">I0</meta> + </metadata> + </port> + <port from="lboxb" name="O" type="input"> + <metadata> + <meta name="fasm_mux">I1</meta> + </metadata> + </port> + <port name="o1" type="output"/> + <metadata> + <meta name="type">bel</meta> + <meta name="subtype">routing</meta> + </metadata> + </mux> + <mux name="mux2"> + <port from="lboxa" name="O" type="input"> + <metadata> + <meta name="fasm_mux">I0</meta> + </metadata> + </port> + <port from="lboxc" name="O" type="input"> + <metadata> + <meta name="fasm_mux">I1</meta> + </metadata> + </port> + <port name="o2" type="output"/> + <metadata> + <meta name="type">bel</meta> + <meta name="subtype">routing</meta> + </metadata> + </mux> + </interconnect> +</pb_type>
diff --git a/tests/muxes/use_mux.sim.v b/tests/muxes/use_mux.sim.v new file mode 100644 index 0000000..9ba59b0 --- /dev/null +++ b/tests/muxes/use_mux.sim.v
@@ -0,0 +1,22 @@ +`include "routing/rmux.sim.v" +`include "../logicbox/logicbox.sim.v" +module USE_MUX (a, b, c, o1, o2); + input wire a; + input wire b; + input wire c; + output wire o1; + output wire o2; + + wire logic_a; + wire logic_b; + wire logic_c; + LOGICBOX lboxa (.I(a), .O(logic_a)); + LOGICBOX lboxb (.I(b), .O(logic_b)); + LOGICBOX lboxc (.I(c), .O(logic_c)); + + parameter FASM_MUX1 = "I0"; + RMUX #(.MODE(FASM_MUX1)) mux1 (.I0(logic_a), .I1(logic_b), .O(o1)); + + parameter FASM_MUX2 = "I0"; + RMUX #(.MODE(FASM_MUX2)) mux2 (.I0(logic_a), .I1(logic_c), .O(o2)); +endmodule
diff --git a/tests/simple_pll/README.md b/tests/simple_pll/README.md new file mode 100644 index 0000000..3459bfa --- /dev/null +++ b/tests/simple_pll/README.md
@@ -0,0 +1,15 @@ +## PLL tests + +This directory contains tests for the `v2x_to_model.py` and `v2x_to_pb_type` tools. + +## Clock associations inference + + - [ ] automatic inference is signal is associated with any clock and include the info in the model + - [ ] automatic clock detection (signals named `*clk*` are considered as clocks) + - [ ] signals marked with `CLOCK` attributes should be considered as clocks + +## Blackbox detection + + - [ ] model of the leaf pb\_type is generated + - [ ] leaf pb\_type xml is generated +
diff --git a/tests/simple_pll/golden.model.xml b/tests/simple_pll/golden.model.xml new file mode 100644 index 0000000..3bd53f5 --- /dev/null +++ b/tests/simple_pll/golden.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..68ae816 --- /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