# Limber Xplor **Repository Path**: qyley/limber-xplor ## Basic Information - **Project Name**: Limber Xplor - **Description**: Limber Xplor 是用于科研和教学的一个极简 RISC-V 处理器内核。 - **Primary Language**: Verilog - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 0 - **Created**: 2022-06-28 - **Last Updated**: 2025-05-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🧬Limber Xplor ```plain __ _ __ _ __ __ / / (_)___ ___ / /_ ___ _____ | |/ /____ / /___ _____ / / / / __ `__ \/ __ \/ _ \/ ___/ | // __ \/ / __ \/ ___/ / /___/ / / / / / / /_/ / __/ / / |/ /_/ / / /_/ / / /_____/_/_/ /_/ /_/_.___/\___/_/ /_/|_/ .___/_/\____/_/ /_/ ``` Limber Xplor 是一个用 verilog 编写的 RISC-V 框架,以满足学习 RISC-V 处理器并动手实践的需求。事物的发展总是在解决一个问题的同时又产生新的问题,事物与矛盾的对抗造就了事物的运动与发展。因此 Xplor 将从一个最简的 RISC-V 核开始,在追求更高性能的实践中,重新接触计算机发展过程中出现过的各种经典问题,并重现那些在历史上用来解决它们的关键技术。而当我们用今人的视角去观察前人的技巧,不仅能少走许多弯路,还能从中汲取丰富的经验。 ## 📌里程碑 - future 支持 Hardware Trap 和 Debug Unit。 - 2022.10.6 加入全局分支历史记录(GHR),实现 Gshare 分支预测器,准确率 90.76%,**1.15 CPI,3.09 Coremark** - 2022.10.4 加入针对 jalr0 和 bz 指令的数据旁路,1.16 CPI,3.05 Coremark - 2022.10.3 修复了加入 ALU 旁路后写回数据旁路失效的 bug ,1.19 CPI,2.98 Coremark - 2022.8.8 加入 ALU result 旁路,1.26 CPI,2.81 Coremark - 2022.8.6 优化流水线,将数据写回阶段提前, 1.36 CPI,2.63 Coremark - 2022.8.4 将 Load Store Unit 插入流水线,1.7 CPI,2.12 Coremark - 2022.8.1 实现基于BTB、BHT的动态分支预测,准确率可达到 89.46%,1.85 Coremark - 2022.7.23 返回地址旁路(Retrun Address bypass),1.58 Coremark - 2022.7.21 xpl32f4m发布,实现RV32M指令集拓展,0.64 Coremark - 2022.7.11 LHB总线矩阵 - 2022.6.24 静态分支预测和写回数据旁路(Write-back data bypass),0.6 Coremark - 2022.6.21 xpl32f4发布,实现RV32I指令集,0.4 Coremark ## 📌路线 | 分支 | 版本 | 状态 | 说明 | |---|---|---|---| | [master](https://gitee.com/qyley/limber-xplor/tree/master/) | xpl32f4 | `frozen` | 最基本的 RV32I 的实现 | | [rv32im](https://gitee.com/qyley/limber-xplor/tree/rv32im/) | xpl32f4m | `frozen` | RV32IM,静态分支预测,2条数据旁路 | | [bim](https://gitee.com/qyley/limber-xplor/tree/bim/) | xpl32f6m | `progressing` | RV32IM,动态分支预测,2-stage LSU,4条数据旁路 | ## 📌性能 | 版本 | ISA | Hart | 时钟 | 原型平台| Coremark | |---|---|---|---|---|---| | xpl32f6m | `RV32IM` | 1 | 100M | xc7z020clg484 | 3.09(309.14) | | xpl32f4m | `RV32IM` | 1 | 100M | xc7z020clg484 | 1.58(158) | | xpl32f4 | `RV32I` | 1 | 100M | xc7z020clg484 | 0.60(60) | ## 📌XPL32F4 Core ![输入图片说明](img/core_pipe.png) Xpl32f4 是 XPLOR 最早的内核版本,实现了RV32I指令集,附带一个能维持内核正常运行的最小系统,并能在FPGA上验证。 请阅读我们的设计与开发文档: [**_Limber eXPLORe Guide_**](https://www.jianguoyun.com/p/DeGHSbYQ4_n3CRj-l8wEIAA ) ### 📎文件结构 - limber-xplor - `doc` : 文档资料 - `example` : 示例程序 - `fpga` : FPGA相关文件 - `img` : README图片 - `rtl` :RTL代码 - `core` :内核RTL代码 - `general` : 通用模块RTL代码 - `include` : verilog头文件 - `lhb` : 系统总线 - `periph` : 系统外设 - `sim` : 仿真文件 - `specific` : 专用模块RTL代码 - `sys` : SoC系统实现 - `test` :测试脚本 ### 📎Quick Satrt #### 1.环境搭建 - 推荐Linux环境 > ubuntu 16.04 LTS > python 3.7.1 - 安装依赖包 ``` plain > sudo apt-get install autoconf automake autotools-dev curl device-tree-compiler libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev git ``` - 安装 iverilog ``` plain > git clone https://github.com/steveicarus/iverilog.git > cd iverilog > sh autoconf.sh > ./configure > make > make install > iverilog -v ``` - 安装 gtkwave ``` plain > sudo apt-get install gtkwave > gtkwave -v ``` - 下载工程源码 ``` plain > git clone https://gitee.com/qyley/limber-xplor.git ``` - 下载 RISC-V GNU C 编译器 芯来科技提供的[ **Nuclei GNU Toolchain** ](https://nucleisys.com/download.php)已经将工具链预编译,下载解压后就能直接使用,非常方便,推荐使用 2020.8 版本 ``` # 下载 Nuclei GNU Toolchain # 解压 > tar -xjvf nuclei_riscv_newlibc_prebuilt_linux64_2020.8.tgz.bz2 ``` > NOTE: > 工具链的可执行文件位于解压路径下的 `gcc/bin/` 文件夹内,后面使用 make 指令前要记得修改 Makefile 中工具链的路径 #### 2.ISA测试 RISC-V官方提供了一些汇编程序用于对ISA中各条指令进行测试(https://github.com/riscv-software-src/riscv-tests) - 编译 rv32ui `rv32ui`是官方提供的对用户模式下RV32I所有指令的测试文件。 ``` > cd /test/golden > mkdir generated > make clean > make all ``` - 运行仿真 ``` > cd .. > python run_golden.py ``` #### 3.Helloworld示范程序仿真 - 编译 helloworld ``` > cd /example/helloworld > make clean > make all ``` > NOTE: > make all 之前要记得修改 example/common.mk 中工具链的路径 - 运行仿真 ``` > cd ../../test > python run_simulation.py ../example/helloworld/helloworld.bin testcase.data ``` - 查看波形 ``` > gtkwave xpl32f4_minsys_tb.vcd ``` ## 📌参考资料 1. [**_HummingBird E203_**](https://doc.nucleisys.com/hbirdv2) 1. [**_LowRISC ibex_**](https://ibex-core.readthedocs.io/en/latest/index.html) 1. [**_OpenHW Group CV32E40P_**](https://docs.openhwgroup.org/projects/cv32e40p-user-manual/index.html) 1. [**_OpenHW Group CVA6_**](https://docs.openhwgroup.org/projects/cva6-user-manual) 1. [**_TinyRISC-V_**](https://gitee.com/liangkangnan/tinyriscv) 1. [**_RISC-V BOOM_**](https://docs.boom-core.org/en/latest/) 1. [**_RISC-V Specification_**](https://riscv.org/technical/specifications) 1. [**_XiangShan_**](https://xiangshan-doc.readthedocs.io/zh_CN/latest/) 1. **_超标量处理器设计_** ,姚永斌 1. **_Fundamentals of Parallel Multicore Architecture_** , Yan Solihin 1. **_深入理解RISC-V程序开发_** ,林金龙,何小庆 1. **_基于RISC-V指令集的超标量处理器设计与实现_**,刘权胜