Skip to content

Commit baf9557

Browse files
litghostvaughnbetz
authored andcommitted
Add support for multiple FASM features for a single mux selection.
Signed-off-by: Keith Rothman <[email protected]>
1 parent b473420 commit baf9557

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

doc/src/utils/fasm.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,20 @@ can also be used with the ``<direct>`` tag in the same way, example:
233233
</metadata>
234234
</direct>
235235
236+
If multiple FASM features are required for a mux, they can be specified using
237+
comma's as a seperator. Example:
238+
239+
.. code-block:: xml
240+
241+
<mux name="D5FFMUX" input="BLK_IG-COMMON_SLICE.DX BLK_IG-COMMON_SLICE.DO5" output="BLK_BB-SLICE_FF.D5[3]" >
242+
<metadata>
243+
<meta name="fasm_mux">
244+
BLK_IG-COMMON_SLICE.DO5 : D5FFMUX.IN_A
245+
BLK_IG-COMMON_SLICE.DX : D5FFMUX.IN_B, D5FF.OTHER_FEATURE
246+
</meta>
247+
</metadata>
248+
</mux>
249+
236250
Passing parameters through to the FASM Output
237251
---------------------------------------------
238252

utils/fasm/src/fasm.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,14 @@ void FasmWriterVisitor::output_fasm_mux(std::string fasm_mux,
658658
bool root_level_connection = interconnect->parent_mode->parent_pb_type ==
659659
mux_input_pin->parent_node->pb_type;
660660

661+
auto fasm_features = vtr::join(vtr::split(mux_parts[1], ","), "\n");
662+
661663
if(root_level_connection) {
662664
// This connection is root level. pb_index selects between
663665
// pb_type_prefixes_, not on the mux input.
664666
if(mux_pb_name == pb_name && mux_port_name == port_name && mux_pin_index == pin_index) {
665667
if(mux_parts[1] != "NULL") {
666-
output_fasm_features(mux_parts[1]);
668+
output_fasm_features(fasm_features);
667669
}
668670
return;
669671
}
@@ -672,7 +674,7 @@ void FasmWriterVisitor::output_fasm_mux(std::string fasm_mux,
672674
mux_port_name == port_name &&
673675
mux_pin_index == pin_index) {
674676
if(mux_parts[1] != "NULL") {
675-
output_fasm_features(mux_parts[1]);
677+
output_fasm_features(fasm_features);
676678
}
677679
return;
678680
}

utils/fasm/test/test_fasm.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
8181
std::set<std::tuple<int, int, short>> routing_edges;
8282
bool found_lut5 = false;
8383
bool found_lut6 = false;
84+
bool found_mux1 = false;
85+
bool found_mux2 = false;
8486
while(fasm_string) {
8587
// Should see something like:
8688
// CLB.FLE0.N2_LUT5
8789
// CLB.FLE8.LUT5_1.LUT[31:0]=32'b00000000000000010000000000000000
8890
// CLB.FLE9.OUT_MUX.LUT
91+
// CLB.FLE9.DISABLE_FF
8992
// CLB.FLE9.LUT6[63:0]=64'b0000000000000000000000000000000100000000000000000000000000000000
9093
// 3634_3690_0
9194
std::string line;
@@ -95,6 +98,13 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
9598
continue;
9699
}
97100

101+
if(!found_mux1 && line == "CLB.FLE9.OUT_MUX.LUT") {
102+
found_mux1 = true;
103+
}
104+
if(!found_mux2 && line == "CLB.FLE9.DISABLE_FF") {
105+
found_mux2 = true;
106+
}
107+
98108
if(line.find("CLB") != std::string::npos) {
99109
auto pos = line.find("LUT[");
100110
if(pos != std::string::npos) {
@@ -138,6 +148,8 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
138148

139149
CHECK(found_lut5);
140150
CHECK(found_lut6);
151+
CHECK(found_mux1);
152+
CHECK(found_mux2);
141153

142154
vpr_free_all(arch, vpr_setup);
143155
}

utils/fasm/test/test_fasm_arch.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<delay_constant max="45e-12" in_port="ff[0:0].Q" out_port="ble5.out[0:0]"/>
146146
<meta name="fasm_mux">
147147
ff.Q : OUT_MUX.FFQ
148-
lut5.out : OUT_MUX.LUT
148+
lut5.out : OUT_MUX.LUT,DISABLE_FF
149149
</meta>
150150
</mux>
151151
</interconnect>
@@ -223,7 +223,7 @@
223223
<metadata>
224224
<meta name="fasm_mux">
225225
ff.Q : OUT_MUX.FFQ
226-
lut6.out : OUT_MUX.LUT
226+
lut6.out : OUT_MUX.LUT,DISABLE_FF
227227
</meta>
228228
</metadata>
229229
</mux>

0 commit comments

Comments
 (0)