From d35c6998d637a93d3334f0bc027754c8dc3109bd Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Mon, 14 Sep 2020 09:53:56 +0200 Subject: [PATCH] Added test case for pack pattern annotation Signed-off-by: Maciej Kurc --- tests/pack_pattern/README.rst | 6 +++ tests/pack_pattern/block.sim.v | 50 +++++++++++++++++ tests/pack_pattern/ff/ff.pb_type.xml | 7 +++ tests/pack_pattern/ff/ff.sim.v | 20 +++++++ tests/pack_pattern/golden.pb_type.xml | 74 ++++++++++++++++++++++++++ tests/pack_pattern/lut/lut.pb_type.xml | 6 +++ tests/pack_pattern/lut/lut.sim.v | 20 +++++++ tests/pack_pattern/mux/mux.pb_type.xml | 8 +++ tests/pack_pattern/mux/mux.sim.v | 20 +++++++ 9 files changed, 211 insertions(+) create mode 100644 tests/pack_pattern/README.rst create mode 100644 tests/pack_pattern/block.sim.v create mode 100644 tests/pack_pattern/ff/ff.pb_type.xml create mode 100644 tests/pack_pattern/ff/ff.sim.v create mode 100644 tests/pack_pattern/golden.pb_type.xml create mode 100644 tests/pack_pattern/lut/lut.pb_type.xml create mode 100644 tests/pack_pattern/lut/lut.sim.v create mode 100644 tests/pack_pattern/mux/mux.pb_type.xml create mode 100644 tests/pack_pattern/mux/mux.sim.v diff --git a/tests/pack_pattern/README.rst b/tests/pack_pattern/README.rst new file mode 100644 index 00000000..86aa4f7e --- /dev/null +++ b/tests/pack_pattern/README.rst @@ -0,0 +1,6 @@ +Pack pattern annotation test +++++++++++++++++++++++++++++ + +VPR requires that connections between primitives that need to be packed together to be annotated with pack patterns. Moreover, a single connection may have multiple pack pattern annotations. + +This test contains a model of a logic block that has a LUT4 connected to a FF through a MUX. The mux allows to dynamically select whether the FF input is driven by the LUT or an external input. There are two pack patterns one for LUT, MUX and FF packed together and one for MUX and FF without the LUT. The connection between the LUT and the MUX gets a single pack pattern annotation while the one between MUX and FF gets two annotations. diff --git a/tests/pack_pattern/block.sim.v b/tests/pack_pattern/block.sim.v new file mode 100644 index 00000000..5c2991f6 --- /dev/null +++ b/tests/pack_pattern/block.sim.v @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2020 The SymbiFlow Authors. + * + * Use of this source code is governed by a ISC-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/ISC + * + * SPDX-License-Identifier: ISC + */ + +`include "lut/lut.sim.v" +`include "mux/mux.sim.v" +`include "ff/ff.sim.v" + +module BLOCK ( + input wire C, + input wire [3:0] I, + input wire D, + input wire S, + output wire Q +); + + // LUT + (* PACK="lut_mux_ff" *) + wire lut_out; + + LUT lut_cell ( + .I (I), + .O (lut_out) + ); + + // Mux + (* PACK="lut_mux_ff;mux_ff" *) + wire mux_out; + + MUX mux_cell ( + .I0 (lut_out), + .I1 (D), + .S (S), + .O (mux_out) + ); + + // FF + FF ff_cell ( + .C (C), + .D (mux_out), + .Q (Q) + ); + +endmodule diff --git a/tests/pack_pattern/ff/ff.pb_type.xml b/tests/pack_pattern/ff/ff.pb_type.xml new file mode 100644 index 00000000..179d8910 --- /dev/null +++ b/tests/pack_pattern/ff/ff.pb_type.xml @@ -0,0 +1,7 @@ + + + .subckt FF + + + + diff --git a/tests/pack_pattern/ff/ff.sim.v b/tests/pack_pattern/ff/ff.sim.v new file mode 100644 index 00000000..8d972eb6 --- /dev/null +++ b/tests/pack_pattern/ff/ff.sim.v @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2020 The SymbiFlow Authors. + * + * Use of this source code is governed by a ISC-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/ISC + * + * SPDX-License-Identifier: ISC + */ + +module FF ( + input wire C, + input wire D, + output reg Q +); + + always @(posedge C) + Q <= D; + +endmodule diff --git a/tests/pack_pattern/golden.pb_type.xml b/tests/pack_pattern/golden.pb_type.xml new file mode 100644 index 00000000..a5f193fe --- /dev/null +++ b/tests/pack_pattern/golden.pb_type.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/pack_pattern/lut/lut.pb_type.xml b/tests/pack_pattern/lut/lut.pb_type.xml new file mode 100644 index 00000000..361c5fdb --- /dev/null +++ b/tests/pack_pattern/lut/lut.pb_type.xml @@ -0,0 +1,6 @@ + + + .subckt LUT + + + diff --git a/tests/pack_pattern/lut/lut.sim.v b/tests/pack_pattern/lut/lut.sim.v new file mode 100644 index 00000000..24f22687 --- /dev/null +++ b/tests/pack_pattern/lut/lut.sim.v @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2020 The SymbiFlow Authors. + * + * Use of this source code is governed by a ISC-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/ISC + * + * SPDX-License-Identifier: ISC + */ + +module LUT ( + input wire [3:0] I, + output wire O +); + + parameter [15:0] INIT = 'd0; + + assign O = INIT[i]; + +endmodule diff --git a/tests/pack_pattern/mux/mux.pb_type.xml b/tests/pack_pattern/mux/mux.pb_type.xml new file mode 100644 index 00000000..cb97fd0a --- /dev/null +++ b/tests/pack_pattern/mux/mux.pb_type.xml @@ -0,0 +1,8 @@ + + + .subckt MUX + + + + + diff --git a/tests/pack_pattern/mux/mux.sim.v b/tests/pack_pattern/mux/mux.sim.v new file mode 100644 index 00000000..913c6d80 --- /dev/null +++ b/tests/pack_pattern/mux/mux.sim.v @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2020 The SymbiFlow Authors. + * + * Use of this source code is governed by a ISC-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/ISC + * + * SPDX-License-Identifier: ISC + */ + +module MUX ( + input wire I0, + input wire I1, + input wire S, + output wire O +); + + assign O = S ? I1 : I0; + +endmodule