Skip to content
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

Implemented DM_REGION #768

Merged

Conversation

silabs-oysteink
Copy link
Contributor

No description provided.

Accesses to the DM_REGION while in debug mode gets the following attriutes:
- main = 1
- bufferable = 0
- cacheable = 0
- no atomics allowed
- no integrity

Signed-off-by: Oystein Knauserud <[email protected]>
Signed-off-by: Oystein Knauserud <[email protected]>
@silabs-oysteink silabs-oysteink added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label Jan 24, 2023
parameter bit A_EXT = 0,
parameter int PMA_NUM_REGIONS = 0,
parameter pma_cfg_t PMA_CFG[PMA_NUM_REGIONS-1:0] = '{default:PMA_R_DEFAULT}
)
(
input logic [31:0] trans_addr_i,
input logic trans_debug_region_i, // Transaction address is inside the debug redion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redion -> region

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -55,6 +65,13 @@ module cv32e40x_pma import cv32e40x_pkg::*;
// PMA is deconfigured
assign pma_cfg = NO_PMA_R_DEFAULT;

always_comb begin
// When core is in debug mode, use PMA_DBG as attributes for the DM range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When core is in debug mode, -> Debug mode transactions within the Debug Module region

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

always_comb begin
// When core is in debug mode, use PMA_DBG as attributes for the DM range
if (trans_debug_region_i) begin
pma_cfg = PMA_DBG;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple assignment together with line 66

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

(word_addr[31:PMA_ADDR_LSB] < PMA_CFG[i].word_addr_high[31:PMA_ADDR_LSB])) begin
pma_cfg = PMA_CFG[i];
end
end

// When core is in debug mode, use PMA_DBG as attributes for the DM range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When core is in debug mode, -> Debug mode transactions within the Debug Module region

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -216,7 +228,9 @@ module cv32e40x_mpu_sva import cv32e40x_pkg::*; import uvm_pkg::*;
always_comb begin
pma_expected_cfg = NO_PMA_R_DEFAULT;
if (PMA_NUM_REGIONS) begin
pma_expected_cfg = is_pma_matched ? PMA_CFG[pma_lowest_match] : PMA_R_DEFAULT;
pma_expected_cfg = is_pma_matched ? PMA_CFG[pma_lowest_match] :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug mode access within Debug Module region should be highest priority

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

(!is_addr_match && was_obi_waiting && $past(obi_req)) ||
// or we get an address match, but was already outputting the same address (no pma_err)
// but a change in debug mode causes the new transaction the same address to fail
(is_addr_match && was_obi_waiting && $past(obi_req) && (pma_dbg != obi_dbg)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"but a change in debug mode causes the new transaction the same address to fail" this comment does not seem to correspond to any logical requirement we have. Please make the check and comment more specific so that it corresponds to logical requirements (this just looks like a 'fix' to a failing assertion).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated assertion to be a bit stronger (!pma_dbg && obi_dbg) as discussed. The scenario may happen in the prefetcher when exiting debug mode while there are outstanding transactions waiting for instr_gnt_i.

Signed-off-by: Oystein Knauserud <[email protected]>
@Silabs-ArjanB Silabs-ArjanB merged commit 1fa496c into openhwgroup:master Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants