diff --git a/src/finn/core/rtlsim_exec.py b/src/finn/core/rtlsim_exec.py index af84a75e299d666c059df54211be42b691f5ccf2..e5e6d29bd8d8ed23f6a4958856ed1ddea3617175 100644 --- a/src/finn/core/rtlsim_exec.py +++ b/src/finn/core/rtlsim_exec.py @@ -94,7 +94,7 @@ def rtlsim_exec(model, execution_context): model.set_metadata_prop("sim_cycles", str(ret[1])) # unpack output and put into context o_folded_tensor = rtlsim_output_to_npy( - packed_output, "out.npy", o_dt, o_folded_shape, packedBits, targetBits + packed_output, None, o_dt, o_folded_shape, packedBits, targetBits ) execution_context[o_name] = o_folded_tensor.reshape(o_shape) diff --git a/src/finn/util/data_packing.py b/src/finn/util/data_packing.py index e67638bd1ca81d933fbfbffec9efcd7f84fa961e..a087fd2ff2f8a3db8a6caa8332810be9b6188367 100644 --- a/src/finn/util/data_packing.py +++ b/src/finn/util/data_packing.py @@ -296,7 +296,8 @@ def rtlsim_output_to_npy( """Convert a flattened sequence of Python arbitrary-precision integers output into a NumPy array, saved as npy file at path. Each arbitrary-precision integer is assumed to be a packed array of targetBits-bit elements, which - will be unpacked as the innermost dimension of the NumPy array.""" + will be unpacked as the innermost dimension of the NumPy array. If path is + not None it will also be saved as a npy file.""" # TODO should have its own testbench? output = np.asarray([hex(int(x)) for x in output]) @@ -305,7 +306,8 @@ def rtlsim_output_to_npy( ) # make copy before saving the array out_array = out_array.copy() - np.save(path, out_array) + if path is not None: + np.save(path, out_array) return out_array