Skip to content

Commit 1a2cbd3

Browse files
committed
[FIFO] If impl style is not accessible, raise exception
1 parent d2e1c6d commit 1a2cbd3

1 file changed

Lines changed: 38 additions & 5 deletions

File tree

src/finn/custom_op/fpgadataflow/streamingfifo.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ def infer_node_datatype(self, model):
8585

8686
def get_verilog_top_module_intf_names(self):
8787
ret = super().get_verilog_top_module_intf_names()
88-
is_rtl = self.get_nodeattr("impl_style") == "rtl"
88+
try:
89+
is_rtl = self.get_nodeattr("impl_style") == "rtl"
90+
except AttributeError:
91+
raise Exception(
92+
self.onnx_node.name
93+
+ """ is still in hw abstraction format,
94+
Please run SpecializeLayers() before proceeding."""
95+
)
8996
is_depth_monitor = self.get_nodeattr("depth_monitor") == 1
9097
if is_rtl and is_depth_monitor:
9198
ret["ap_none"] = ["maxcount"]
@@ -97,7 +104,11 @@ def get_normal_input_shape(self, ind=0):
97104
except AttributeError:
98105
depth = self.get_nodeattr("depth")
99106
assert depth >= 1, """Depth is too low"""
100-
if depth > 256 and self.get_nodeattr("impl_style") == "rtl":
107+
try:
108+
impl_style = self.get_nodeattr("impl_style") == "rtl"
109+
except AttributeError:
110+
impl_style = ""
111+
if depth > 256 and impl_style == "rtl":
101112
warnings.warn("Depth is high, set between 2 and 256 for efficient SRL implementation")
102113
return self.get_nodeattr("normal_shape")
103114

@@ -134,7 +145,15 @@ def execute_node(self, context, graph):
134145

135146
def bram_estimation(self):
136147
"""Calculates resource estimation for BRAM"""
137-
impl = self.get_nodeattr("impl_style")
148+
try:
149+
impl = self.get_nodeattr("impl_style") == "rtl"
150+
except AttributeError:
151+
raise Exception(
152+
self.onnx_node.name
153+
+ """ is still in hw abstraction format,
154+
Please run SpecializeLayers() before proceeding."""
155+
)
156+
138157
ram_type = self.get_nodeattr("ram_style")
139158
try:
140159
depth = self.get_adjusted_depth()
@@ -162,7 +181,14 @@ def bram_estimation(self):
162181
def uram_estimation(self):
163182
"""Calculates resource estimation for URAM"""
164183

165-
impl = self.get_nodeattr("impl_style")
184+
try:
185+
impl = self.get_nodeattr("impl_style") == "rtl"
186+
except AttributeError:
187+
raise Exception(
188+
self.onnx_node.name
189+
+ """ is still in hw abstraction format,
190+
Please run SpecializeLayers() before proceeding."""
191+
)
166192
ram_type = self.get_nodeattr("ram_style")
167193
try:
168194
depth = self.get_adjusted_depth()
@@ -191,7 +217,14 @@ def bram_efficiency_estimation(self):
191217

192218
def lut_estimation(self):
193219
"""Calculates resource estimations for LUTs"""
194-
impl = self.get_nodeattr("impl_style")
220+
try:
221+
impl = self.get_nodeattr("impl_style") == "rtl"
222+
except AttributeError:
223+
raise Exception(
224+
self.onnx_node.name
225+
+ """ is still in hw abstraction format,
226+
Please run SpecializeLayers() before proceeding."""
227+
)
195228
ram_type = self.get_nodeattr("ram_style")
196229
try:
197230
depth = self.get_adjusted_depth()

0 commit comments

Comments
 (0)