Skip to content

Commit 4e82616

Browse files
committed
Fix handling of fasm_lut directives at level outside of ".names".
Add's test case for both usages of fasm_lut. Signed-off-by: Keith Rothman <[email protected]>
1 parent d8c2e52 commit 4e82616

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

utils/fasm/src/fasm.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,17 @@ static const t_metadata_dict *get_fasm_type(const t_pb_graph_node* pb_graph_node
374374
return nullptr;
375375
}
376376

377-
t_metadata_dict *meta = nullptr;
377+
const t_metadata_dict *meta = nullptr;
378378
if(pb_graph_node->pb_type->meta.has("fasm_type")) {
379379
meta = &pb_graph_node->pb_type->meta;
380380
}
381381

382-
if(pb_graph_node->pb_type->parent_mode != nullptr &&
383-
pb_graph_node->pb_type->parent_mode->meta.has("fasm_type")) {
384-
meta = &pb_graph_node->pb_type->parent_mode->meta;
382+
if(pb_graph_node->pb_type->parent_mode != nullptr) {
383+
VTR_ASSERT(pb_graph_node->pb_type->parent_mode->parent_pb_type != nullptr);
384+
const t_pb_type *pb_type = pb_graph_node->pb_type->parent_mode->parent_pb_type;
385+
if(pb_type->meta.has("fasm_type")) {
386+
meta = &pb_type->meta;
387+
}
385388
}
386389

387390
if(meta != nullptr && meta->one("fasm_type")->as_string() == target_type) {

utils/fasm/test/test_fasm_arch.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,6 @@
122122
235e-12
123123
235e-12
124124
</delay_matrix>
125-
<metadata>
126-
<meta name="fasm_type">LUT</meta>
127-
<meta name="fasm_lut">
128-
LUT[31:0] = LUT
129-
</meta>
130-
</metadata>
131125
</pb_type>
132126

133127
<pb_type name="ff" blif_model=".latch" num_pb="1" class="flipflop">
@@ -156,6 +150,10 @@
156150
</mux>
157151
</interconnect>
158152
<metadata>
153+
<meta name="fasm_type">LUT</meta>
154+
<meta name="fasm_lut">
155+
LUT[31:0]
156+
</meta>
159157
<meta name="fasm_prefix">
160158
LUT5_0 LUT5_1
161159
</meta>
@@ -199,7 +197,7 @@
199197
<metadata>
200198
<meta name="fasm_type">LUT</meta>
201199
<meta name="fasm_lut">
202-
LUT6[63:0] = LUT
200+
LUT6[63:0]
203201
</meta>
204202
</metadata>
205203
</pb_type>

0 commit comments

Comments
 (0)