Line 177... |
Line 177... |
assert not (PMP_NUM_REGIONS > pmp_num_regions_critical_c) report "NEORV32 CPU CONFIG WARNING! Number of implemented PMP regions (PMP_NUM_REGIONS = " & integer'image(PMP_NUM_REGIONS) & ") beyond critical limit (pmp_num_regions_critical_c = " & integer'image(pmp_num_regions_critical_c) & "). Inserting another register stage (that will increase memory latency by +1 cycle)." severity warning;
|
assert not (PMP_NUM_REGIONS > pmp_num_regions_critical_c) report "NEORV32 CPU CONFIG WARNING! Number of implemented PMP regions (PMP_NUM_REGIONS = " & integer'image(PMP_NUM_REGIONS) & ") beyond critical limit (pmp_num_regions_critical_c = " & integer'image(pmp_num_regions_critical_c) & "). Inserting another register stage (that will increase memory latency by +1 cycle)." severity warning;
|
|
|
|
|
-- Data Interface: Access Address ---------------------------------------------------------
|
-- Data Interface: Access Address ---------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
mem_adr_reg: process(clk_i)
|
mem_adr_reg: process(rstn_i, clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if (rstn_i = '0') then
|
|
mar <= (others => def_rst_val_c);
|
|
elsif rising_edge(clk_i) then
|
if (ctrl_i(ctrl_bus_mo_we_c) = '1') then
|
if (ctrl_i(ctrl_bus_mo_we_c) = '1') then
|
mar <= addr_i;
|
mar <= addr_i;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process mem_adr_reg;
|
end process mem_adr_reg;
|
Line 211... |
Line 213... |
end process misaligned_d_check;
|
end process misaligned_d_check;
|
|
|
|
|
-- Data Interface: Write Data -------------------------------------------------------------
|
-- Data Interface: Write Data -------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
mem_do_reg: process(clk_i)
|
mem_do_reg: process(rstn_i, clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if (rstn_i = '0') then
|
|
mdo <= (others => def_rst_val_c);
|
|
elsif rising_edge(clk_i) then
|
if (ctrl_i(ctrl_bus_mo_we_c) = '1') then
|
if (ctrl_i(ctrl_bus_mo_we_c) = '1') then
|
mdo <= wdata_i; -- memory data output register (MDO)
|
mdo <= wdata_i; -- memory data output register (MDO)
|
end if;
|
end if;
|
end if;
|
end if;
|
end process mem_do_reg;
|
end process mem_do_reg;
|
Line 252... |
Line 256... |
end process byte_enable;
|
end process byte_enable;
|
|
|
|
|
-- Data Interface: Read Data --------------------------------------------------------------
|
-- Data Interface: Read Data --------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
mem_out_buf: process(clk_i)
|
mem_out_buf: process(rstn_i, clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if (rstn_i = '0') then
|
|
mdi <= (others => def_rst_val_c);
|
|
elsif rising_edge(clk_i) then
|
if (ctrl_i(ctrl_bus_mi_we_c) = '1') then
|
if (ctrl_i(ctrl_bus_mi_we_c) = '1') then
|
mdi <= d_bus_rdata; -- memory data input register (MDI)
|
mdi <= d_bus_rdata; -- memory data input register (MDI)
|
end if;
|
end if;
|
end if;
|
end if;
|
end process mem_out_buf;
|
end process mem_out_buf;
|
Line 440... |
Line 446... |
|
|
|
|
-- Physical Memory Protection (PMP) -------------------------------------------------------
|
-- Physical Memory Protection (PMP) -------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- compute address masks (ITERATIVE!!!) --
|
-- compute address masks (ITERATIVE!!!) --
|
pmp_masks: process(clk_i)
|
pmp_masks: process(rstn_i, clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then -- address mask computation (not the actual address check!) has a latency of max +32 cycles
|
if (rstn_i = '0') then
|
|
pmp.addr_mask <= (others => (others => def_rst_val_c));
|
|
elsif rising_edge(clk_i) then -- address mask computation (not the actual address check!) has a latency of max +32 cycles
|
for r in 0 to PMP_NUM_REGIONS-1 loop -- iterate over all regions
|
for r in 0 to PMP_NUM_REGIONS-1 loop -- iterate over all regions
|
pmp.addr_mask(r) <= (others => '0');
|
pmp.addr_mask(r) <= (others => '0');
|
for i in pmp_g_c to data_width_c-1 loop
|
for i in pmp_g_c to data_width_c-1 loop
|
pmp.addr_mask(r)(i) <= pmp.addr_mask(r)(i-1) or (not pmp_addr_i(r)(i-1));
|
pmp.addr_mask(r)(i) <= pmp.addr_mask(r)(i-1) or (not pmp_addr_i(r)(i-1));
|
end loop; -- i
|
end loop; -- i
|