Skip to content

Commit 54ede86

Browse files
authored
Merge pull request #1460 from Xilinx/fix/thresholding_memstream
Adds reset after execution prehook in rtlsim
2 parents bb73ece + b197a3d commit 54ede86

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

finn-rtllib/memstream/hdl/memstream.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
module memstream #(
34-
int unsigned SETS = 1,
34+
int unsigned SETS,
3535
int unsigned DEPTH,
3636
int unsigned WIDTH,
3737

finn-rtllib/memstream/hdl/memstream_axi.sv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
module memstream_axi #(
34-
int unsigned SETS = 1,
34+
int unsigned SETS,
3535
int unsigned DEPTH,
3636
int unsigned WIDTH,
3737

@@ -153,6 +153,7 @@ module memstream_axi #(
153153
assign m_axis_0_tdata = mem_dat;
154154

155155
memstream #(
156+
.SETS(SETS),
156157
.DEPTH(DEPTH_EFF),
157158
.WIDTH(WIDTH_EFF),
158159
.INIT_FILE(INIT_FILE),
@@ -274,6 +275,7 @@ module memstream_axi #(
274275
end : blkStreamOut
275276

276277
memstream #(
278+
.SETS(SETS),
277279
.DEPTH(DEPTH_EFF),
278280
.WIDTH(WIDTH_EFF),
279281
.INIT_FILE(INIT_FILE),

src/finn/core/rtlsim_exec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def rtlsim_exec_finnxsi(model, execution_context, pre_hook=None, post_hook=None)
357357
finnxsi.reset_rtlsim(sim)
358358
if pre_hook is not None:
359359
pre_hook(sim)
360+
finnxsi.reset_rtlsim(sim)
360361
n_cycles = finnxsi.rtlsim_multi_io(
361362
sim,
362363
io_dict,

tests/fpgadataflow/test_fpgadataflow_elementwise_binary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def test_elementwise_binary_operation(
232232
if op_type in ["ElementwiseAdd", "ElementwiseSub", "ElementwiseMul"]:
233233
# Equivalence checking is more relaxed for arithmetic operations
234234
# numpy casts fp16 to fp32, computes in fp32, casts result to fp16
235-
assert np.allclose(o_expected, o_produced, rtol=1e-3, atol=2**-14)
235+
assert np.allclose(o_expected, o_produced, rtol=1e-3, atol=2**-13)
236236
else:
237237
assert np.all(o_expected == o_produced)
238238
else:

tests/fpgadataflow/test_fpgadataflow_mvau.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,6 @@ def test_fpgadataflow_mvau_large_depth_decoupled_mode_rtlsim(
511511
pytest.skip("Temporarily xfail this test, because last address can't be read back.")
512512
if preferred_impl_style == "rtl" and act is not None:
513513
pytest.skip("RTL-MVAU doesn't support const mem mode or embedded activations")
514-
if preferred_impl_style == "hls" and ram_style == "ultra" and not is_versal(part):
515-
# reference: https://github.com/Xilinx/finn/issues/1312
516-
pytest.skip(
517-
"Known error for runtime writeable weights and HLS MVU. Described in issue 1312"
518-
)
519514
if nf == -1:
520515
nf = mh
521516
if sf == -1:

tests/fpgadataflow/test_fpgadataflow_thresholding_runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_runtime_thresholds_read(impl_style, idt_act_cfg, cfg, narrow, per_tenso
192192
in_tensor = gen_finn_dt_tensor(idt, tuple(n_inp_vecs + [ch]))
193193
in_tensor = np.tile(in_tensor, (2, 1, 1, 1))
194194

195-
exec_ctx = {"inp": in_tensor}
195+
exec_ctx = {model.graph.input[0].name: in_tensor}
196196
extracted_weight_stream = []
197197

198198
def read_weights(sim):
@@ -311,7 +311,7 @@ def test_runtime_thresholds_write(impl_style, idt_act_cfg, cfg, narrow, per_tens
311311
in_tensor = gen_finn_dt_tensor(idt, tuple(n_inp_vecs + [ch]))
312312
in_tensor = np.tile(in_tensor, (2, 1, 1, 1))
313313

314-
exec_ctx_write = {"inp": in_tensor}
314+
exec_ctx_write = {model.graph.input[0].name: in_tensor}
315315

316316
def write_weights(sim):
317317
addr = 0

0 commit comments

Comments
 (0)