//-------------------------------------------
// FPGA Synthesizable Verilog Netlist
// Description: FPGA Verilog full testbench for top-level netlist of design: mult4
// Author: Xifan TANG
// Organization: University of Utah
// Date: Sat Jan 24 19:10:26 2026
//-------------------------------------------
//----- Default net type -----
`default_nettype wire
module mult4_autocheck_top_tb;
// ----- Local wires for global ports of FPGA fabric -----
wire [0:0] pReset;
wire [0:0] prog_clk;
wire [0:0] set;
wire [0:0] reset;
wire [0:0] clk;
// ----- Local wires for I/Os of FPGA fabric -----
wire [0:63] gfpga_pad_GPIO_PAD;
reg [0:0] __config_done__;
wire [0:0] __config_all_done__;
wire [0:0] __prog_clock__;
reg [0:0] __prog_clock___reg__;
wire [0:0] __op_clock__;
reg [0:0] __op_clock___reg__;
reg [0:0] __prog_reset__;
reg [0:0] __prog_set_;
reg [0:0] __greset__;
reg [0:0] __gset__;
// ---- Configuration-chain head -----
reg [0:0] ccff_head;
// ---- Configuration-chain tail -----
wire [0:0] ccff_tail;
// ----- Shared inputs -------
reg [0:0] A_0__shared_input;
reg [0:0] A_1__shared_input;
reg [0:0] A_2__shared_input;
reg [0:0] A_3__shared_input;
reg [0:0] B_0__shared_input;
reg [0:0] B_1__shared_input;
reg [0:0] B_2__shared_input;
reg [0:0] B_3__shared_input;
wire [3:0] A_shared_input = {A_3__shared_input,
A_2__shared_input,
A_1__shared_input,
A_0__shared_input};
wire [3:0] B_shared_input = {B_3__shared_input,
B_2__shared_input,
B_1__shared_input,
B_0__shared_input};
// ----- FPGA fabric outputs -------
wire [0:0] Y_0__fpga;
wire [0:0] Y_1__fpga;
wire [0:0] Y_2__fpga;
wire [0:0] Y_3__fpga;
wire [0:0] Y_4__fpga;
wire [0:0] Y_5__fpga;
wire [0:0] Y_6__fpga;
wire [0:0] Y_7__fpga;
wire [7:0] Y_fpga = {Y_7__fpga,
Y_6__fpga,
Y_5__fpga,
Y_4__fpga,
Y_3__fpga,
Y_2__fpga,
Y_1__fpga,
Y_0__fpga};
// ----- Benchmark outputs -------
wire [0:0] Y_0__benchmark;
wire [0:0] Y_1__benchmark;
wire [0:0] Y_2__benchmark;
wire [0:0] Y_3__benchmark;
wire [0:0] Y_4__benchmark;
wire [0:0] Y_5__benchmark;
wire [0:0] Y_6__benchmark;
wire [0:0] Y_7__benchmark;
wire [7:0] Y_benchmark = {Y_7__benchmark,
Y_6__benchmark,
Y_5__benchmark,
Y_4__benchmark,
Y_3__benchmark,
Y_2__benchmark,
Y_1__benchmark,
Y_0__benchmark};
// ----- Output vectors checking flags -------
reg [0:0] Y_0__flag;
reg [0:0] Y_1__flag;
reg [0:0] Y_2__flag;
reg [0:0] Y_3__flag;
reg [0:0] Y_4__flag;
reg [0:0] Y_5__flag;
reg [0:0] Y_6__flag;
reg [0:0] Y_7__flag;
// ----- Error counter: Deposit an error for config_done signal is not raised at the beginning -----
integer nb_error= 1;
// ----- Number of clock cycles in configuration phase: 8417 -----
// ----- Begin configuration done signal generation -----
initial
begin
__config_done__[0] = 1'b0;
end
// ----- End configuration done signal generation -----
// ----- Begin raw programming clock signal generation -----
initial
begin
__prog_clock___reg__[0] = 1'b0;
end
always
begin
#5 __prog_clock___reg__[0] = ~__prog_clock___reg__[0];
end
// ----- End raw programming clock signal generation -----
// ----- Actual programming clock is triggered only when __config_done__ and __prog_reset__ are disabled -----
assign __prog_clock__[0] = __prog_clock___reg__[0] & (~__config_done__[0]) & (~__prog_reset__[0]);
assign __config_all_done__[0] = __config_done__[0];
// ----- Begin raw operating clock signal generation -----
initial
begin
__op_clock___reg__[0] = 1'b0;
end
always wait(~__greset__)
begin
#1.761053801 __op_clock___reg__[0] = ~__op_clock___reg__[0];
end
// ----- End raw operating clock signal generation -----
// ----- Actual operating clock is triggered only when __config_all_done__ is enabled -----
assign __op_clock__[0] = __op_clock___reg__[0] & __config_all_done__[0];
// ----- Begin programming reset signal generation -----
initial
begin
__prog_reset__[0] = 1'b1;
#10 __prog_reset__[0] = 1'b0;
end
// ----- End programming reset signal generation -----
// ----- Begin programming set signal generation -----
initial
begin
__prog_set_[0] = 1'b1;
#10 __prog_set_[0] = 1'b0;
end
// ----- End programming set signal generation -----
// ----- Begin operating reset signal generation -----
// ----- Reset signal is enabled until the first clock cycle in operation phase -----
initial
begin
__greset__[0] = 1'b1;
wait(__config_all_done__)
#3.522107601 __greset__[0] = 1'b1;
#7.044215202 __greset__[0] = 1'b0;
end
// ----- End operating reset signal generation -----
// ----- Begin operating set signal generation: always disabled -----
initial
begin
__gset__[0] = 1'b0;
end
// ----- End operating set signal generation: always disabled -----
// ----- Begin connecting global ports of FPGA fabric to stimuli -----
assign clk[0] = __op_clock__[0];
assign prog_clk[0] = __prog_clock__[0];
assign reset[0] = __greset__[0];
assign pReset[0] = __prog_reset__[0];
assign set[0] = __gset__[0];
// ----- End connecting global ports of FPGA fabric to stimuli -----
// ----- FPGA top-level module to be capsulated -----
fpga_top FPGA_DUT (
.pReset(pReset[0]),
.prog_clk(prog_clk[0]),
.set(set[0]),
.reset(reset[0]),
.clk(clk[0]),
.gfpga_pad_GPIO_PAD(gfpga_pad_GPIO_PAD[0:63]),
.ccff_head(ccff_head[0]),
.ccff_tail(ccff_tail[0]));
// ----- Link BLIF Benchmark I/Os to FPGA I/Os -----
// ----- Blif Benchmark input A_0_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[12] -----
assign gfpga_pad_GPIO_PAD[12] = A_0__shared_input[0];
// ----- Blif Benchmark input A_1_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[9] -----
assign gfpga_pad_GPIO_PAD[9] = A_1__shared_input[0];
// ----- Blif Benchmark input A_2_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[32] -----
assign gfpga_pad_GPIO_PAD[32] = A_2__shared_input[0];
// ----- Blif Benchmark input A_3_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[34] -----
assign gfpga_pad_GPIO_PAD[34] = A_3__shared_input[0];
// ----- Blif Benchmark input B_0_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[39] -----
assign gfpga_pad_GPIO_PAD[39] = B_0__shared_input[0];
// ----- Blif Benchmark input B_1_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[36] -----
assign gfpga_pad_GPIO_PAD[36] = B_1__shared_input[0];
// ----- Blif Benchmark input B_2_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[11] -----
assign gfpga_pad_GPIO_PAD[11] = B_2__shared_input[0];
// ----- Blif Benchmark input B_3_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[38] -----
assign gfpga_pad_GPIO_PAD[38] = B_3__shared_input[0];
// ----- Blif Benchmark output Y_0_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[37] -----
assign Y_0__fpga[0] = gfpga_pad_GPIO_PAD[37];
// ----- Blif Benchmark output Y_1_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[19] -----
assign Y_1__fpga[0] = gfpga_pad_GPIO_PAD[19];
// ----- Blif Benchmark output Y_2_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[27] -----
assign Y_2__fpga[0] = gfpga_pad_GPIO_PAD[27];
// ----- Blif Benchmark output Y_3_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[35] -----
assign Y_3__fpga[0] = gfpga_pad_GPIO_PAD[35];
// ----- Blif Benchmark output Y_4_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[33] -----
assign Y_4__fpga[0] = gfpga_pad_GPIO_PAD[33];
// ----- Blif Benchmark output Y_5_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[8] -----
assign Y_5__fpga[0] = gfpga_pad_GPIO_PAD[8];
// ----- Blif Benchmark output Y_6_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[14] -----
assign Y_6__fpga[0] = gfpga_pad_GPIO_PAD[14];
// ----- Blif Benchmark output Y_7_ is mapped to FPGA IOPAD gfpga_pad_GPIO_PAD[29] -----
assign Y_7__fpga[0] = gfpga_pad_GPIO_PAD[29];
// ----- Wire unused FPGA I/Os to constants -----
assign gfpga_pad_GPIO_PAD[0] = 1'b0;
assign gfpga_pad_GPIO_PAD[1] = 1'b0;
assign gfpga_pad_GPIO_PAD[2] = 1'b0;
assign gfpga_pad_GPIO_PAD[3] = 1'b0;
assign gfpga_pad_GPIO_PAD[4] = 1'b0;
assign gfpga_pad_GPIO_PAD[5] = 1'b0;
assign gfpga_pad_GPIO_PAD[6] = 1'b0;
assign gfpga_pad_GPIO_PAD[7] = 1'b0;
assign gfpga_pad_GPIO_PAD[10] = 1'b0;
assign gfpga_pad_GPIO_PAD[13] = 1'b0;
assign gfpga_pad_GPIO_PAD[15] = 1'b0;
assign gfpga_pad_GPIO_PAD[16] = 1'b0;
assign gfpga_pad_GPIO_PAD[17] = 1'b0;
assign gfpga_pad_GPIO_PAD[18] = 1'b0;
assign gfpga_pad_GPIO_PAD[20] = 1'b0;
assign gfpga_pad_GPIO_PAD[21] = 1'b0;
assign gfpga_pad_GPIO_PAD[22] = 1'b0;
assign gfpga_pad_GPIO_PAD[23] = 1'b0;
assign gfpga_pad_GPIO_PAD[24] = 1'b0;
assign gfpga_pad_GPIO_PAD[25] = 1'b0;
assign gfpga_pad_GPIO_PAD[26] = 1'b0;
assign gfpga_pad_GPIO_PAD[28] = 1'b0;
assign gfpga_pad_GPIO_PAD[30] = 1'b0;
assign gfpga_pad_GPIO_PAD[31] = 1'b0;
assign gfpga_pad_GPIO_PAD[40] = 1'b0;
assign gfpga_pad_GPIO_PAD[41] = 1'b0;
assign gfpga_pad_GPIO_PAD[42] = 1'b0;
assign gfpga_pad_GPIO_PAD[43] = 1'b0;
assign gfpga_pad_GPIO_PAD[44] = 1'b0;
assign gfpga_pad_GPIO_PAD[45] = 1'b0;
assign gfpga_pad_GPIO_PAD[46] = 1'b0;
assign gfpga_pad_GPIO_PAD[47] = 1'b0;
assign gfpga_pad_GPIO_PAD[48] = 1'b0;
assign gfpga_pad_GPIO_PAD[49] = 1'b0;
assign gfpga_pad_GPIO_PAD[50] = 1'b0;
assign gfpga_pad_GPIO_PAD[51] = 1'b0;
assign gfpga_pad_GPIO_PAD[52] = 1'b0;
assign gfpga_pad_GPIO_PAD[53] = 1'b0;
assign gfpga_pad_GPIO_PAD[54] = 1'b0;
assign gfpga_pad_GPIO_PAD[55] = 1'b0;
assign gfpga_pad_GPIO_PAD[56] = 1'b0;
assign gfpga_pad_GPIO_PAD[57] = 1'b0;
assign gfpga_pad_GPIO_PAD[58] = 1'b0;
assign gfpga_pad_GPIO_PAD[59] = 1'b0;
assign gfpga_pad_GPIO_PAD[60] = 1'b0;
assign gfpga_pad_GPIO_PAD[61] = 1'b0;
assign gfpga_pad_GPIO_PAD[62] = 1'b0;
assign gfpga_pad_GPIO_PAD[63] = 1'b0;
// ----- Reference Benchmark Instanication -------
mult4 REF_DUT(
.A(A_shared_input),
.B(B_shared_input),
.Y(Y_benchmark)
);
// ----- End reference Benchmark Instanication -------
// ----- Begin bitstream loading during configuration phase -----
`define BITSTREAM_LENGTH 8416
`define BITSTREAM_WIDTH 1
// ----- Virtual memory to store the bitstream from external file -----
reg [0:`BITSTREAM_WIDTH - 1] bit_mem[0:`BITSTREAM_LENGTH - 1];
reg [$clog2(`BITSTREAM_LENGTH):0] bit_index;
// ----- Registers used for fast configuration logic -----
reg [$clog2(`BITSTREAM_LENGTH):0] ibit;
reg [0:0] skip_bits;
// ----- Preload bitstream file to a virtual memory -----
initial begin
$readmemb("fabric_bitstream.bit", bit_mem);
// ----- Configuration chain default input -----
ccff_head[0] <= 1'b0;
bit_index <= 0;
skip_bits[0] <= 1'b0;
for (ibit = 0; ibit < `BITSTREAM_LENGTH + 1; ibit = ibit + 1) begin
if (1'b0 == bit_mem[ibit]) begin
if (1'b1 == skip_bits[0]) begin
bit_index <= bit_index + 1;
end
end else begin
skip_bits[0] <= 1'b0;
end
end
end
// ----- 'else if' condition is required by Modelsim to synthesis the Verilog correctly -----
always @(negedge __prog_clock___reg__[0]) begin
if (bit_index >= `BITSTREAM_LENGTH) begin
__config_done__[0] <= 1'b1;
end else if (bit_index >= 0 && bit_index < `BITSTREAM_LENGTH) begin
ccff_head[0] <= bit_mem[bit_index];
bit_index <= bit_index + 1;
end
end
// ----- End bitstream loading during configuration phase -----
// ----- Begin reset signal generation -----
// ----- Input Initialization -------
initial begin
A_0__shared_input <= 1'b0;
A_1__shared_input <= 1'b0;
A_2__shared_input <= 1'b0;
A_3__shared_input <= 1'b0;
B_0__shared_input <= 1'b0;
B_1__shared_input <= 1'b0;
B_2__shared_input <= 1'b0;
B_3__shared_input <= 1'b0;
Y_0__flag[0] <= 1'b0;
Y_1__flag[0] <= 1'b0;
Y_2__flag[0] <= 1'b0;
Y_3__flag[0] <= 1'b0;
Y_4__flag[0] <= 1'b0;
Y_5__flag[0] <= 1'b0;
Y_6__flag[0] <= 1'b0;
Y_7__flag[0] <= 1'b0;
end
// ----- Input Stimulus -------
always@(negedge __op_clock__[0]) begin
A_0__shared_input <= $random;
A_1__shared_input <= $random;
A_2__shared_input <= $random;
A_3__shared_input <= $random;
B_0__shared_input <= $random;
B_1__shared_input <= $random;
B_2__shared_input <= $random;
B_3__shared_input <= $random;
end
// ----- Begin checking output vectors -------
// ----- Skip the first falling edge of clock, it is for initialization -------
reg [0:0] sim_start;
always@(negedge __op_clock__[0]) begin
if (1'b1 == sim_start[0]) begin
sim_start[0] <= ~sim_start[0];
end else
if (1'b1 == __config_all_done__) begin
if(!(Y_0__fpga === Y_0__benchmark) && !(Y_0__benchmark === 1'bx)) begin
Y_0__flag <= 1'b1;
end else begin
Y_0__flag<= 1'b0;
end
if(!(Y_1__fpga === Y_1__benchmark) && !(Y_1__benchmark === 1'bx)) begin
Y_1__flag <= 1'b1;
end else begin
Y_1__flag<= 1'b0;
end
if(!(Y_2__fpga === Y_2__benchmark) && !(Y_2__benchmark === 1'bx)) begin
Y_2__flag <= 1'b1;
end else begin
Y_2__flag<= 1'b0;
end
if(!(Y_3__fpga === Y_3__benchmark) && !(Y_3__benchmark === 1'bx)) begin
Y_3__flag <= 1'b1;
end else begin
Y_3__flag<= 1'b0;
end
if(!(Y_4__fpga === Y_4__benchmark) && !(Y_4__benchmark === 1'bx)) begin
Y_4__flag <= 1'b1;
end else begin
Y_4__flag<= 1'b0;
end
if(!(Y_5__fpga === Y_5__benchmark) && !(Y_5__benchmark === 1'bx)) begin
Y_5__flag <= 1'b1;
end else begin
Y_5__flag<= 1'b0;
end
if(!(Y_6__fpga === Y_6__benchmark) && !(Y_6__benchmark === 1'bx)) begin
Y_6__flag <= 1'b1;
end else begin
Y_6__flag<= 1'b0;
end
if(!(Y_7__fpga === Y_7__benchmark) && !(Y_7__benchmark === 1'bx)) begin
Y_7__flag <= 1'b1;
end else begin
Y_7__flag<= 1'b0;
end
end
end
always@(posedge Y_0__flag) begin
if(Y_0__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_0__fpga at time = %t", $realtime);
end
end
always@(posedge Y_1__flag) begin
if(Y_1__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_1__fpga at time = %t", $realtime);
end
end
always@(posedge Y_2__flag) begin
if(Y_2__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_2__fpga at time = %t", $realtime);
end
end
always@(posedge Y_3__flag) begin
if(Y_3__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_3__fpga at time = %t", $realtime);
end
end
always@(posedge Y_4__flag) begin
if(Y_4__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_4__fpga at time = %t", $realtime);
end
end
always@(posedge Y_5__flag) begin
if(Y_5__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_5__fpga at time = %t", $realtime);
end
end
always@(posedge Y_6__flag) begin
if(Y_6__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_6__fpga at time = %t", $realtime);
end
end
always@(posedge Y_7__flag) begin
if(Y_7__flag) begin
nb_error = nb_error + 1;
$display("Mismatch on Y_7__fpga at time = %t", $realtime);
end
end
// ----- Configuration done must be raised in the end -------
always@(posedge __config_all_done__[0]) begin
nb_error = nb_error - 1;
end
// ----- Begin output waveform to VCD file-------
initial begin
$dumpfile("mult4_formal.vcd");
$dumpvars(1, mult4_autocheck_top_tb);
end
// ----- END output waveform to VCD file -------
initial begin
sim_start[0] <= 1'b1;
$timeformat(-9, 2, "ns", 20);
$display("Simulation start");
// ----- Can be changed by the user for his/her need -------
#84240
if(nb_error == 0) begin
$display("Simulation Succeed");
end else begin
$display("Simulation Failed with %d error(s)", nb_error);
end
$finish;
end
endmodule
// ----- END Verilog module for mult4_autocheck_top_tb -----
//----- Default net type -----
`default_nettype wire
Describe the bug
When implementing a 4-bit multiplier circuit on an FPGA fabric generated using OpenFPGA and running a simulation, the simulation fails. The same implementation works correctly for 2-bit and 3-bit multiplier circuits, and no issues were observed in those cases.
To Reproduce
Steps to reproduce the behavior:
Clone OpenFPGA repository and checkout current master
commit id:
55c2ccf50798645694204434936c38f86b14611bChange or add some files relevant to
generate_fabrictaskDetails
mult4Details
Execute OpenFPGA task or your own example:
python openfpga_flow/scripts/run_fpga_task.py basic_tests/generate_fabricFix generated verilog files in SRC directory
noneis replaced withwireDetails
Expected behavior
Simulation Succeeds
Screenshots

Simulation via Vivado 2024.1
Ubuntu 22.04.5 LTS