Skip to content

Commit d2e1c6d

Browse files
committed
[FIFO] If adjusted depth is not accessible, use depth node attribute instead
1 parent 66ace88 commit d2e1c6d

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

src/finn/custom_op/fpgadataflow/streamingfifo.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def get_verilog_top_module_intf_names(self):
9292
return ret
9393

9494
def get_normal_input_shape(self, ind=0):
95-
depth = self.get_adjusted_depth()
95+
try:
96+
depth = self.get_adjusted_depth()
97+
except AttributeError:
98+
depth = self.get_nodeattr("depth")
9699
assert depth >= 1, """Depth is too low"""
97100
if depth > 256 and self.get_nodeattr("impl_style") == "rtl":
98101
warnings.warn("Depth is high, set between 2 and 256 for efficient SRL implementation")
@@ -133,7 +136,10 @@ def bram_estimation(self):
133136
"""Calculates resource estimation for BRAM"""
134137
impl = self.get_nodeattr("impl_style")
135138
ram_type = self.get_nodeattr("ram_style")
136-
depth = self.get_adjusted_depth()
139+
try:
140+
depth = self.get_adjusted_depth()
141+
except AttributeError:
142+
depth = self.get_nodeattr("depth")
137143
W = self.get_instream_width()
138144

139145
if impl == "rtl" or (impl == "vivado" and ram_type != "block"):
@@ -158,7 +164,10 @@ def uram_estimation(self):
158164

159165
impl = self.get_nodeattr("impl_style")
160166
ram_type = self.get_nodeattr("ram_style")
161-
depth = self.get_adjusted_depth()
167+
try:
168+
depth = self.get_adjusted_depth()
169+
except AttributeError:
170+
depth = self.get_nodeattr("depth")
162171
W = self.get_instream_width()
163172

164173
if impl == "rtl" or (impl == "vivado" and ram_type != "ultra"):
@@ -168,7 +177,10 @@ def uram_estimation(self):
168177
return (math.ceil(depth / 4096)) * (math.ceil(W / 72))
169178

170179
def bram_efficiency_estimation(self):
171-
depth = self.get_adjusted_depth()
180+
try:
181+
depth = self.get_adjusted_depth()
182+
except AttributeError:
183+
depth = self.get_nodeattr("depth")
172184
W = self.get_instream_width()
173185
bram16_est = self.bram_estimation()
174186
if bram16_est == 0:
@@ -181,7 +193,10 @@ def lut_estimation(self):
181193
"""Calculates resource estimations for LUTs"""
182194
impl = self.get_nodeattr("impl_style")
183195
ram_type = self.get_nodeattr("ram_style")
184-
depth = self.get_adjusted_depth()
196+
try:
197+
depth = self.get_adjusted_depth()
198+
except AttributeError:
199+
depth = self.get_nodeattr("depth")
185200
W = self.get_instream_width()
186201

187202
address_luts = 2 * math.ceil(math.log(depth, 2))

0 commit comments

Comments
 (0)