-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HW]: Add mem_multibanked_pwrgate for correct power management #246
base: master
Are you sure you want to change the base?
Conversation
b4fc6c8
to
44a66c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Lore0599, thank you for the contribution! I have one general question: would there be a point in generalising the module further? Specifically, I don't see the direct relevance of the deepsleep
and powergate
signals in the module implementation. They are "just" packed into the impl_i
ports of the tc_sram
s. Would it make sense to expose the impl_i
ports directly (instead of deepsleep_i
and powergate_i
) to make this module independent of the technology, perhaps even of the use case (power management), and pack them outside the module?
Other than that, I have added a couple of nitpicks inline. Furthermore, I would like to ask you the following:
- add the new testbench to .gitlab-ci.yml
- add a module description in the README.md
- add the new source files to common_cells.core
- fix the lint errors in the CI.
Thanks a lot!
src/mem_multibank_pwrgate.sv
Outdated
if (LogicBankSize != 2 ** (AddrWidth - BankSelWidth)) | ||
$fatal("Logic Bank size is not a power of two: UNSUPPORTED "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change this to an assert macro? See here for an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niwis, sorry for noticing this only now. I implemented the changes regarding ASSERTION
as you requested, and I tested them but I have the following concern.
When we use assertions, they are evaluated within an initial
block, meaning they are checked only after the system has been compiled and elaborated. This means that any issues with design parameters might not be detected immediately, allowing the simulation to start normally, which can then cause the testbench to fail later.
In contrast, IF
statements are evaluated at compile time. This means that, as soon as we build the system using vsim ...
, any parameter errors are immediately detected, causing the build to fail right away.
Given this, I believe it might be more effective to retain IF
statements for these types of checks.
Let me know whether I'm doing something wrong :)
src/mem_multibank_pwrgate.sv
Outdated
logic [NumLogicBanks-1:0][ NumPorts-1:0] req_cut; | ||
logic [NumLogicBanks-1:0][ NumPorts-1:0] we_cut; | ||
logic [NumLogicBanks-1:0][ NumPorts-1:0][AddrWidth-BankSelWidth-1:0] addr_cut; | ||
data_t [NumLogicBanks-1:0][ NumPorts-1:0] wdata_cut; | ||
be_t [NumLogicBanks-1:0][ NumPorts-1:0] be_cut; | ||
data_t [NumLogicBanks-1:0][ NumPorts-1:0] rdata_cut; | ||
|
||
// Signals to select the right bank | ||
logic [ NumPorts-1:0][BankSelWidth-1:0] bank_sel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the spaces before NumPorts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you fixed bank_sel
, but same for *_cut
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, it was an issue of my text editor.
Hi @niwis, thank you for your comments. I'll implement all of them ASAP. |
I see. Otherwise, perhaps you could add another wrapping layer that packs the signals locally? I'm just thinking that feeding through the implementation ports might increase the reusability of this module. |
@niwis Regarding the CI linting failure, the source of the error is the missing type specification for some parameters at the interface common_cells/src/mem_multibank_pwrgate.sv Line 28 in f374a5b
These parameters are of string type, and similarly, in the tc_sram module (https://github.com/pulp-platform/tech_cells_generic/blob/7968dd6e6180df2c644636bc6d2908a49f2190cf/src/rtl/tc_sram.sv#L62) their type is also unspecified.Would you prefer that I explicitly specify the type as string, or should we consider suppressing the linting error as done here? On this forum it appears that not specifying the string type can serve as a workaround for compatibility with tools like Vivado. Let me know :) |
if (NumLogicBanks == 32'd0) begin : gen_no_logic_bank | ||
$fatal("Error: %d logic banks are not supported", NumLogicBanks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I previously overlooked this. Can you also change this to an assertion macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. You can add a waiver for this line here: common_cells/lint/common_cells.style.waiver Lines 4 to 6 in 554ebbc
|
7a53b12
to
766fa7c
Compare
- [Lint]: Waive linting check on string datat type declaration - [HW]: Re-introduce IF to check design parameters
b24caf3
to
aee15a3
Compare
Power Gated MutliBanked Memory
This PR introduces the
mem_multibank_pwrgate.sv
module.Goal
When designing power-aware systems, memory macro cells often include control signals dedicated to powering down/up the bank and entering retention mode. Additionally, when each bank in the memory is made of different cuts, the power control signals must be properly managed to maintain the memory’s interleaved addressing scheme..
Addition:
mem_multibank_pwrgate.sv
: In a memory system with multiple banks and applied power strategies, each bank must be correctly managed to avoid disruptions in memory interleaving. For memories with multiple cuts and interleaved banks, it is important to ensure that power signals do not disrupt the internal bank interleaving. This module is responsible for correctly addressing each internal bank and connecting the appropriate power control signals.mem_multibank_pwrgate_tb.sv
: A testbench to verify the correct addressing functionality of the implemented module.