Skip to content

Commit 44a66c7

Browse files
committed
[TB]: Add more testing
1 parent 9889e5a commit 44a66c7

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/mem_multibank_pwrgate.sv

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
// This module is responsible for managing the correct memory addressing
2020
//
2121
module mem_multibank_pwrgate #(
22-
parameter int unsigned NumWords = 32'd1024, // Number of Words in data array
23-
parameter int unsigned DataWidth = 32'd128, // Data signal width
24-
parameter int unsigned ByteWidth = 32'd8, // Width of a data byte
25-
parameter int unsigned NumPorts = 32'd2, // Number of read and write ports
26-
parameter int unsigned Latency = 32'd1, // Latency when the read data is available
27-
parameter int unsigned NumLogicBanks = 32'd1, // Logic bank for Power Management
28-
parameter SimInit = "none", // Simulation initialization
29-
parameter bit PrintSimCfg = 1'b0, // Print configuration
30-
parameter ImplKey = "none", // Reference to specific implementation
22+
parameter int unsigned NumWords = 32'd1024, // Number of Words in data array
23+
parameter int unsigned DataWidth = 32'd128, // Data signal width
24+
parameter int unsigned ByteWidth = 32'd8, // Width of a data byte
25+
parameter int unsigned NumPorts = 32'd2, // Number of read and write ports
26+
parameter int unsigned Latency = 32'd1, // Latency when the read data is available
27+
parameter int unsigned NumLogicBanks = 32'd1, // Logic bank for Power Management
28+
parameter SimInit = "none", // Simulation initialization
29+
parameter bit PrintSimCfg = 1'b0, // Print configuration
30+
parameter ImplKey = "none", // Reference to specific implementation
3131
// DEPENDENT PARAMETERS, DO NOT OVERWRITE!
3232
parameter int unsigned AddrWidth = (NumWords > 32'd1) ? $clog2(NumWords) : 32'd1,
3333
parameter int unsigned BeWidth = (DataWidth + ByteWidth - 32'd1) / ByteWidth, // ceil_div
@@ -132,10 +132,10 @@ module mem_multibank_pwrgate #(
132132
always_ff @(posedge clk_i or negedge rst_ni) begin
133133
for (int PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin
134134
if (!rst_ni) begin
135-
out_mux_sel_q[PortIdx] = '0;
135+
out_mux_sel_q[PortIdx] <= '0;
136136
end else begin
137137
for (int shift_idx = 0; shift_idx < Latency; shift_idx++) begin
138-
out_mux_sel_q[PortIdx][shift_idx] = out_mux_sel_d[PortIdx][shift_idx];
138+
out_mux_sel_q[PortIdx][shift_idx] <= out_mux_sel_d[PortIdx][shift_idx];
139139
end
140140
end
141141
end
@@ -145,12 +145,13 @@ module mem_multibank_pwrgate #(
145145
// Write data Mux Logic
146146
//
147147
for (genvar BankIdx = 0; BankIdx < NumLogicBanks; BankIdx++) begin : gen_logic_bank
148-
for (genvar PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin
148+
for (genvar PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin: gen_port_write_logic
149149
// DEMUX the input signals to the correct logic bank
150150
// Assign req channel to the correct logic bank
151151
assign req_cut[BankIdx][PortIdx] = req_i[PortIdx] && (bank_sel[PortIdx] == BankIdx);
152152
// Assign lowest part of the address to the correct logic bank
153-
assign addr_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? addr_i[PortIdx][AddrWidth-BankSelWidth-1:0] : '0;
153+
assign addr_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ?
154+
addr_i[PortIdx][AddrWidth-BankSelWidth-1:0] : '0;
154155
// Assign data to the correct logic bank
155156
assign wdata_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? wdata_i[PortIdx] : '0;
156157
assign we_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? we_i[PortIdx] : '0;

test/simulate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ call_vsim() {
2323
grep "Errors: 0," vsim.log
2424
}
2525

26-
for PORTS in 1 ; do
27-
for LATENCY in 1 ; do
28-
for WORDS in 1024; do
29-
for DWIDTH in 64; do
30-
for BYTEWIDTH in 9; do
26+
for PORTS in 1 2; do
27+
for LATENCY in 0 1 2; do
28+
for WORDS in 16 256 512 1024; do
29+
for DWIDTH in 1 42 64; do
30+
for BYTEWIDTH in 1 8 9; do
3131
for BANKS in 1 2 4 8; do
3232
call_vsim mem_multibank_pwrgate_tb -gNumPorts=$PORTS -gLatency=$LATENCY -gNumWords=$WORDS -gDataWidth=$DWIDTH -gByteWidth=$BYTEWIDTH -gNumLogicBanks=$BANKS
3333
done

0 commit comments

Comments
 (0)