Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

RISC-V CPU Core (RV32IM)

License

NotificationsYou must be signed in to change notification settings

ultraembedded/riscv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github:http://github.com/ultraembedded/riscv

A 32-bit RISC-V core written in Verilog and an instruction set simulator supporting RV32IM.
This core has been tested against a co-simulation model and exercised on FPGA.

For a higher performance dual issue CPU with branch prediction, see my latest RISC-V core here;http://github.com/ultraembedded/biriscv

Overview

Features

  • 32-bit RISC-V ISA CPU core.
  • Support RISC-V integer (I), multiplication and division (M), and CSR instructions (Z) extensions (RV32IMZicsr).
  • Supports user, supervisor and machine mode privilege levels.
  • Basic MMU support - capable of booting Linux with atomics (RV-A) SW emulation.
  • Implements base ISA specv2.1 and privileged ISA specv1.11.
  • Verified usingGoogle's RISCV-DV random instruction sequences using cosimulation againstC++ ISA model.
  • Support for instruction / data cache, AXI bus interfaces or tightly coupled memories.
  • Configurable number of pipeline stages and result forwarding options.
  • Synthesizable Verilog 2001, Verilator and FPGA friendly.
  • Coremark:2.94 CoreMark/MHz
  • Dhrystone:1.25 DMIPS/MHz ('legal compile options' / 337 instructions per iteration)
  • Want higher performance (4.1CM/MHz /1.9DMIPS/MHz) - seemy improved core.

Configuration

Param NameValid RangeDescription
SUPPORT_SUPER1/0Enable supervisor / user privilege levels.
SUPPORT_MMU1/0Enable basic memory management unit.
SUPPORT_MULDIV1/0Enable HW multiply / divide (RV-M).
SUPPORT_LOAD_BYPASS1/0Support load result bypass paths.
SUPPORT_MUL_BYPASS1/0Support multiply result bypass paths.
SUPPORT_REGFILE_XILINX1/0Support Xilinx optimised register file.
EXTRA_DECODE_STAGE1/0Extra decode pipe stage for improved timing.
MEM_CACHE_ADDR_MIN32'h0 - 32'hffffffffLowest cacheable memory address.
MEM_CACHE_ADDR_MAX32'h0 - 32'hffffffffHighest cacheable memory address.

Directories

NameContents
core/riscvRISC-V pipelined RV32IM CPU core (Verilog)
isa_simInstruction set simulator (C)
top_tcm_axi/src_vExample instance with 64KB DP-RAM & AXI Interfaces
top_tcm_axi/tbSystem-C testbench for the core
top_cache_axi/src_vExample instance with instruction and data caches.
top_cache_axi/tbSystem-C testbench for the core

Example Core Instance (with TCM memory)

The top (top_tcm_axi/src_v/riscv_tcm_top.v) contains;

  • Instances one of the above cores, adding RAM and standard bus interfaces.
  • 64KB dual ported RAM for (I/D code and data).
  • AXI4 slave port for loading the RAM, DMA access, etc (including support for burst access).
  • AXI4-Lite master port for CPU access to peripherals.
  • Separate reset for CPU core to dual ported RAM / AXI interface (to allow program code to be loaded prior to CPU reset de-assertion).

Memory Map

RangeDescription
0x0000_0000 - 0x0000_ffff64KB TCM Memory
0x0000_2000Boot address (configurable, see RISCV_BOOT_ADDRESS)
0x8000_0000 - 0xffff_ffffPeripheral address space (from AXI4-L port)

Interfaces

NameDescription
clk_iClock input
rst_iAsync reset, active-high. Reset memory / AXI interface.
rst_cpu_iAsync reset, active-high. Reset CPU core (excluding AXI / memory).
axi_t_*AXI4 slave interface for access to 64KB TCM memory.
axi_i_*AXI4-Lite master interface for CPU access to peripherals.
intr_iActive high interrupt input (for connection external int controller).

Testbench

A basic System-C / Verilator based testbench for the core is provided.

Dependencies;

  • gcc
  • make
  • libelf
  • System-C (specify path using SYSTEMC_HOME)
  • Verilator (specify path using VERILATOR_SRC)

To build the testbench;

cd top_tcm_axi/tbmake

To run the provided test executable;

cd top_tcm_axi/tbmake run

Example Core Instance (with caches)

The top (top_cache_axi/src_v/riscv_top.v) contains;

  • Instances one of the above cores, adding RAM and standard bus interfaces.
  • 16KB 2-way set associative instruction cache
  • 16KB 2-way set associative data cache with write-back and allocate on write.
  • 2 x AXI4 master port for CPU access to instruction / data / peripherals.

Interfaces

NameDescription
clk_iClock input
rst_iAsync reset, active-high. Reset memory / AXI interface.
axi_i_*AXI4 master interface for CPU access to instruction memory.
axi_d_*AXI4 master interface for CPU access to data / peripheral memories.
intr_iActive high interrupt input (for connection external int controller).
reset_vector_iBoot vector.

Execution Example


[8]ページ先頭

©2009-2025 Movatter.jp