Skip to content
Snippets Groups Projects
Commit 5e50f644 authored by Lucian Petrica's avatar Lucian Petrica
Browse files

Modified DWC instantiation to process all input words in a single call, optimizing throughput

parent aa21bd7b
No related branches found
No related tags found
No related merge requests found
...@@ -214,7 +214,7 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp): ...@@ -214,7 +214,7 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp):
def defines(self, var): def defines(self, var):
numReps = 1 numReps = 1
numInWords = 1 numInWords = int(np.prod(self.get_folded_input_shape()[:-1]))
inWidth = self.get_nodeattr("inWidth") inWidth = self.get_nodeattr("inWidth")
outWidth = self.get_nodeattr("outWidth") outWidth = self.get_nodeattr("outWidth")
if outWidth > inWidth: if outWidth > inWidth:
...@@ -451,7 +451,6 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp): ...@@ -451,7 +451,6 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp):
def lut_estimation(self): def lut_estimation(self):
"""Calculates resource estimations for LUTs""" """Calculates resource estimations for LUTs"""
impl = self.get_nodeattr("impl_style")
inw = self.get_instream_width() inw = self.get_instream_width()
outw = self.get_outstream_width() outw = self.get_outstream_width()
...@@ -461,7 +460,7 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp): ...@@ -461,7 +460,7 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp):
# sometimes withs aren't directly divisible # sometimes withs aren't directly divisible
# this requires going up from input width to least common multiple # this requires going up from input width to least common multiple
# then down to output width # then down to output width
intw = abs(maxw*minw) // math.gcd(maxw, minw) intw = abs(maxw * minw) // math.gcd(maxw, minw)
# we assume a shift-based implementation # we assume a shift-based implementation
# even if we don't use LUTs explicitly, we make some unavailable # even if we don't use LUTs explicitly, we make some unavailable
...@@ -471,11 +470,10 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp): ...@@ -471,11 +470,10 @@ class StreamingDataWidthConverter_Batch(HLSCustomOp):
cset_luts = 0 cset_luts = 0
if inw != intw: if inw != intw:
cnt_luts += abs(math.ceil(math.log(inw/intw, 2))) cnt_luts += abs(math.ceil(math.log(inw / intw, 2)))
cset_luts += intw cset_luts += intw
if intw != outw: if intw != outw:
cnt_luts += abs(math.ceil(math.log(intw / outw, 2))) cnt_luts += abs(math.ceil(math.log(intw / outw, 2)))
cset_luts += outw cset_luts += outw
return int(cnt_luts+cset_luts) return int(cnt_luts + cset_luts)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment