What you practice
ROM RAM CSR map (1.4). Classify memory addresses into RAM, MMIO, or unmapped holes using a memory map table and address decoder. It is in ROM/RAM/CSR region map — Part 1 · Core on Bus (MMIO) of the RISC-V on SoC & System Masterclass.
The core and the mini-SoC simulate as one workspace in the IDE. Follow MMIO, interrupts, and the program on the Verilator waveform, not only a pass line.
What you will learn
You will classify memory addresses into RAM, MMIO, or unmapped holes using a memory map table and address decoder. This classification is essential for building a correct SoC platform that handles peripheral accesses safely.
Learning objectives
- Connect the
addrsignal to thememory_map_tableinstance. - Understand how
addr_decoderidentifies specific MMIO regions. - Verify RAM base address mapping and MMIO hit detection.
- Detect unmapped address holes to prevent illegal bus transactions.
Theory
A System-on-Chip (SoC) uses a memory map to assign address ranges to specific hardware blocks. The memory_map_table module compares the incoming address against defined base addresses and sizes. It outputs a region index and permission bits to indicate which block owns the address. The addr_decoder module refines this by checking specific MMIO registers for exact hits. Addresses that fall outside all defined ranges are considered holes and should trigger a decode error.
| Signal | Direction | Description |
|---|---|---|
addr | Input | 32-bit address from the bus master. |
region_idx | Output | Index of the matched memory region. |
in_map | Output | High if the address falls within any mapped region. |
region_perm | Output | Permission bits (read/write/execute) for the region. |
addr_hit | Output | Bitmask indicating which specific MMIO register matched. |
decode_err | Output | High if the address is unmapped or invalid. |
is_ram | Output | High if the address falls within the RAM region. |
is_mmio | Output | High if any MMIO bit in addr_hit is set. |
Practice
Open student/rtl/design.sv in the editor. Locate the memory_map_table u_map instance. Replace the entire __TODO__[0] placeholder on the .addr port with addr. Replace the entire __TODO__[0] placeholder on the .region_idx port with region_idx. Replace the entire __TODO__[0] placeholder on the .in_map port with in_map. Save the file. Open student/tb/tb_top.sv in the editor. Navigate to the left sidebar and click Simulation. Click Run to start the simulation. Watch the Log panel for the INFO: lines as the testbench steps through the address checks.
Summary
You practiced connecting the memory map table and address decoder instances to classify bus addresses into RAM, MMIO, or unmapped regions. By correctly mapping the u_map ports, you enabled the design to distinguish between static RAM ranges and specific peripheral registers like GPIO and TIMER. This exercise demonstrated how address decoding signals drive the system's ability to route transactions and detect invalid access attempts.
© 2026 RtlStudio. Licensed under CC BY-NC-ND 4.0. Commercial use and modifications by third parties are not permitted.
Run it in the Verilog IDE
- Open the system lesson in the IDE. The RV32I core and the mini-SoC fabric simulate together.
- Run Verilator and trace the program through MMIO: address, load/store data, and the peripheral response.
- Interrupts and DMA belong on the waveform next to the instruction stream, not only in a pass/fail line.
- Edit the integration RTL, resimulate, and run Yosys on the structural block when you want a netlist.
The lesson is done when the simulation matches ROM RAM CSR map. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.