Skip to content

Commit

Permalink
[RTL MVU] Setting lo width max explicitly and updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
auphelia committed May 28, 2024
1 parent b0852c8 commit b36c5b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion finn-rtllib/mvu/mvu_4sx4u.sv
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module mvu_4sx4u #(
function int unsigned hi_width(input int unsigned i);
return 1 + $clog2(2**(ACCU_WIDTH-lo_width(i)-1)+SIMD);
endfunction : hi_width
localparam int unsigned LO_WIDTH_MAX = lo_width(0);
localparam int unsigned LO_WIDTH_MAX = OFFSETS[1] - OFFSETS[0];
localparam int unsigned HI_WIDTH_MAX = hi_width(2);

localparam int unsigned A_WIDTH = 23 + 2*VERSION; // Width of A datapath
Expand Down
13 changes: 9 additions & 4 deletions tests/fpgadataflow/test_fpgadataflow_mvau.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,17 +635,19 @@ def test_mvau_fifocharacterize_rtlsim(

@pytest.mark.parametrize("mh", [18])
@pytest.mark.parametrize("mw", [128])
@pytest.mark.parametrize("pe", [1, 6, 9, 18])
@pytest.mark.parametrize("simd", [1, 4, 16, 64, 128])
@pytest.mark.parametrize("pe", [1, 9, 18])
@pytest.mark.parametrize("simd", [1, 64, 128])
@pytest.mark.parametrize("idt", [DataType["UINT4"], DataType["UINT8"]])
@pytest.mark.parametrize("wdt", [DataType["INT4"], DataType["INT8"]])
@pytest.mark.parametrize("part", ["xcvc1902-vsva2197-2MP-e-S", "xcku3p-ffva676-1-e"])
@pytest.mark.parametrize(
"part", ["xcvc1902-vsva2197-2MP-e-S", "xcku3p-ffva676-1-e", "xc7z020clg400-1"]
)
@pytest.mark.parametrize("clk_ns", [1.66, 4])
@pytest.mark.fpgadataflow
@pytest.mark.slow
@pytest.mark.vivado
def test_fpgadataflow_rtl_mvau(mh, mw, pe, simd, idt, wdt, part, clk_ns):
if part == "xcku3p-ffva676-1-e" and clk_ns != 1.66:
if part != "xcvc1902-vsva2197-2MP-e-S" and clk_ns != 1.66:
pytest.skip(
"""Skip test for varying clk for devices other than Versal,
since this variable only affects DSP58s"""
Expand All @@ -657,6 +659,9 @@ def test_fpgadataflow_rtl_mvau(mh, mw, pe, simd, idt, wdt, part, clk_ns):
ifm = helper.make_tensor_value_info("ifm", TensorProto.FLOAT, [1, ofm_h, ofm_w, mw])
ofm = helper.make_tensor_value_info("ofm", TensorProto.FLOAT, (1, ofm_h, ofm_w, mh))
W = gen_finn_dt_tensor(wdt, (mw, mh))
# if 7 series, force weights to narrow range
if part == "xc7z020clg400-1":
W = np.clip(W, wdt.min() + 1, wdt.max())
model = make_single_matmul_modelwrapper(ifm, ofm, idt, wdt, W)
model = model.transform(GiveUniqueNodeNames())
model = model.transform(GiveReadableTensorNames())
Expand Down

0 comments on commit b36c5b1

Please sign in to comment.