Skip to content

Commit

Permalink
[rtl] pmp: minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Jul 5, 2024
1 parent d1e677a commit a2663ba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rtl/core/neorv32_cpu_pmp.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- NEORV32 CPU - Physical Memory Protection Unit (RISC-V "Smpmp" Extension) --
-- -------------------------------------------------------------------------------- --
-- Compatible to the RISC-V PMP privilege architecture specifications. Granularity --
-- and supported modes can be constrained via generics to reduce area consumption. --
-- and supported modes can be constrained via generics to reduce area requirements. --
-- -------------------------------------------------------------------------------- --
-- The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 --
-- Copyright (c) NEORV32 contributors. --
Expand Down Expand Up @@ -141,12 +141,12 @@ begin
elsif rising_edge(clk_i) then

-- configuration --
if (csr.we_cfg(i/4) = '1') and (csr.cfg(i)(7) = '0') then -- unlocked write access
csr.cfg(i)(cfg_r_c) <= csr_wdata_i((i mod 4)*8+0); -- R (read)
csr.cfg(i)(cfg_w_c) <= csr_wdata_i((i mod 4)*8+1); -- W (write)
csr.cfg(i)(cfg_x_c) <= csr_wdata_i((i mod 4)*8+2); -- X (execute)
if (csr.we_cfg(i/4) = '1') and (csr.cfg(i)(cfg_l_c) = '0') then -- unlocked write access
csr.cfg(i)(cfg_r_c) <= csr_wdata_i((i mod 4)*8+cfg_r_c); -- R (read)
csr.cfg(i)(cfg_w_c) <= csr_wdata_i((i mod 4)*8+cfg_w_c); -- W (write)
csr.cfg(i)(cfg_x_c) <= csr_wdata_i((i mod 4)*8+cfg_x_c); -- X (execute)
-- A (mode) --
mode_v := csr_wdata_i((i mod 4)*8+4 downto (i mod 4)*8+3);
mode_v := csr_wdata_i((i mod 4)*8+cfg_ah_c downto (i mod 4)*8+cfg_al_c);
if ((mode_v = mode_tor_c) and (not TOR_EN)) or -- TOR mode not implemented
((mode_v = mode_na4_c) and (not NAP_EN)) or -- NA4 mode not implemented
((mode_v = mode_napot_c) and (not NAP_EN)) or -- NAPOT mode not implemented
Expand All @@ -158,7 +158,7 @@ begin
--
csr.cfg(i)(cfg_rl_c) <= '0'; -- reserved
csr.cfg(i)(cfg_rh_c) <= '0'; -- reserved
csr.cfg(i)(cfg_l_c) <= csr_wdata_i((i mod 4)*8+7); -- L (locked)
csr.cfg(i)(cfg_l_c) <= csr_wdata_i((i mod 4)*8+cfg_l_c); -- L (locked)
end if;

-- address --
Expand Down

0 comments on commit a2663ba

Please sign in to comment.