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

[rtlsim] don't produce leftover out.npy file during rtlsim

use None in util fxn to indicate no file output
parent 7bddcc80
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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
......
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