Skip to content
Snippets Groups Projects
Commit c2472392 authored by auphelia's avatar auphelia
Browse files

[Test] Add exp_cycle calculation test to duplicatestreams test

parent 9da33701
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import pytest
import numpy as np
from onnx import TensorProto, helper
......@@ -46,6 +47,8 @@ from finn.util.basic import gen_finn_dt_tensor
from finn.transformation.fpgadataflow.replace_verilog_relpaths import (
ReplaceVerilogRelPaths,
)
from finn.custom_op.registry import getCustomOp
from finn.analysis.fpgadataflow.exp_cycles_per_layer import exp_cycles_per_layer
def make_dupstreams_modelwrapper(ch, pe, idim, idt):
......@@ -130,3 +133,10 @@ def test_fpgadataflow_duplicatestreams(idt, ch, fold, imdim, exec_mode):
assert (y0 == expected_y).all(), exec_mode + " failed"
assert (y1 == expected_y).all(), exec_mode + " failed"
if exec_mode == "rtlsim":
inst = getCustomOp(model.graph.node[0])
sim_cycles = inst.get_nodeattr("sim_cycles")
exp_cycles_dict = model.analysis(exp_cycles_per_layer)
exp_cycles = exp_cycles_dict[str(model.graph.node[0])]
assert np.isclose(exp_cycles, sim_cycles, atol=10)
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