Skip to content
Snippets Groups Projects
Commit b7d15030 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[StreamingFC] add attributes for FIFO gen

parent 5d08e2ed
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,9 @@ class StreamingFCLayer_Batch(HLSCustomOp): ...@@ -41,6 +41,9 @@ class StreamingFCLayer_Batch(HLSCustomOp):
"binaryXnorMode": ("i", False, 0), "binaryXnorMode": ("i", False, 0),
# no-activation mode (produce accumulators) # no-activation mode (produce accumulators)
"noActivation": ("i", False, 0), "noActivation": ("i", False, 0),
# input and output FIFO depths
"inFIFODepth": ("i", False, 0),
"outFIFODepth": ("i", False, 0),
} }
my_attrs.update(super().get_nodeattr_types()) my_attrs.update(super().get_nodeattr_types())
return my_attrs return my_attrs
...@@ -99,6 +102,7 @@ class StreamingFCLayer_Batch(HLSCustomOp): ...@@ -99,6 +102,7 @@ class StreamingFCLayer_Batch(HLSCustomOp):
info_messages.append('Attribute backend should be set to "fpgadataflow"') info_messages.append('Attribute backend should be set to "fpgadataflow"')
# verify that all necessary attributes exist # verify that all necessary attributes exist
# TODO collect automatically from get_nodeattr_types
try: try:
self.get_nodeattr("code_gen_dir_npysim") self.get_nodeattr("code_gen_dir_npysim")
self.get_nodeattr("executable_path") self.get_nodeattr("executable_path")
...@@ -161,6 +165,7 @@ class StreamingFCLayer_Batch(HLSCustomOp): ...@@ -161,6 +165,7 @@ class StreamingFCLayer_Batch(HLSCustomOp):
Y. Umuroglu, M. Leeser and K. Vissers Y. Umuroglu, M. Leeser and K. Vissers
- 12. Sep 2018 - 12. Sep 2018
""" """
# TODO add in/out FIFO contributions
P = self.get_nodeattr("PE") P = self.get_nodeattr("PE")
Q = self.get_nodeattr("SIMD") Q = self.get_nodeattr("SIMD")
wdt = self.get_weight_datatype() wdt = self.get_weight_datatype()
...@@ -178,6 +183,7 @@ class StreamingFCLayer_Batch(HLSCustomOp): ...@@ -178,6 +183,7 @@ class StreamingFCLayer_Batch(HLSCustomOp):
Y. Umuroglu, M. Leeser and K. Vissers Y. Umuroglu, M. Leeser and K. Vissers
- 12. Sep 2018 - 12. Sep 2018
""" """
# TODO add in/out FIFO contributions
P = self.get_nodeattr("PE") P = self.get_nodeattr("PE")
Q = self.get_nodeattr("SIMD") Q = self.get_nodeattr("SIMD")
wdt = self.get_weight_datatype() wdt = self.get_weight_datatype()
...@@ -642,6 +648,17 @@ class StreamingFCLayer_Batch(HLSCustomOp): ...@@ -642,6 +648,17 @@ class StreamingFCLayer_Batch(HLSCustomOp):
def pragmas(self): def pragmas(self):
self.code_gen_dict["$PRAGMAS$"] = ["#pragma HLS INTERFACE axis port=in0"] self.code_gen_dict["$PRAGMAS$"] = ["#pragma HLS INTERFACE axis port=in0"]
self.code_gen_dict["$PRAGMAS$"].append("#pragma HLS INTERFACE axis port=out") self.code_gen_dict["$PRAGMAS$"].append("#pragma HLS INTERFACE axis port=out")
in_fifo_depth = self.get_nodeattr("inFIFODepth")
out_fifo_depth = self.get_nodeattr("outFIFODepth")
# insert depth pragmas only if specified
if in_fifo_depth != 0:
self.code_gen_dict["$PRAGMAS$"].append(
"#pragma HLS stream depth=%d variable=in0" % in_fifo_depth
)
if out_fifo_depth != 0:
self.code_gen_dict["$PRAGMAS$"].append(
"#pragma HLS stream depth=%d variable=out" % out_fifo_depth
)
self.code_gen_dict["$PRAGMAS$"].append( self.code_gen_dict["$PRAGMAS$"].append(
"#pragma HLS INTERFACE ap_ctrl_none port=return" "#pragma HLS INTERFACE ap_ctrl_none port=return"
) )
......
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