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

[Threshold] bugfixes in standalone Thresholding op

- wrong number of reps causes cppsim bugs and reading from empty stream
- adjusted cppsim I/O wrappers to reflect changes in HLSCustomOp
parent 7b4938b4
No related branches found
No related tags found
No related merge requests found
...@@ -545,12 +545,10 @@ class Thresholding_Batch(HLSCustomOp): ...@@ -545,12 +545,10 @@ class Thresholding_Batch(HLSCustomOp):
out = context[node.output[0]] out = context[node.output[0]]
out = 2 * out - 1 out = 2 * out - 1
context[node.output[0]] = out context[node.output[0]] = out
oshape = self.get_normal_output_shape()
assert ( assert (
context[node.output[0]].shape == self.get_folded_output_shape() context[node.output[0]].shape == oshape
), """Output shape is not as expected""" ), """Output shape is not as expected"""
# reshape output to have expected shape
oshape = self.get_normal_output_shape()
context[node.output[0]] = context[node.output[0]].reshape(*oshape)
elif mode == "rtlsim": elif mode == "rtlsim":
sim = self.get_rtlsim() sim = self.get_rtlsim()
nbits = self.get_instream_width() nbits = self.get_instream_width()
...@@ -691,9 +689,12 @@ class Thresholding_Batch(HLSCustomOp): ...@@ -691,9 +689,12 @@ class Thresholding_Batch(HLSCustomOp):
) )
] ]
elif mem_mode == "decoupled": elif mem_mode == "decoupled":
# note that numReps is set to 1 in the invocation below, since
# - for cppsim the repetition comes from the threshold stream reader+input
# - for synth the unit runs continuously anyway (ap_ctrl_none)
self.code_gen_dict["$DOCOMPUTE$"] = [ self.code_gen_dict["$DOCOMPUTE$"] = [
"""{}<{}, NumChannels1, PE1, {}, {}, ActVal1, ThresType1, NumSteps1> """{}<{}, NumChannels1, PE1, {}, {}, ActVal1, ThresType1, NumSteps1>
(in0, out, weights, numReps);""".format( (in0, out, weights, 1);""".format(
"Thresholding_Stream_Batch", "Thresholding_Stream_Batch",
total_spatial_size, total_spatial_size,
tmpl_args["TSrcI"], tmpl_args["TSrcI"],
......
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