-
Notifications
You must be signed in to change notification settings - Fork 52
Implemented DM_REGION #768
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// Copyright 2021 Silicon Labs, Inc. | ||
// | ||
// | ||
// This file, and derivatives thereof are licensed under the | ||
// Solderpad License, Version 2.0 (the "License"); | ||
// Use of this file means you agree to the terms and conditions | ||
// of the license and are in full compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// | ||
// https://solderpad.org/licenses/SHL-2.0/ | ||
// | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// and hardware implementations thereof | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
|
@@ -24,13 +24,14 @@ | |
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
module cv32e40x_pma import cv32e40x_pkg::*; | ||
#( | ||
#( | ||
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 | ||
input logic instr_fetch_access_i, // Indicate that ongoing access is an instruction fetch | ||
input logic atomic_access_i, // Indicate that ongoing access is atomic | ||
input logic misaligned_access_i, // Indicate that ongoing access is part of a misaligned access | ||
|
@@ -39,9 +40,18 @@ module cv32e40x_pma import cv32e40x_pkg::*; | |
output logic pma_bufferable_o, | ||
output logic pma_cacheable_o | ||
); | ||
|
||
parameter PMA_ADDR_LSB = 0; // TODO:OE experiment and see if this makes a difference | ||
|
||
|
||
// Attributes for accessing the DM (DM_REGION_START:DM_REGION_END) in debug mode | ||
localparam pma_cfg_t PMA_DBG = '{word_addr_low : '0, // not used | ||
word_addr_high : '0, // not used | ||
main : 1'b1, | ||
bufferable : 1'b0, | ||
cacheable : 1'b0, | ||
atomic : 1'b0}; | ||
|
||
|
||
pma_cfg_t pma_cfg; | ||
logic [31:0] word_addr; | ||
logic pma_cfg_atomic; | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
if (trans_debug_region_i) begin | ||
pma_cfg = PMA_DBG; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multiple assignment together with line 66 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
end | ||
end | ||
|
||
end | ||
else begin: pma | ||
|
||
|
@@ -65,11 +82,16 @@ module cv32e40x_pma import cv32e40x_pkg::*; | |
pma_cfg = PMA_R_DEFAULT; | ||
|
||
for(int i = PMA_NUM_REGIONS-1; i >= 0; i--) begin | ||
if((word_addr[31:PMA_ADDR_LSB] >= PMA_CFG[i].word_addr_low[31:PMA_ADDR_LSB]) && | ||
if((word_addr[31:PMA_ADDR_LSB] >= PMA_CFG[i].word_addr_low[31:PMA_ADDR_LSB]) && | ||
(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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
if (trans_debug_region_i) begin | ||
pma_cfg = PMA_DBG; | ||
end | ||
end | ||
end | ||
|
||
|
@@ -84,10 +106,10 @@ module cv32e40x_pma import cv32e40x_pkg::*; | |
assign pma_cfg_atomic = 1'b0; | ||
end | ||
endgenerate | ||
|
||
// Check transaction based on PMA region config | ||
always_comb begin | ||
|
||
pma_err_o = 1'b0; | ||
|
||
// Check for atomic access | ||
|
@@ -110,5 +132,5 @@ module cv32e40x_pma import cv32e40x_pkg::*; | |
// Instruction fetches, atomic operations and loads are never classified as bufferable | ||
assign pma_bufferable_o = pma_cfg.bufferable && !instr_fetch_access_i && !atomic_access_i && !load_access_i; | ||
assign pma_cacheable_o = pma_cfg.cacheable; | ||
|
||
endmodule |
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.
redion -> region
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.
Fixed