Skip to content

Commit 10bf54b

Browse files
authored
Merge pull request Xilinx#1284 from Xilinx/preusser/q_srl_guard
Guard Q_srl against Instantiation with a Depth below Two
2 parents cbf3636 + dcb7177 commit 10bf54b

File tree

4 files changed

+13
-311
lines changed

4 files changed

+13
-311
lines changed

finn-rtllib/fifo/hdl/Q_srl.v

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ module Q_srl (clock, reset, i_d, i_v, i_r, o_d, o_v, o_r, count, maxcount);
119119
reg i_b_reg // - true iff !full
120120
/* synthesis syn_allow_retiming=0 */ ;
121121

122+
// Parameter Checking
123+
initial begin
124+
if(depth < 2) begin
125+
$error("%m: FIFO depth must be two or higher.");
126+
$finish;
127+
end
128+
end
129+
130+
122131
assign addr_full_ = (state_==state_more) && (addr_==depth-2);
123132
// - queue full
124133
assign addr_zero_ = (addr==0); // - queue contains 2 (or 1,0)

finn-rtllib/memstream/hdl/Q_srl.v

Lines changed: 0 additions & 308 deletions
This file was deleted.

src/finn/transformation/fpgadataflow/set_fifo_depths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def decompose_pow2(x):
539539
ret_final = []
540540
for cand_depth in ret_pass2:
541541
if cand_depth <= max_qsrl_depth:
542-
ret_final.append((cand_depth, "rtl"))
542+
ret_final.append((max(2, cand_depth), "rtl"))
543543
else:
544544
ret_final.append((cand_depth, "vivado"))
545545

tests/fpgadataflow/test_split_large_fifos.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_folding_cfg(depth=65536):
6363
@pytest.mark.slow
6464
@pytest.mark.vivado
6565
@pytest.mark.fpgadataflow
66-
@pytest.mark.parametrize("depth", [16384, 65536, 45000])
66+
@pytest.mark.parametrize("depth", [16384, 65536, 45000, 1537])
6767
@pytest.mark.parametrize("force_python_rtlsim", ["True", "False"])
6868
def test_split_large_fifos(depth, force_python_rtlsim):
6969
tmp_output_dir = fetch_test_model("tfc")
@@ -103,13 +103,14 @@ def test_split_large_fifos(depth, force_python_rtlsim):
103103
inst = getCustomOp(fifo_node)
104104
fifo_depth = inst.get_nodeattr("depth")
105105
assert fifo_depth == golden_cfg[i % len(golden_cfg)][0]
106+
assert fifo_depth > 1
106107

107108
shutil.rmtree(tmp_output_dir)
108109

109110

110111
def test_split_large_fifo_configs():
111112
ret0 = get_fifo_split_configs(513, 256, 32768)
112-
assert ret0 == [(512, "vivado"), (1, "rtl")]
113+
assert ret0 == [(512, "vivado"), (2, "rtl")]
113114
ret1 = get_fifo_split_configs(1200, 256, 32768)
114115
assert ret1 == [(1024, "vivado"), (176, "rtl")]
115116
ret2 = get_fifo_split_configs(45000, 256, 32768)

0 commit comments

Comments
 (0)