How ultraembedded/core_uriscv works
Main Components
a. CPU Core:
• Main module (riscv_core.v) as the central processing element.
• Inside the core, indicate the presence of functional units such as:
– ALU (uriscv_alu.v): for arithmetic and logic operations.
– Branch Unit (uriscv_branch.v): for conditional control flow.
– Control & Status Register unit (uriscv_csr.v): for CSR, interruptions, traps, etc.
– Load/Store Unit (uriscv_lsu.v): managing memory accesses.
– Multiplication/Division unit (uriscv_muldiv.v): which handles multi-cycle operations like multiplication and division.
– Definitions and constants (uriscv_defs.v) which support parameterization.
b. Test Bench Environment:
• A separate block for the test bench (located in tb/tb_core_icarus). This includes:
– The top-level test bench module (tb_top.v) that instantiates the CPU and provides the simulation environment.
– Memory models (tcm_mem.v, tcm_mem_ram.v) representing beyond-the-core memory for instruction and data handling.
– The simulation test image (test.elf) used for verifying correct operation.
c. External Dependencies:
• While not an external service in a typical software stack, note that the design is “FPGA friendly” and synthesizable with Verilator, suggesting the intended usage with FPGA tools and simulation vendors.
Establish Relationships and Data Flows
– The main riscv_core should send instruction decoding signals to the ALU, branch logic, and other units.
– Data flows between the LSU and the core’s register file (not explicitly depicted but implied as part of the execution).
– The CSR unit interacts with control logic for handling exceptions, interrupts, and system status.
• Communication between the CPU core and external memory units (as modeled by tcm_mem and associated RAM modules in the test bench).
• Incorporate simulation inputs (clock, reset) that drive both the CPU core and the test bench environment.
Architectural and Design Principles
• That this is a multi-cycle design (most instructions take 2 cycles while load/stores and division take more cycles). Emphasize the sequential step-by-step control path.
• Configurable nature of features (multiplication, division, CSR, etc.) as described in the README configuration table.
• That the CPU implements a subset of the RISC-V ISA with support for privileged modes (machine mode only).