diff --git a/tests/fpgadataflow/test_fpgadataflow_fclayer.py b/tests/fpgadataflow/test_fpgadataflow_fclayer.py index 251fc806c3b0f8a52183b8003db6d930351b0ace..60473e8b7d884eb9c35739e4cb57ddd5bb707582 100644 --- a/tests/fpgadataflow/test_fpgadataflow_fclayer.py +++ b/tests/fpgadataflow/test_fpgadataflow_fclayer.py @@ -49,6 +49,7 @@ from finn.util.basic import calculate_signed_dot_prod_range, gen_finn_dt_tensor from finn.transformation.fpgadataflow.replace_verilog_relpaths import ( ReplaceVerilogRelPaths, ) +from finn.analysis.fpgadataflow.exp_cycles_per_layer import exp_cycles_per_layer def make_single_fclayer_modelwrapper(W, pe, simd, wdt, idt, odt, T=None, tdt=None): @@ -311,6 +312,15 @@ def test_fpgadataflow_fclayer_rtlsim(mem_mode, idt, wdt, act, nf, sf, mw, mh): hls_synt_res_est = model.analysis(hls_synth_res_estimation) assert "StreamingFCLayer_Batch_0" in hls_synt_res_est + node = model.get_nodes_by_op_type("StreamingFCLayer_Batch")[0] + inst = getCustomOp(node) + sim_cycles = inst.get_nodeattr("sim_cycles") + exp_cycles_dict = model.analysis(exp_cycles_per_layer) + exp_cycles = exp_cycles_dict[str(node)] + assert np.isclose(exp_cycles, sim_cycles, atol=15) + assert exp_cycles != 0 + + # mem_mode: const or decoupled @pytest.mark.parametrize("mem_mode", ["decoupled"]) @@ -403,3 +413,12 @@ def test_fpgadataflow_fclayer_large_depth_decoupled_mode_rtlsim( hls_synt_res_est = model.analysis(hls_synth_res_estimation) assert "StreamingFCLayer_Batch_0" in hls_synt_res_est + + node = model.get_nodes_by_op_type("StreamingFCLayer_Batch")[0] + inst = getCustomOp(node) + sim_cycles = inst.get_nodeattr("sim_cycles") + exp_cycles_dict = model.analysis(exp_cycles_per_layer) + exp_cycles = exp_cycles_dict[str(node)] + assert np.isclose(exp_cycles, sim_cycles, atol=15) + assert exp_cycles != 0 +