From 1f7bc8ac3daaeeaee87bcf63f1fd9f8b51d4bf06 Mon Sep 17 00:00:00 2001 From: stnolting Date: Thu, 3 Oct 2024 22:09:18 +0200 Subject: [PATCH 1/3] [sim/simple] minor cleanup --- sim/simple/ghdl.run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/simple/ghdl.run.sh b/sim/simple/ghdl.run.sh index e62787180..0301d2589 100755 --- a/sim/simple/ghdl.run.sh +++ b/sim/simple/ghdl.run.sh @@ -4,7 +4,7 @@ set -e cd $(dirname "$0") -echo "Tip: Compile application with USER_FLAGS+=-DUART[0/1]_SIM_MODE to auto-enable UART[0/1]'s simulation mode (redirect UART output to simulator console)." +echo "[TIP] Compile application with USER_FLAGS+=-DUART[0/1]_SIM_MODE to enable UART[0/1]'s simulation mode (redirect UART output to simulator console)." # Prepare simulation output files for UART0 and UART 1 # - Testbench receiver log file (neorv32.testbench_uart?.out) From 36717c95d7b416b37138b427c6c3be0e9c105ff0 Mon Sep 17 00:00:00 2001 From: stnolting Date: Thu, 3 Oct 2024 22:09:55 +0200 Subject: [PATCH 2/3] [image_gen] add warning: image is not a mult. of 4 --- sw/common/common.mk | 2 +- sw/image_gen/image_gen.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sw/common/common.mk b/sw/common/common.mk index 504473f15..18915fd53 100644 --- a/sw/common/common.mk +++ b/sw/common/common.mk @@ -153,7 +153,7 @@ target bootloader | bl_image: CC_OPTS += -Wl,--defsym=MAKE_BOOTLOADER=1 -DMAKE_B # ----------------------------------------------------------------------------- # Compile image generator $(IMAGE_GEN): $(NEORV32_EXG_PATH)/image_gen.c - @echo Compiling $(IMAGE_GEN) + @echo Compiling image generator... @$(CC_HOST) $< -o $(IMAGE_GEN) # ----------------------------------------------------------------------------- diff --git a/sw/image_gen/image_gen.c b/sw/image_gen/image_gen.c index d904fd7c1..cf5cf06b3 100644 --- a/sw/image_gen/image_gen.c +++ b/sw/image_gen/image_gen.c @@ -83,6 +83,10 @@ int main(int argc, char *argv[]) { unsigned int input_words = input_size / 4; rewind(input); + if ((input_size % 4) != 0) { + printf("WARNING - image size is not a multiple of 4 bytes.\n"); + } + // input file empty? if(input_size == 0) { printf("Input file is empty!"); From 750f141ef1803abd96a8ea60fa33d5a52635bcbb Mon Sep 17 00:00:00 2001 From: stnolting Date: Thu, 3 Oct 2024 22:10:43 +0200 Subject: [PATCH 3/3] [top] set CLOCK_FREQUENCY = 0 as default --- docs/datasheet/soc.adoc | 2 +- rtl/core/neorv32_package.vhd | 2 +- rtl/core/neorv32_top.vhd | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/datasheet/soc.adoc b/docs/datasheet/soc.adoc index ac2c531a4..642c04609 100644 --- a/docs/datasheet/soc.adoc +++ b/docs/datasheet/soc.adoc @@ -196,7 +196,7 @@ The generic type "`suv(x:y)`" is an abbreviation for "`std_ulogic_vector(x downt |======================= | Name | Type | Default | Description 4+^| **General** -| `CLOCK_FREQUENCY` | natural | - | The clock frequency of the processor's `clk_i` input port in Hertz (Hz). +| `CLOCK_FREQUENCY` | natural | 0 | The clock frequency of the processor's `clk_i` input port in Hertz (Hz). | `CLOCK_GATING_EN` | boolean | false | Enable clock gating when CPU is in sleep mode (see sections <<_sleep_mode>> and <<_processor_clocking>>). | `INT_BOOTLOADER_EN` | boolean | false | Implement the processor-internal <<_bootloader_rom_bootrom>>, pre-initialized with the default <<_bootloader>> image. | `HART_ID` | suv(31:0) | 0x00000000 | The hart thread ID of the CPU (passed to <<_mhartid>> CSR). diff --git a/rtl/core/neorv32_package.vhd b/rtl/core/neorv32_package.vhd index 0ffd3cdab..0fca399c8 100644 --- a/rtl/core/neorv32_package.vhd +++ b/rtl/core/neorv32_package.vhd @@ -668,7 +668,7 @@ package neorv32_package is component neorv32_top generic ( -- General -- - CLOCK_FREQUENCY : natural; + CLOCK_FREQUENCY : natural := 0; CLOCK_GATING_EN : boolean := false; HART_ID : std_ulogic_vector(31 downto 0) := x"00000000"; JEDEC_ID : std_ulogic_vector(10 downto 0) := "00000000000"; diff --git a/rtl/core/neorv32_top.vhd b/rtl/core/neorv32_top.vhd index fc86aa405..9b5e2d932 100644 --- a/rtl/core/neorv32_top.vhd +++ b/rtl/core/neorv32_top.vhd @@ -22,7 +22,7 @@ use neorv32.neorv32_package.all; entity neorv32_top is generic ( -- General -- - CLOCK_FREQUENCY : natural; -- clock frequency of clk_i in Hz + CLOCK_FREQUENCY : natural := 0; -- clock frequency of clk_i in Hz CLOCK_GATING_EN : boolean := false; -- enable clock gating when in sleep mode HART_ID : std_ulogic_vector(31 downto 0) := x"00000000"; -- hardware thread ID JEDEC_ID : std_ulogic_vector(10 downto 0) := "00000000000"; -- JEDEC ID: continuation codes + vendor ID @@ -374,6 +374,10 @@ begin assert not (io_sysinfo_en_c = false) report "[NEORV32] SYSINFO module disabled - some parts of the NEORV32 software framework will no longer work!" severity warning; + -- Clock speed not defined -- + assert not (CLOCK_FREQUENCY = 0) report + "[NEORV32] CLOCK_FREQUENCY must be configured according to the frequency of clk_i port!" severity warning; + end generate; -- /sanity_checks