Skip to content

Commit

Permalink
[rtl] tops: constrain all relevant generics
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Jun 30, 2024
1 parent 297466f commit 045a2ce
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
10 changes: 5 additions & 5 deletions rtl/core/neorv32_package.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ package neorv32_package is

-- Architecture Constants -----------------------------------------------------------------
-- -------------------------------------------------------------------------------------------
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01100005"; -- hardware version
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01100006"; -- hardware version
constant archid_c : natural := 19; -- official RISC-V architecture ID
constant XLEN : natural := 32; -- native data path width

Expand Down Expand Up @@ -735,14 +735,14 @@ package neorv32_package is
REGFILE_HW_RST : boolean := false;
-- Physical Memory Protection (PMP) --
PMP_NUM_REGIONS : natural range 0 to 16 := 0;
PMP_MIN_GRANULARITY : natural := 4;
PMP_MIN_GRANULARITY : natural range 4 to 2**30 := 4;
PMP_TOR_MODE_EN : boolean := true;
PMP_NAP_MODE_EN : boolean := true;
-- Hardware Performance Monitors (HPM) --
HPM_NUM_CNTS : natural range 0 to 13 := 0;
HPM_CNT_WIDTH : natural range 0 to 64 := 40;
-- Atomic Memory Access - Reservation Set Granularity --
AMO_RVS_GRANULARITY : natural := 4;
AMO_RVS_GRANULARITY : natural range 4 to 2**30 := 4;
-- Internal Instruction memory (IMEM) --
MEM_INT_IMEM_EN : boolean := false;
MEM_INT_IMEM_SIZE : natural := 16*1024;
Expand All @@ -762,8 +762,8 @@ package neorv32_package is
XBUS_TIMEOUT : natural := 255;
XBUS_REGSTAGE_EN : boolean := false;
XBUS_CACHE_EN : boolean := false;
XBUS_CACHE_NUM_BLOCKS : natural := 64;
XBUS_CACHE_BLOCK_SIZE : natural := 32;
XBUS_CACHE_NUM_BLOCKS : natural range 1 to 256 := 64;
XBUS_CACHE_BLOCK_SIZE : natural range 1 to 2**16 := 32;
-- Execute in-place module (XIP) --
XIP_EN : boolean := false;
XIP_CACHE_EN : boolean := false;
Expand Down
15 changes: 8 additions & 7 deletions rtl/core/neorv32_top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
-- NEORV32 SoC - Processor Top Entity --
-- -------------------------------------------------------------------------------- --
-- Check out the processor's online documentation for more information: --
-- HQ: https://github.com/stnolting/neorv32 --
-- Data Sheet: https://stnolting.github.io/neorv32 --
-- User Guide: https://stnolting.github.io/neorv32/ug --
-- > HQ: https://github.com/stnolting/neorv32 --
-- > Data Sheet: https://stnolting.github.io/neorv32 --
-- > User Guide: https://stnolting.github.io/neorv32/ug --
-- > Software Ref: https://stnolting.github.io/neorv32/sw/files.html --
-- -------------------------------------------------------------------------------- --
-- The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 --
-- Copyright (c) NEORV32 contributors. --
Expand Down Expand Up @@ -54,7 +55,7 @@ entity neorv32_top is

-- Physical Memory Protection (PMP) --
PMP_NUM_REGIONS : natural range 0 to 16 := 0; -- number of regions (0..16)
PMP_MIN_GRANULARITY : natural := 4; -- minimal region granularity in bytes, has to be a power of 2, min 4 bytes
PMP_MIN_GRANULARITY : natural range 4 to 2**30 := 4; -- minimal region granularity in bytes, has to be a power of 2, min 4 bytes
PMP_TOR_MODE_EN : boolean := true; -- implement TOR mode
PMP_NAP_MODE_EN : boolean := true; -- implement NAPOT/NA4 modes

Expand All @@ -63,7 +64,7 @@ entity neorv32_top is
HPM_CNT_WIDTH : natural range 0 to 64 := 40; -- total size of HPM counters (0..64)

-- Atomic Memory Access - Reservation Set Granularity --
AMO_RVS_GRANULARITY : natural := 4; -- size in bytes, has to be a power of 2, min 4
AMO_RVS_GRANULARITY : natural range 4 to 2**30 := 4; -- size in bytes, has to be a power of 2, min 4

-- Internal Instruction memory (IMEM) --
MEM_INT_IMEM_EN : boolean := false; -- implement processor-internal instruction memory
Expand All @@ -88,8 +89,8 @@ entity neorv32_top is
XBUS_TIMEOUT : natural := 255; -- cycles after a pending bus access auto-terminates (0 = disabled)
XBUS_REGSTAGE_EN : boolean := false; -- add XBUS register stage
XBUS_CACHE_EN : boolean := false; -- enable external bus cache (x-cache)
XBUS_CACHE_NUM_BLOCKS : natural := 64; -- x-cache: number of blocks (min 1), has to be a power of 2
XBUS_CACHE_BLOCK_SIZE : natural := 32; -- x-cache: block size in bytes (min 4), has to be a power of 2
XBUS_CACHE_NUM_BLOCKS : natural range 1 to 256 := 64; -- x-cache: number of blocks (min 1), has to be a power of 2
XBUS_CACHE_BLOCK_SIZE : natural range 1 to 2**16 := 32; -- x-cache: block size in bytes (min 4), has to be a power of 2

-- Execute in-place module (XIP) --
XIP_EN : boolean := false; -- implement execute in place module (XIP)?
Expand Down
32 changes: 16 additions & 16 deletions rtl/system_integration/neorv32_vivado_ip.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ entity neorv32_vivado_ip is
REGFILE_HW_RST : boolean := false;
-- Physical Memory Protection (PMP) --
PMP_NUM_REGIONS : natural range 0 to 16 := 0;
PMP_MIN_GRANULARITY : natural := 4;
PMP_MIN_GRANULARITY : natural range 4 to 2**30 := 4;
PMP_TOR_MODE_EN : boolean := false;
PMP_NAP_MODE_EN : boolean := false;
-- Hardware Performance Monitors (HPM) --
HPM_NUM_CNTS : natural range 0 to 13 := 0;
HPM_CNT_WIDTH : natural range 0 to 64 := 40;
-- Atomic Memory Access - Reservation Set Granularity --
AMO_RVS_GRANULARITY : natural := 4;
AMO_RVS_GRANULARITY : natural range 4 to 2**30 := 4;
-- Internal Instruction memory --
MEM_INT_IMEM_EN : boolean := false;
MEM_INT_IMEM_SIZE : natural := 16*1024;
Expand Down Expand Up @@ -245,10 +245,10 @@ architecture neorv32_vivado_ip_rtl of neorv32_vivado_ip is
constant num_gpio_c : natural := max_natural_f(IO_GPIO_IN_NUM, IO_GPIO_OUT_NUM);

-- variable-sized ports --
signal gpio_o_tmp : std_ulogic_vector(63 downto 0);
signal gpio_i_tmp : std_ulogic_vector(63 downto 0);
signal pwm_o_tmp : std_ulogic_vector(11 downto 0);
signal xirq_i_tmp : std_ulogic_vector(31 downto 0);
signal gpio_o_aux : std_ulogic_vector(63 downto 0);
signal gpio_i_aux : std_ulogic_vector(63 downto 0);
signal pwm_o_aux : std_ulogic_vector(11 downto 0);
signal xirq_i_aux : std_ulogic_vector(31 downto 0);

-- internal wishbone bus --
type wb_bus_t is record
Expand Down Expand Up @@ -407,8 +407,8 @@ begin
xip_dat_i => xip_dat_i,
xip_dat_o => xip_dat_o,
-- GPIO (available if IO_GPIO_NUM > 0) --
gpio_o => gpio_o_tmp,
gpio_i => gpio_i_tmp,
gpio_o => gpio_o_aux,
gpio_i => gpio_i_aux,
-- primary UART0 (available if IO_UART0_EN = true) --
uart0_txd_o => uart0_txd_o,
uart0_rxd_i => uart0_rxd_i,
Expand All @@ -433,7 +433,7 @@ begin
onewire_i => onewire_i,
onewire_o => onewire_o,
-- PWM available if IO_PWM_NUM_CH > 0) --
pwm_o => pwm_o_tmp,
pwm_o => pwm_o_aux,
-- Custom Functions Subsystem IO (available if IO_CFS_EN = true) --
cfs_in_i => cfs_in_i,
cfs_out_o => cfs_out_o,
Expand All @@ -444,7 +444,7 @@ begin
-- GPTMR timer capture (available if IO_GPTMR_EN = true) --
gptmr_trig_i => gptmr_trig_i,
-- External platform interrupts (available if XIRQ_NUM_CH > 0) --
xirq_i => xirq_i_tmp,
xirq_i => xirq_i_aux,
-- CPU Interrupts --
mtime_irq_i => mtime_irq_i,
msw_irq_i => msw_irq_i,
Expand All @@ -458,30 +458,30 @@ begin
-- GPIO input --
gpio_in_mapping: process(gpio_i)
begin
gpio_i_tmp <= (others => '0');
gpio_i_aux <= (others => '0');
for i in 0 to IO_GPIO_IN_NUM-1 loop
gpio_i_tmp(i) <= gpio_i(i);
gpio_i_aux(i) <= gpio_i(i);
end loop;
end process gpio_in_mapping;

-- GPIO output --
gpio_out_mapping:
for i in 0 to IO_GPIO_OUT_NUM-1 generate
gpio_o(i) <= gpio_o_tmp(i);
gpio_o(i) <= gpio_o_aux(i);
end generate;

-- PWM --
pwm_mapping:
for i in 0 to IO_PWM_NUM_CH-1 generate
pwm_o(i) <= pwm_o_tmp(i);
pwm_o(i) <= pwm_o_aux(i);
end generate;

-- XIRQ --
xirq_mapping: process(xirq_i)
begin
xirq_i_tmp <= (others => '0');
xirq_i_aux <= (others => '0');
for i in 0 to XIRQ_NUM_CH-1 loop
xirq_i_tmp(i) <= xirq_i(i);
xirq_i_aux(i) <= xirq_i(i);
end loop;
end process xirq_mapping;

Expand Down

0 comments on commit 045a2ce

Please sign in to comment.