diff --git a/src/finn/transformation/fpgadataflow/create_stitched_ip.py b/src/finn/transformation/fpgadataflow/create_stitched_ip.py index 51b45e0e401cb45447a36db3d48ad43bb60369d4..22e266ac681ea440181dc4b3300b70008762e0ef 100644 --- a/src/finn/transformation/fpgadataflow/create_stitched_ip.py +++ b/src/finn/transformation/fpgadataflow/create_stitched_ip.py @@ -86,11 +86,6 @@ class CreateStitchedIP(Transformation): self.clk_ns = clk_ns self.ip_name = ip_name self.vitis = vitis - if float(clk_ns) not in [5.0, 10.0, 20.0]: - warnings.warn( - """The chosen frequency may lead to failure due to clock divider - constraints.""" - ) self.has_aximm = False self.has_m_axis = False self.m_axis_idx = 0 @@ -221,6 +216,13 @@ class CreateStitchedIP(Transformation): ip_dirs = ["list"] # add RTL streamer IP ip_dirs.append("/workspace/finn/finn-rtllib/memstream") + if model.graph.node.op_type not in ["StreamingFIFO", "IODMA"]: + warnings.warn( + """First node is not StreamingFIFO or IODMA. + You may experience incorrect stitched-IP rtlsim or hardware + behavior. It is strongly recommended to insert FIFOs prior to + calling CreateStitchedIP.""" + ) # ensure that all nodes are fpgadataflow, and that IPs are generated for node in model.graph.node: assert is_fpgadataflow_node( diff --git a/tests/fpgadataflow/test_fpgadataflow_thresholding.py b/tests/fpgadataflow/test_fpgadataflow_thresholding.py index b87241de56870cad70d08583b24292e0da91109e..012bc3e2e140c3fa63729584629613e3046f8838 100644 --- a/tests/fpgadataflow/test_fpgadataflow_thresholding.py +++ b/tests/fpgadataflow/test_fpgadataflow_thresholding.py @@ -43,6 +43,7 @@ from finn.custom_op.registry import getCustomOp from finn.transformation.fpgadataflow.compile_cppsim import CompileCppSim from finn.transformation.fpgadataflow.create_stitched_ip import CreateStitchedIP from finn.transformation.fpgadataflow.hlssynth_ip import HLSSynthIP +from finn.transformation.fpgadataflow.insert_fifo import InsertFIFO from finn.transformation.fpgadataflow.prepare_cppsim import PrepareCppSim from finn.transformation.fpgadataflow.prepare_ip import PrepareIP from finn.transformation.fpgadataflow.prepare_rtlsim import PrepareRTLSim @@ -216,6 +217,7 @@ def test_runtime_thresholds_single_layer(): old_weight_stream = map(lambda x: int(x, 16), old_weight_stream.split("\n")) old_weight_stream = list(old_weight_stream) # need to create stitched IP for runtime weight testing + model = model.transform(InsertFIFO(True)) model = model.transform(GiveUniqueNodeNames()) model = model.transform(PrepareIP(test_fpga_part, target_clk_ns)) model = model.transform(HLSSynthIP()) diff --git a/tests/fpgadataflow/test_runtime_weights.py b/tests/fpgadataflow/test_runtime_weights.py index 73b1315592af79145e1b7c6f147b3ede7e066bce..706d11114f2f08df700efd40afb8dea218efbf42 100644 --- a/tests/fpgadataflow/test_runtime_weights.py +++ b/tests/fpgadataflow/test_runtime_weights.py @@ -36,8 +36,8 @@ from finn.core.rtlsim_exec import rtlsim_exec from finn.custom_op.registry import getCustomOp from finn.transformation.fpgadataflow.create_stitched_ip import CreateStitchedIP from finn.transformation.fpgadataflow.hlssynth_ip import HLSSynthIP +from finn.transformation.fpgadataflow.insert_fifo import InsertFIFO from finn.transformation.fpgadataflow.prepare_ip import PrepareIP -from finn.transformation.fpgadataflow.prepare_rtlsim import PrepareRTLSim from finn.transformation.general import GiveUniqueNodeNames from finn.util.basic import gen_finn_dt_tensor from finn.util.create import hls_random_mlp_maker @@ -78,11 +78,11 @@ def test_runtime_weights_single_layer(): os.remove("old_weights.dat") old_weight_stream = map(lambda x: int(x, 16), old_weight_stream.split("\n")) old_weight_stream = list(old_weight_stream) + model = model.transform(InsertFIFO(True)) model = model.transform(GiveUniqueNodeNames()) model = model.transform(PrepareIP(test_fpga_part, target_clk_ns)) model = model.transform(HLSSynthIP()) model = model.transform(CreateStitchedIP(test_fpga_part, target_clk_ns)) - model = model.transform(PrepareRTLSim()) model.set_metadata_prop("exec_mode", "rtlsim") in_tensor = np.asarray(range(mw), dtype=np.float32) # add two copies of the input tensor as the first one is just used to