Skip to content

Commit

Permalink
[TB]: Add more testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lore0599 committed Oct 28, 2024
1 parent 9889e5a commit 44a66c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
27 changes: 14 additions & 13 deletions src/mem_multibank_pwrgate.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
// This module is responsible for managing the correct memory addressing
//
module mem_multibank_pwrgate #(
parameter int unsigned NumWords = 32'd1024, // Number of Words in data array
parameter int unsigned DataWidth = 32'd128, // Data signal width
parameter int unsigned ByteWidth = 32'd8, // Width of a data byte
parameter int unsigned NumPorts = 32'd2, // Number of read and write ports
parameter int unsigned Latency = 32'd1, // Latency when the read data is available
parameter int unsigned NumLogicBanks = 32'd1, // Logic bank for Power Management
parameter SimInit = "none", // Simulation initialization
parameter bit PrintSimCfg = 1'b0, // Print configuration
parameter ImplKey = "none", // Reference to specific implementation
parameter int unsigned NumWords = 32'd1024, // Number of Words in data array
parameter int unsigned DataWidth = 32'd128, // Data signal width
parameter int unsigned ByteWidth = 32'd8, // Width of a data byte
parameter int unsigned NumPorts = 32'd2, // Number of read and write ports
parameter int unsigned Latency = 32'd1, // Latency when the read data is available
parameter int unsigned NumLogicBanks = 32'd1, // Logic bank for Power Management
parameter SimInit = "none", // Simulation initialization

Check warning on line 28 in src/mem_multibank_pwrgate.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] src/mem_multibank_pwrgate.sv#L28

Explicitly define a storage type for every parameter and localparam, (SimInit). [Style: constants] [explicit-parameter-storage-type]
Raw output
message:"Explicitly define a storage type for every parameter and localparam, (SimInit). [Style: constants] [explicit-parameter-storage-type]"  location:{path:"./src/mem_multibank_pwrgate.sv"  range:{start:{line:28  column:28}}}  severity:WARNING  source:{name:"verible-verilog-lint"  url:"https://github.com/chipsalliance/verible"}
parameter bit PrintSimCfg = 1'b0, // Print configuration
parameter ImplKey = "none", // Reference to specific implementation

Check warning on line 30 in src/mem_multibank_pwrgate.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] src/mem_multibank_pwrgate.sv#L30

Explicitly define a storage type for every parameter and localparam, (ImplKey). [Style: constants] [explicit-parameter-storage-type]
Raw output
message:"Explicitly define a storage type for every parameter and localparam, (ImplKey). [Style: constants] [explicit-parameter-storage-type]"  location:{path:"./src/mem_multibank_pwrgate.sv"  range:{start:{line:30  column:28}}}  severity:WARNING  source:{name:"verible-verilog-lint"  url:"https://github.com/chipsalliance/verible"}
// DEPENDENT PARAMETERS, DO NOT OVERWRITE!
parameter int unsigned AddrWidth = (NumWords > 32'd1) ? $clog2(NumWords) : 32'd1,
parameter int unsigned BeWidth = (DataWidth + ByteWidth - 32'd1) / ByteWidth, // ceil_div
Expand Down Expand Up @@ -132,10 +132,10 @@ module mem_multibank_pwrgate #(
always_ff @(posedge clk_i or negedge rst_ni) begin
for (int PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin
if (!rst_ni) begin
out_mux_sel_q[PortIdx] = '0;
out_mux_sel_q[PortIdx] <= '0;
end else begin
for (int shift_idx = 0; shift_idx < Latency; shift_idx++) begin
out_mux_sel_q[PortIdx][shift_idx] = out_mux_sel_d[PortIdx][shift_idx];
out_mux_sel_q[PortIdx][shift_idx] <= out_mux_sel_d[PortIdx][shift_idx];
end
end
end
Expand All @@ -145,12 +145,13 @@ module mem_multibank_pwrgate #(
// Write data Mux Logic
//
for (genvar BankIdx = 0; BankIdx < NumLogicBanks; BankIdx++) begin : gen_logic_bank
for (genvar PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin
for (genvar PortIdx = 0; PortIdx < NumPorts; PortIdx++) begin: gen_port_write_logic
// DEMUX the input signals to the correct logic bank
// Assign req channel to the correct logic bank
assign req_cut[BankIdx][PortIdx] = req_i[PortIdx] && (bank_sel[PortIdx] == BankIdx);
// Assign lowest part of the address to the correct logic bank
assign addr_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? addr_i[PortIdx][AddrWidth-BankSelWidth-1:0] : '0;
assign addr_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ?
addr_i[PortIdx][AddrWidth-BankSelWidth-1:0] : '0;
// Assign data to the correct logic bank
assign wdata_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? wdata_i[PortIdx] : '0;
assign we_cut[BankIdx][PortIdx] = req_cut[BankIdx][PortIdx] ? we_i[PortIdx] : '0;
Expand Down
10 changes: 5 additions & 5 deletions test/simulate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ call_vsim() {
grep "Errors: 0," vsim.log
}

for PORTS in 1 ; do
for LATENCY in 1 ; do
for WORDS in 1024; do
for DWIDTH in 64; do
for BYTEWIDTH in 9; do
for PORTS in 1 2; do
for LATENCY in 0 1 2; do
for WORDS in 16 256 512 1024; do
for DWIDTH in 1 42 64; do
for BYTEWIDTH in 1 8 9; do
for BANKS in 1 2 4 8; do
call_vsim mem_multibank_pwrgate_tb -gNumPorts=$PORTS -gLatency=$LATENCY -gNumWords=$WORDS -gDataWidth=$DWIDTH -gByteWidth=$BYTEWIDTH -gNumLogicBanks=$BANKS
done
Expand Down

0 comments on commit 44a66c7

Please sign in to comment.