Merge pull request #74 from antmicro/no_seq
Support for clock buffer/mux modeling
diff --git a/tests/clock_mux/README.rst b/tests/clock_mux/README.rst
new file mode 100644
index 0000000..97d2674
--- /dev/null
+++ b/tests/clock_mux/README.rst
@@ -0,0 +1,30 @@
+Clock multiplexing primitive
+++++++++++++++++++++++++++++
+
+This is an example of modeling a clock mux/buffer which utilizes both clock inputs and clock outputs.
+
+By default, clocks are excluded from the combinational sink list. IE They do not have `combinational_sink_ports` property associated with them. However, clock multiplexers violate this rule as their input clocks do not drive any sequential logic. They are passed to output(s) instead. VPR requires `Clock buffers & muxes <https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#clock-muxes>`_ to be defined in this way.
+
+
+V2X provides the attribute `(* COMB_INCLUDE_CLOCKS *)` that when specified on an output port makes appear on the `combinational_sink_ports` list of its related input port(s) even if it is marked as a clock input.
+
+.. symbolator:: gmux.sim.v
+
+.. verilog-diagram:: gmux.sim.v
+ :type: netlistsvg
+ :module: GMUX
+
+.. no-license:: gmux.sim.v
+ :language: verilog
+ :caption: tests/clock_mux/gmux.sim.v
+
+In this example the `(* COMB_INCLUDE_CLOCKS *)` attribute is set on the `IZ` output making it appear in combinational sinks lists of its associated clock input ports.
+
+.. literalinclude:: gmux.model.xml
+ :language: xml
+ :caption: gmux.model.xml
+
+.. literalinclude:: gmux.pb_type.xml
+ :language: xml
+ :caption: gmux.pb_type.xml
+
diff --git a/tests/clock_mux/gmux.sim.v b/tests/clock_mux/gmux.sim.v
new file mode 100644
index 0000000..c2490d7
--- /dev/null
+++ b/tests/clock_mux/gmux.sim.v
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 The SymbiFlow Authors.
+ *
+ * Use of this source code is governed by a ISC-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/ISC
+ *
+ * SPDX-License-Identifier: ISC
+ */
+
+// A model of a clock multiplexer with two clock inputs, one clock output and
+// a select input.
+
+(* whitebox *)
+module GMUX (IP, IC, IS0, IZ);
+
+ // 1st clock input
+ (* CLOCK *)
+ input wire IP;
+
+ // 2nd clock input
+ (* CLOCK *)
+ input wire IC;
+
+ // Select input
+ input wire IS0;
+
+ // Clock output (has to be defined as a regular output port)
+ (* DELAY_CONST_IP="1e-10" *)
+ (* DELAY_CONST_IC="2e-10" *)
+ (* DELAY_CONST_IS0="3e-10" *)
+ (* COMB_INCLUDE_CLOCKS *)
+ output wire IZ;
+
+ // Behavioral model:
+ assign IZ = IS0 ? IC : IP;
+
+endmodule
diff --git a/tests/clock_mux/golden.model.xml b/tests/clock_mux/golden.model.xml
new file mode 100644
index 0000000..dc594be
--- /dev/null
+++ b/tests/clock_mux/golden.model.xml
@@ -0,0 +1,12 @@
+<models xmlns:xi="http://www.w3.org/2001/XInclude">
+ <model name="GMUX">
+ <input_ports>
+ <port combinational_sink_ports="IZ" is_clock="1" name="IC"/>
+ <port combinational_sink_ports="IZ" is_clock="1" name="IP"/>
+ <port combinational_sink_ports="IZ" name="IS0"/>
+ </input_ports>
+ <output_ports>
+ <port name="IZ"/>
+ </output_ports>
+ </model>
+</models>
diff --git a/tests/clock_mux/golden.pb_type.xml b/tests/clock_mux/golden.pb_type.xml
new file mode 100644
index 0000000..294d0f4
--- /dev/null
+++ b/tests/clock_mux/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" name="GMUX" num_pb="1">
+ <blif_model>.subckt GMUX</blif_model>
+ <clock name="IC" num_pins="1"/>
+ <clock name="IP" num_pins="1"/>
+ <input name="IS0" num_pins="1"/>
+ <output name="IZ" num_pins="1"/>
+ <delay_constant in_port="IC" max="2e-10" out_port="IZ"/>
+ <delay_constant in_port="IP" max="1e-10" out_port="IZ"/>
+ <delay_constant in_port="IS0" max="3e-10" out_port="IZ"/>
+</pb_type>
diff --git a/tests/no_seq/README.rst b/tests/no_seq/README.rst
new file mode 100644
index 0000000..5866fc2
--- /dev/null
+++ b/tests/no_seq/README.rst
@@ -0,0 +1,20 @@
+Forced non-sequential relations to an input
++++++++++++++++++++++++++++++++++++++++++++
+
+This is a case when a macro block consisting of a LUT and an FF is to be modeled in VPR as a single primitive. The block has two outputs: the first one sources at the LUT directly and the second one passes through an external register:
+
+.. image:: lut_ff_macro.svg
+
+.. no-license:: lut_ff_macro.sim.v
+ :language: verilog
+ :caption: tests/no_seq/lut_ff_macro.sim.v
+
+Since relation of LUT inputs is combinational for one output and sequential for another they have to be defined in a special way as required by VPR (see `VTR documentation <https://docs.verilogtorouting.org/en/latest/tutorials/arch/timing_modeling/#sequential-block-with-internal-paths-and-combinational-input>`_). Due to the presence of the output register all sequential annotations are moved to the output port. Hence LUT inputs must not mention any clock signal. This can be achieved in V2X by specifying the `(* NO_SEQ *)` attribute on them. The attribute prevents V2X from annotating input ports with any clock relations.
+
+.. literalinclude:: lut_ff_macro.model.xml
+ :language: xml
+ :caption: lut_ff_macro.model.xml
+
+.. literalinclude:: lut_ff_macro.pb_type.xml
+ :language: xml
+ :caption: lut_ff_macro.pb_type.xml
diff --git a/tests/no_seq/golden.model.xml b/tests/no_seq/golden.model.xml
new file mode 100644
index 0000000..5a8e594
--- /dev/null
+++ b/tests/no_seq/golden.model.xml
@@ -0,0 +1,15 @@
+<models xmlns:xi="http://www.w3.org/2001/XInclude">
+ <model name="LUT_FF_MACRO">
+ <input_ports>
+ <port name="CLK" is_clock="1"/>
+ <port name="I0" combinational_sink_ports="QZ Z"/>
+ <port name="I1" combinational_sink_ports="QZ Z"/>
+ <port name="I2" combinational_sink_ports="QZ Z"/>
+ <port name="I3" combinational_sink_ports="QZ Z"/>
+ </input_ports>
+ <output_ports>
+ <port name="QZ" clock="CLK"/>
+ <port name="Z"/>
+ </output_ports>
+ </model>
+</models>
diff --git a/tests/no_seq/golden.pb_type.xml b/tests/no_seq/golden.pb_type.xml
new file mode 100644
index 0000000..a21a18d
--- /dev/null
+++ b/tests/no_seq/golden.pb_type.xml
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='utf-8'?>
+<pb_type xmlns:xi="http://www.w3.org/2001/XInclude" num_pb="1" name="LUT_FF_MACRO">
+ <blif_model>.subckt LUT_FF_MACRO</blif_model>
+ <clock name="CLK" num_pins="1"/>
+ <input name="I0" num_pins="1"/>
+ <input name="I1" num_pins="1"/>
+ <input name="I2" num_pins="1"/>
+ <input name="I3" num_pins="1"/>
+ <output name="QZ" num_pins="1"/>
+ <output name="Z" num_pins="1"/>
+ <T_setup port="QZ" clock="CLK" value="1e-10"/>
+ <T_hold port="QZ" clock="CLK" value="1e-10"/>
+ <T_clock_to_Q port="QZ" clock="CLK" max="1e-10"/>
+ <delay_constant in_port="I0" out_port="QZ" max="2e-10"/>
+ <delay_constant in_port="I1" out_port="QZ" max="2e-10"/>
+ <delay_constant in_port="I2" out_port="QZ" max="2e-10"/>
+ <delay_constant in_port="I3" out_port="QZ" max="2e-10"/>
+ <delay_constant in_port="I0" out_port="Z" max="1e-10"/>
+ <delay_constant in_port="I1" out_port="Z" max="1e-10"/>
+ <delay_constant in_port="I2" out_port="Z" max="1e-10"/>
+ <delay_constant in_port="I3" out_port="Z" max="1e-10"/>
+</pb_type>
diff --git a/tests/no_seq/lut_ff_macro.sim.v b/tests/no_seq/lut_ff_macro.sim.v
new file mode 100644
index 0000000..fad14e5
--- /dev/null
+++ b/tests/no_seq/lut_ff_macro.sim.v
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 The SymbiFlow Authors.
+ *
+ * Use of this source code is governed by a ISC-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/ISC
+ *
+ * SPDX-License-Identifier: ISC
+ */
+
+(* whitebox *)
+module LUT_FF_MACRO (I0, I1, I2, I3, CLK, Z, QZ);
+
+ // LUT inputs
+ (* NO_SEQ *)
+ input wire I0;
+ (* NO_SEQ *)
+ input wire I1;
+ (* NO_SEQ *)
+ input wire I2;
+ (* NO_SEQ *)
+ input wire I3;
+
+ // Clock input
+ input wire CLK;
+
+ // Combinational LUT output
+ (* DELAY_CONST_I0="1e-10" *)
+ (* DELAY_CONST_I1="1e-10" *)
+ (* DELAY_CONST_I2="1e-10" *)
+ (* DELAY_CONST_I3="1e-10" *)
+ output wire Z;
+
+ // Registered LUT output
+ (* DELAY_CONST_I0="2e-10" *)
+ (* DELAY_CONST_I1="2e-10" *)
+ (* DELAY_CONST_I2="2e-10" *)
+ (* DELAY_CONST_I3="2e-10" *)
+ (* CLK_TO_Q="CLK 1e-10" *)
+ (* SETUP="CLK 1e-10" *)
+ (* HOLD="CLK 1e-10" *)
+ output reg QZ;
+
+ // LUT behavioral model
+ parameter [15:0] INIT = 16'd0;
+ assign Z = INIT[{I3, I2, I1, I0}];
+
+ // FF behavioral model
+ always @(posedge CLK)
+ QZ <= Z;
+
+endmodule
diff --git a/tests/no_seq/lut_ff_macro.svg b/tests/no_seq/lut_ff_macro.svg
new file mode 100644
index 0000000..e4316ee
--- /dev/null
+++ b/tests/no_seq/lut_ff_macro.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="271px" height="122px" viewBox="-0.5 -0.5 271 122" content="<mxfile host="app.diagrams.net" modified="2020-10-01T09:41:41.985Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36" version="13.7.6" etag="jLduNTopLj12nWGYQOos" type="google"><diagram id="Z8rUi5H3Rt-A41YAtYq2">7Zpdk5owFIZ/Dbc7AqJ4uepu26mdabvtdLd3GYiQNhInxBX66xskfITgKhrdL71wyCE5kPO8OYSjhj1ZJB8oWIZfiA+xYfX8xLCnhmXZgz7/zgxpbui7dm4IKPJzk1kZ7tA/KIw9YV0hH8ZSR0YIZmgpGz0SRdBjkg1QStZytznB8lWXIICK4c4DWLX+Qj4Lc6trDSv7R4iCsLiyORjlZxag6CxmEofAJ+uayb4x7AklhOVHi2QCcRa7Ii75uNstZ8sbozBi+wyw8gGPAK/E3MR9sbSYLCWryIdZ/55hj9chYvBuCbzs7JrT5baQLTBvmfxwjjCeEEwob0ck4p3GMaPkbxknPsOxuCakDCZb79sso8FVBMkCMpryLmLAQMRPCKgI57qiYfWELayTKDoCoYCg9FwFiR+IOLXHzFZCBH0uD9EklIUkIBHAN5V1LAex6jMjZClC9wcylgqtgxUjcmDza2YX6hoxCjFg6FEe1zZ/MfQrQdxjGelmqO1GBBmgAWRiUF1pDT+m+7SfmKyoBxU/GxjlbPbi01c0Pfv54zhZn0TDjYD0VQ27LRJ2NSjYeQ4FwwSx+9rxQ+bqyhGtaSI8bxqpaGxRfa4VkQmeayE0QWxZCAcIeKAI+Pb2Beq3zLCpnJNrAu63CLivQcDD3Y8tGPnX2aO+ehBpyaa1yTktkytsR2qtmSybWtuSLDsnXX2adY8kckh24Kxoel9v1EZlzWrYptUhq4hnSB6fronmTBoZymyVvc2+Iil3T8LR8GQiGXUSiYdBHCPvda1cR47l6EAm7tNu9CEpXqneEZOmvg9kcrplYprvjomjh0nTjUYme7wpvzEmpqkHiuJHIxW7E5XXtxFsItnzrXnnM15xpJGJ+v7deaVUO7tqM/dQP9dtZ/eSt3E7yby8bZzpvPFVt6vmtTeS4dN+NCJRawZvG8lwdDUc1T6OHkI73GoEppYwfivEGExYWyGnUWFvKboDjIKINzGcZx6yOg/yAL4W5gXy/U1Vr61uJFeWYn4SRYHcmm3cTrPcPCcREzU/s0rBxxWWGlBaq/uq0nTU9k21jvHtwmXbYjkjF7V08Mlwxj3DmZ6ADs1v/lR4ei14RI/vImyOrhKtBKzlJwb7RMAKHw1g5gVYF2AtJfWTAVOLDhkw6wKsCzD3jMDUikQGzL4A6wLM7J2RmFqtmMw+X2DtD6tlJ6gJFm9W/7rJ9/PVX5fsm/8=</diagram></mxfile>"><defs/><g><rect x="40" y="1" width="200" height="120" fill="none" stroke="#000000" stroke-width="2" pointer-events="all"/><path d="M 160 11 L 233.63 11" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 238.88 11 L 231.88 14.5 L 233.63 11 L 231.88 7.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><rect x="60" y="21" width="80" height="80" fill="#ffffff" stroke="#000000" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 78px; height: 1px; padding-top: 61px; margin-left: 61px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; "><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">LUT</div></div></div></foreignObject><text x="100" y="65" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">LUT</text></switch></g><path d="M 220 61 L 233.63 61" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 238.88 61 L 231.88 64.5 L 233.63 61 L 231.88 57.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><rect x="180" y="41" width="40" height="40" fill="#ffffff" stroke="#000000" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 38px; height: 1px; padding-top: 61px; margin-left: 181px;"><div style="box-sizing: border-box; font-size: 0; text-align: center; "><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">FF</div></div></div></foreignObject><text x="200" y="65" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">FF</text></switch></g><path d="M 160 61 L 160 11" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 140 61 L 180 61" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 30 71 L 53.63 71" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 58.88 71 L 51.88 74.5 L 53.63 71 L 51.88 67.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 30 51 L 53.63 51" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 58.88 51 L 51.88 54.5 L 53.63 51 L 51.88 47.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 30 31 L 53.63 31" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 58.88 31 L 51.88 34.5 L 53.63 31 L 51.88 27.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 30 91 L 53.63 91" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 58.88 91 L 51.88 94.5 L 53.63 91 L 51.88 87.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 30 111 L 200 111" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 200 111 L 200 87.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 200 82.12 L 203.5 89.12 L 200 87.37 L 196.5 89.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/><path d="M 240 11 L 250 11" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 240 60.8 L 250 60.8" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/><rect x="250" y="1" width="20" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 17px; height: 1px; padding-top: 11px; margin-left: 255px;"><div style="box-sizing: border-box; font-size: 0; text-align: left; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">Z</div></div></div></foreignObject><text x="255" y="14" fill="#000000" font-family="Helvetica" font-size="10px">Z</text></switch></g><rect x="250" y="51" width="20" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 17px; height: 1px; padding-top: 61px; margin-left: 255px;"><div style="box-sizing: border-box; font-size: 0; text-align: left; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">QZ</div></div></div></foreignObject><text x="255" y="64" fill="#000000" font-family="Helvetica" font-size="10px">QZ</text></switch></g><rect x="0" y="21" width="30" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-end; width: 27px; height: 1px; padding-top: 31px; margin-left: -2px;"><div style="box-sizing: border-box; font-size: 0; text-align: right; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">I[0]</div></div></div></foreignObject><text x="25" y="34" fill="#000000" font-family="Helvetica" font-size="10px" text-anchor="end">I[0]</text></switch></g><rect x="0" y="41" width="30" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-end; width: 27px; height: 1px; padding-top: 51px; margin-left: -2px;"><div style="box-sizing: border-box; font-size: 0; text-align: right; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">I[1]</div></div></div></foreignObject><text x="25" y="54" fill="#000000" font-family="Helvetica" font-size="10px" text-anchor="end">I[1]</text></switch></g><rect x="0" y="61" width="30" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-end; width: 27px; height: 1px; padding-top: 71px; margin-left: -2px;"><div style="box-sizing: border-box; font-size: 0; text-align: right; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">I[2]</div></div></div></foreignObject><text x="25" y="74" fill="#000000" font-family="Helvetica" font-size="10px" text-anchor="end">I[2]</text></switch></g><rect x="0" y="81" width="30" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-end; width: 27px; height: 1px; padding-top: 91px; margin-left: -2px;"><div style="box-sizing: border-box; font-size: 0; text-align: right; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">I[3]</div></div></div></foreignObject><text x="25" y="94" fill="#000000" font-family="Helvetica" font-size="10px" text-anchor="end">I[3]</text></switch></g><rect x="0" y="101" width="30" height="20" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-end; width: 27px; height: 1px; padding-top: 111px; margin-left: -2px;"><div style="box-sizing: border-box; font-size: 0; text-align: right; "><div style="display: inline-block; font-size: 10px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">CLK</div></div></div></foreignObject><text x="25" y="114" fill="#000000" font-family="Helvetica" font-size="10px" text-anchor="end">CLK</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://desk.draw.io/support/solutions/articles/16000042487" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Viewer does not support full SVG 1.1</text></a></switch></svg>
\ No newline at end of file
diff --git a/v2x/vlog_to_model.py b/v2x/vlog_to_model.py
index e3a7199..88e99a8 100755
--- a/v2x/vlog_to_model.py
+++ b/v2x/vlog_to_model.py
@@ -20,6 +20,16 @@
- `(* ASSOC_CLOCK="RDCLK" *)` : force a port's associated
clock to a given value
+ - `(* COMB_INCLUDE_CLOCKS *)` : When specified on a clock input port
+ allows it to have combinational relations
+ with other ports.
+
+ - `(* NO_COMB *)` : Forces removal of all combinational relations of an
+ input port.
+
+ - `(* NO_SEQ *)` : Forces removal of all sequential relations of an input
+ port.
+
The following Verilog attributes are considered on modules:
- `(* MODEL_NAME="model" *)` : override the name used for
<model> and for ".subckt name" in the BLIF model. Mostly
@@ -193,11 +203,10 @@
clocks = run.list_clocks(infiles, top)
for name, width, bits, iodir in ports:
- nocomb = tmod.net_attr(name, "NO_COMB")
+ port_attrs = tmod.port_attrs(name)
is_clock = name in clocks or utils.is_clock_name(name)
- port_attrs = tmod.port_attrs(name)
if "CLOCK" in port_attrs:
is_clock = int(port_attrs["CLOCK"]) != 0
@@ -209,19 +218,29 @@
if is_registered_path(tmod, name, sink):
sinks.remove(sink)
- # FIXME: Check if ignoring clock for "combination_sink_ports"
- # is a valid thing to do.
if is_clock:
attrs["is_clock"] = "1"
+
+ # Remove comb sinks that do not have "COMB_INCLUDE_CLOCKS"
+ # attribute
+ for sink in sinks:
+ sink_attrs = tmod.port_attrs(sink)
+ if int(sink_attrs.get("COMB_INCLUDE_CLOCKS", 0)) == 0:
+ sinks.remove(sink)
+
else:
clks = list()
- if len(sinks) > 0 and iodir == "input" and nocomb is None:
- attrs["combinational_sink_ports"] = " ".join(sinks)
for clk in clocks:
- if is_clock_assoc(infiles, top, clk, name, iodir):
+ if is_clock_assoc(
+ infiles, top, clk, name, iodir):
+
clks.append(clk)
- if clks:
+ if clks and int(port_attrs.get("NO_SEQ", 0)) == 0:
attrs["clock"] = " ".join(clks)
+
+ if len(sinks) > 0 and iodir == "input" and \
+ int(port_attrs.get("NO_COMB", 0)) == 0:
+ attrs["combinational_sink_ports"] = " ".join(sinks)
if iodir == "input":
ET.SubElement(inports_xml, "port", attrs)
elif iodir == "output":
diff --git a/v2x/vlog_to_pbtype.py b/v2x/vlog_to_pbtype.py
index 9c8e1e2..dc1cdb5 100755
--- a/v2x/vlog_to_pbtype.py
+++ b/v2x/vlog_to_pbtype.py
@@ -704,9 +704,6 @@
port, iodir)
attrs["max"] = splitspec[1]
else:
- assert iodir == "input", \
- ("Only input ports can have {} timing definition."
- "Port {}, direction {}.").format(xmltype, port, iodir)
attrs["value"] = splitspec[1]
ET.SubElement(xml_parent, xmltype, attrs)