Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🧪 convert VHDL memory images into full-scale VHDL packages #1084

Merged
merged 9 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mimpid = 0x01040312 -> Version 01.04.03.12 -> v1.4.3.12

| Date | Version | Comment | Ticket |
|:----:|:-------:|:--------|:------:|
| 01.11.2024 | 1.10.6.1 | :test_tube: convert VHDL memory images into full-scale VHDL packages | [#1084](https://github.com/stnolting/neorv32/pull/1084) |
| 26.10.2024 | [**:rocket:1.10.6**](https://github.com/stnolting/neorv32/releases/tag/v1.10.6) | **New release** | |
| 26.10.2024 | 1.10.5.11 | cleanup central makefile and linker script | [#1077](https://github.com/stnolting/neorv32/pull/1077) |
| 21.10.2024 | 1.10.5.10 | :test_tube: rework linker script's ROM/IMEM default size (=16kB); add customization variable to all makefiles in `sw/example` | [#1072](https://github.com/stnolting/neorv32/pull/1072) |
Expand Down
6 changes: 3 additions & 3 deletions docs/datasheet/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ All core VHDL files from the list below have to be assigned to a **new library**
[NOTE]
See section <<_file_list_files>> for more information.

.RTL File List and Hierarchy
.RTL File List and Hierarchy (in alphabetical order)
...................................
neorv32_top.vhd - NEORV32 PROCESSOR/SOC TOP ENTITY
Expand All @@ -199,7 +199,7 @@ neorv32_top.vhd - NEORV32 PROCESSOR/SOC TOP ENTITY
│└neorv32_cpu_regfile.vhd - Data register file
├neorv32_boot_rom.vhd - Bootloader ROM
│└neorv32_bootloader_image.vhd - Bootloader ROM memory image
│└neorv32_bootloader_image.vhd - Bootloader ROM memory image (package)
├neorv32_bus.vhd - SoC bus infrastructure modules
├neorv32_cache.vhd - Generic cache module
├neorv32_cfs.vhd - Custom functions subsystem
Expand All @@ -214,7 +214,7 @@ neorv32_top.vhd - NEORV32 PROCESSOR/SOC TOP ENTITY
├neorv32_gpio.vhd - General purpose input/output port unit
├neorv32_gptmr.vhd - General purpose 32-bit timer
├neorv32_imem.vhd - Generic processor-internal instruction memory
│└neorv32_application_image.vhd - IMEM application initialization image
│└neorv32_application_image.vhd - IMEM application initialization image (package)
├neorv32_mtime.vhd - Machine system timer
├neorv32_neoled.vhd - NeoPixel (TM) compatible smart LED interface
├neorv32_onewire.vhd - One-Wire serial interface controller
Expand Down
11 changes: 6 additions & 5 deletions docs/datasheet/soc_bootrom.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
[cols="<3,<3,<4"]
[frame="topbot",grid="none"]
|=======================
| Hardware source files: | neorv32_boot_rom.vhd |
| Software driver files: | none |
| Top entity ports: | none |
| Configuration generics: | `INT_BOOTLOADER_EN` | implement processor-internal bootloader when `true`
| CPU interrupts: | none |
| Hardware source files: | neorv32_boot_rom.vhd | default platform-agnostic bootloader ROM
| | neorv32_bootloader_image.vhd | initialization image (a VHDL package)
| Software driver files: | none | _implicitly used_
| Top entity ports: | none |
| Configuration generics: | `INT_BOOTLOADER_EN` | implement processor-internal bootloader when `true`
| CPU interrupts: | none |
| Access restrictions: 2+| privileged access only, read-only
|=======================

Expand Down
15 changes: 8 additions & 7 deletions docs/datasheet/soc_imem.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
[cols="<3,<3,<4"]
[frame="topbot",grid="none"]
|=======================
| Hardware source files: | neorv32_imem.vhd | default platform-agnostic instruction memory
| Software driver files: | none | _implicitly used_
| Top entity ports: | none |
| Configuration generics: | `MEM_INT_IMEM_EN` | implement processor-internal IMEM when `true`
| | `MEM_INT_IMEM_SIZE` | IMEM size in bytes (use a power of 2)
| | `INT_BOOTLOADER_EN` | use internal bootloader when `true` (implements IMEM as _uninitialized_ RAM, otherwise the IMEM is implemented an _pre-intialized_ ROM)
| CPU interrupts: | none |
| Hardware source files: | neorv32_imem.vhd | default platform-agnostic instruction memory (RAM or ROM)
| | neorv32_application_image.vhd | initialization image (a VHDL package)
| Software driver files: | none | _implicitly used_
| Top entity ports: | none |
| Configuration generics: | `MEM_INT_IMEM_EN` | implement processor-internal IMEM when `true`
| | `MEM_INT_IMEM_SIZE` | IMEM size in bytes (use a power of 2)
| | `INT_BOOTLOADER_EN` | use internal bootloader when `true` (implements IMEM as _uninitialized_ RAM, otherwise the IMEM is implemented an _pre-intialized_ ROM)
| CPU interrupts: | none |
| Access restrictions: 2+| none / read-only if `INT_BOOTLOADER_EN = true`
|=======================

Expand Down
4 changes: 2 additions & 2 deletions docs/datasheet/software.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ by a flag when calling the generator.
[grid="none"]
|=======================
| `-app_bin` | Generates an executable binary file (including a bootloader header) for upload via the bootloader.
| `-app_img` | Generates an executable VHDL memory initialization image for the processor-internal IMEM.
| `-bld_img` | Generates an executable VHDL memory initialization image for the processor-internal BOOT ROM.
| `-app_vhd` | Generates an executable VHDL memory initialization image for the processor-internal IMEM.
| `-bld_vhd` | Generates an executable VHDL memory initialization image for the processor-internal BOOT ROM.
| `-raw_hex` | Generates a raw 8x ASCII hex-char file for custom purpose.
| `-raw_bin` | Generates a raw binary file `for custom purpose.
| `-raw_coe` | Generates a raw COE file for FPGA memory initialization.
Expand Down
17 changes: 11 additions & 6 deletions rtl/core/neorv32_application_image.vhd
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
-- The NEORV32 RISC-V Processor: https://github.com/stnolting/neorv32
-- Auto-generated memory initialization file (for APPLICATION) from source file <demo_blink_led/main.bin>
-- The NEORV32 RISC-V Processor - github.com/stnolting/neorv32
-- Auto-generated memory initialization package (for internal IMEM)
-- Source: demo_blink_led/main.bin
-- Size: 1100 bytes
-- MARCH: default
-- Built: 15.09.2024 21:48:24 (dd.mm.yyyy hh:mm:ss)
-- Built: 31.10.2024 22:32:21

-- prototype defined in 'neorv32_package.vhd'
package body neorv32_application_image is
library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_application_image is

constant application_init_image : mem32_t := (
x"000020b7",
Expand Down
23 changes: 14 additions & 9 deletions rtl/core/neorv32_bootloader_image.vhd
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
-- The NEORV32 RISC-V Processor: https://github.com/stnolting/neorv32
-- Auto-generated memory initialization file (for BOOTLOADER) from source file <bootloader/main.bin>
-- The NEORV32 RISC-V Processor - github.com/stnolting/neorv32
-- Auto-generated memory initialization package (for internal BOOTROM)
-- Source: bootloader/main.bin
-- Size: 4072 bytes
-- MARCH: default
-- Built: 27.09.2024 05:54:10 (dd.mm.yyyy hh:mm:ss)
-- Built: 31.10.2024 22:31:51

-- prototype defined in 'neorv32_package.vhd'
package body neorv32_bootloader_image is
library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_bootloader_image is

constant bootloader_init_image : mem32_t := (
x"000020b7",
Expand Down Expand Up @@ -894,9 +899,9 @@ x"6f6c746f",
x"72656461",
x"0a3e3e20",
x"444c420a",
x"53203a56",
x"32207065",
x"30322037",
x"4f203a56",
x"33207463",
x"30322031",
x"480a3432",
x"203a5657",
x"00000020",
Expand Down
39 changes: 1 addition & 38 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"01100600"; -- hardware version
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01100601"; -- hardware version
constant archid_c : natural := 19; -- official RISC-V architecture ID
constant XLEN : natural := 32; -- native data path width

Expand Down Expand Up @@ -1116,40 +1116,3 @@ package body neorv32_package is
end function print_version_f;

end neorv32_package;

-- **********************************************************************************************************
-- Additional Packages
-- **********************************************************************************************************

-- Prototype Definition: bootloader_init_image --------------------------------------------
-- -------------------------------------------------------------------------------------------
-- > memory content in 'neorv32_bootloader_image.vhd', auto-generated by 'image_gen'
-- > used by 'neorv32_boot_rom.vhd'
-- > enables body-only recompile in case of firmware change (NEORV32 PR #338)

library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_bootloader_image is
constant bootloader_init_image : mem32_t;
end neorv32_bootloader_image;


-- Prototype Definition: neorv32_application_image ----------------------------------------
-- -------------------------------------------------------------------------------------------
-- > memory content in 'neorv32_application_image.vhd', auto-generated by 'image_gen'
-- > used by 'mem/neorv32_imem.*.vhd'
-- > enables body-only recompile in case of firmware change (NEORV32 PR #338)

library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_application_image is
constant application_init_image : mem32_t;
end neorv32_application_image;
2 changes: 0 additions & 2 deletions rtl/file_list_cpu.f
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_cpu_lsu.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_cpu_pmp.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_cpu.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_bootloader_image.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_application_image.vhd
4 changes: 2 additions & 2 deletions rtl/file_list_soc.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_bus.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_cache.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_dma.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_application_image.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_imem.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_dmem.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_bootloader_image.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_boot_rom.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_xip.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_xbus.vhd
Expand All @@ -45,5 +47,3 @@
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_debug_auth.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_debug_dm.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_top.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_application_image.vhd
NEORV32_RTL_PATH_PLACEHOLDER/core/neorv32_bootloader_image.vhd
4 changes: 2 additions & 2 deletions sw/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ $(APP_EXE): main.bin $(IMAGE_GEN)
# Generate NEORV32 executable VHDL boot image
$(APP_VHD): main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -app_img $< $@ $(shell basename $(CURDIR))
@$(IMAGE_GEN) -app_vhd $< $@ $(shell basename $(CURDIR))

# Install VHDL memory initialization file
install-$(APP_VHD): $(APP_VHD)
Expand Down Expand Up @@ -241,7 +241,7 @@ $(APP_MEM): main.bin $(IMAGE_GEN)
# Create local VHDL BOOTROM image
bl_image: main.bin $(IMAGE_GEN)
@set -e
@$(IMAGE_GEN) -bld_img $< $(BOOT_VHD) $(shell basename $(CURDIR))
@$(IMAGE_GEN) -bld_vhd $< $(BOOT_VHD) $(shell basename $(CURDIR))

# Install BOOTROM image to VHDL source directory
bootloader: bl_image
Expand Down
Loading
Loading