{"id":13649314,"url":"https://github.com/sergeykhbr/riscv_vhdl","last_synced_at":"2025-04-22T14:31:25.925Z","repository":{"id":44630027,"uuid":"45797714","full_name":"sergeykhbr/riscv_vhdl","owner":"sergeykhbr","description":"Portable RISC-V System-on-Chip implementation: RTL, debugger and simulators","archived":false,"fork":false,"pushed_at":"2024-10-30T19:07:34.000Z","size":102676,"stargazers_count":624,"open_issues_count":2,"forks_count":103,"subscribers_count":53,"default_branch":"master","last_synced_at":"2024-11-10T00:32:57.206Z","etag":null,"topics":["cpu","debugger","qt","riscv","simulator","soc","systemc","vhdl"],"latest_commit_sha":null,"homepage":"http://sergeykhbr.github.io/riscv_vhdl/","language":"Verilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergeykhbr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-08T20:30:57.000Z","updated_at":"2024-11-05T00:27:47.000Z","dependencies_parsed_at":"2023-02-16T21:01:09.580Z","dependency_job_id":"bdd952da-5ea2-43a1-a8c2-2cce0efd6b1a","html_url":"https://github.com/sergeykhbr/riscv_vhdl","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeykhbr%2Friscv_vhdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeykhbr%2Friscv_vhdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeykhbr%2Friscv_vhdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeykhbr%2Friscv_vhdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergeykhbr","download_url":"https://codeload.github.com/sergeykhbr/riscv_vhdl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250258953,"owners_count":21401004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu","debugger","qt","riscv","simulator","soc","systemc","vhdl"],"created_at":"2024-08-02T01:04:56.516Z","updated_at":"2025-04-22T14:31:20.895Z","avatar_url":"https://github.com/sergeykhbr.png","language":"Verilog","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"System-On-Chip template based on synthesizable processor compliant with the RISC-V architecture.\n=====================\n\n[![CI](https://github.com/sergeykhbr/riscv_vhdl/workflows/build/badge.svg)](https://github.com/sergeykhbr/riscv_vhdl/actions)\n\n## Howto build FPGA bitstream or RTL simulation:\n\n- To build KC705 bitstream file:\n\n        $ cd sv/prj/impl/kc705\n        $ make\n\n- To build and run full system unisim RTL simulation:\n\n        $ cd sv/prj/impl/asic_sim\n        $ make build\n        $ make gui\n\n- To build and run precise SystemC simulation (see github actions):\n\n        $ cmake -S ./debugger/cmake -B build\n        $ cd build\n        $ make\n        $ cd linuxbuild/bin\n        $ ./run_sysc_river_x1_gui.sh\n\nNote: Information related to VHDL source code is obsolete and currently is updating.\n\n\nThis repository provides open source System-on-Chip implementation based on\nopen source RISC-V specifications. SOC project\nincludes general set of peripheries, FPGA CADs projects files, own\nimplementation of the Windows/Linux debugger and several examples that help\nto run your firmware on almost any FPGA boards.\nSatellite Navigation (GPS/GLONASS/Galileo) modules were stubbed in this\nrepository and can be requested separately.\n\n\n## What is River CPU?\n\nThat's a VHDL RISC-V ISA implementation used in a several projects including\nthe multi-sytem Satellite Navigation receiver. It is great for an \nembedded applications with active usage of 64-bits computations (like DSP).  \n**River CPU** includes the following tools and features:\n\n1. Source code\n    - */debugger/cpu_fnc_plugin*  - Functional RISC-V CPU model.\n    - */debugger/cpu_sysc_plugin* - Precise SystemC RIVER CPU model.\n    - */rtl/riverlib*      -  synthesisable VHDL model of a 64-bit processor compliant with the RISC-V architecture.\n2. Floating Point Unit (FPU)\n3. Multi-Core configuration\n4. Advanced debugging features\n    - Test Access Points (TAPs) via Ethernet, UART and JTAG in one system.\n    - Compatible with the Standard RISC-V debug specification.\n    - System Bus tracer\n    - Pipeline statistic (CPI, HW stacktrace) in a real-time on HW level.\n    - Plug'n'Play information\n\nYou can find several **demonstration videos**\n[here](https://github.com/sergeykhbr/riscv_vhdl/tree/master/debugger) of working with the \nDual-Core SoC on FPGA and with the emulated platforms.\n\n\n## System-on-Chip structure\n\nSoC documentation in [.pdf](docs/riscv_vhdl_trm.pdf) formats.\n\n![SOC top](docs/doxygen/pics/soc_top_v5.png)\n\n## Performance\n\nPerformance analysis is based on very compact\n[**Dhrystone v2.1. benchmark**](http://fossies.org/linux/privat/old/dhrystone-2.1.tar.gz/)\napplication available as the bare-metal test in *$(TOP)/example/dhrystone21*\nfolder and entirely ported into Zephyr shell (see animated gif below). Benchmark was executed\nwith enabled (-O0) and disabled (-O2) optimization to define HW and GCC-compiler advantages.\nAll sources are available and could be run on the simulator or on the \ndifferent FPGA targets.\n\nTarget             | Git tag | Dhrystone\u003cbr\u003e per sec,\u003cbr\u003e -O0, 60 MHz | Dhrystone\u003cbr\u003e per sec,\u003cbr\u003e -O2, 60 MHz | Information.\n-------------------|:-------:|:------------------------------:|:------------------------------:|:------------\nRISC-V simulator   | latest  | **76824.0** | **176469.0**  | *GCC 7.1.1* with the compressed instructions set.\nRISC-V simulator   | latest  | **77719.0** | **184074.0**  | *GCC 8.3.1* with the compressed instructions set.\n\"River\" CPU        | latest  | **48581**   | **135432.0**  | *GCC 8.3.1* with the compressed instructions set.\nARM simulator      | latest  | **78451.0** | **162600.0**  | *arm-none-eabi-gcc 7.2.0*, ARM ISA only.\nCortex-R5 ARM      | No      | **20561.0** | **42401.0**   | *arm-none-eabi-gcc 7.2.0*, custom FPGA system:\u003cbr\u003e Single-Core, MPU enabled, **Caches disabled**.\nCortex-R5 ARM      | No      | **54052.0** | **132446.0**  | *arm-none-eabi-gcc 7.2.0*, custom FPGA system:\u003cbr\u003e Single-Core, MPU enabled, **Caches enabled**.\nCortex-M3 Thumb2   | [arm_vhdl](https://github.com/sergeykhbr/arm_vhdl) | soon       | soon          | *arm-none-eabi-gcc 7.2.0*, custom FPGA system\n\"LEON3\" SPARC V8   | No      | **48229.0** | **119515.0**  | *sparc-elf-gcc 4.4.2*, custom FPGA system.\n\nAccess to all memory banks and peripheries for all targets (including ARM and Leon3) is made \nin the same clock domain and always is one clock (without wait-states).\nSo, this benchmark  result (**Dhrystone per seconds**) shows performance of \nthe CPU with integer instructions and degradation of the CPI relative ideal \n(simulation) case.\n\nCPU         | Clocks-Per-Instruction,\u003cbr\u003e CPI | Description.\n------------|:-------:|:------------------------------\nCortext-R5  | 1.22    | This is **dual-issue** processor capable to execute a pair of instructions per\u003cbr\u003e one clock. It's a very good but quite expensive CPU.\nLEON3       | 1.5     | CPI information from [here](https://www.gaisler.com/index.php/products/simulators/tsim).\nRiver       | 1.35    | Free-to-use and highly customizable CPU. I/D caches are enabled: 4-ways, 16 KB each. [Reference Manual](docs/riscv_vhdl_trm.pdf).\nCortex-M3   | soon    | RTL is under development.\n\n   **Since the tag 'v7.0' RIVER CPU is the main processor in the system and all issues\n     related to Rocket-chip instance will be supported only by request.**\n\n## Repository structure\n\nThis repository consists of three sub-projects each in own subfolder:\n\n- **rtl** is the folder with VHDL/Verilog sources of the SOC\n  including synthesizable processors *\"Rocket\"* and *\"River\"* and peripheries. \n  Source code is portable on almost any FPGA is due to the fact that\n  technology dependant modules (like *PLL*, *IO-buffers* \n  etc) instantiated inside of \"virtual\" components \n  in a similar to Gailser's *[GRLIB](www.gailser.com)* way.  \n  Full SOC design without FPU occupies less than 5 % of FPGA resources (Virtex6). \n  *\"Rocket-chip\"* CPU itself is the modern **64-bits processor \n  with L1-cache, branch-predictor, MMU and virtualization support**.  \n  This sub-project also contains:\n    * *fw_images*: directory with the ROM images in HEX-format.\n    * *prj*: project files for different CADs (Xilinx ISE, ModelSim).\n    * *tb*: VHDL testbech of the full system and utilities.\n    * *bit_files*: Pre-built FPGA images for ML605 and KC705 boards.\n- **examples** folder contains several C-examples that could help start working\n  with the RISC-V system:\n    * *boot* is the code of the Boot Loader. It is also used for the SRAM \n      initialization with the FW image and it allows to run examples on\n      FPGA without using the debugger and external flash memory.\n    * *helloworld* the simplest example with UART output.\n    * *isrdemo* example with 1 second interrupt from timer and debug output.\n    * *zephyr* is ported on RISC-V 64-bits operation system.\n      Information about this Real-Time Operation System for Internet of\n      Things Devices provided by [Zephyr Project](https://www.zephyrproject.org/).\n      Early support for the Zephyr Project includes Intel Corporation,\n      NXP Semiconductors N.V., Synopsys, Inc. and UbiquiOS Technology Limited.\n- **debugger**. The last piece of the ready-to-use open HW/SW system is\n  [Software Debugger (C++)](http://sergeykhbr.github.io/riscv_vhdl/sw_debugger_api_link.html)\n  with the full system simulator available as a plug-in.\n  Debugger interacts with the target (FPGA or Software Simulator) \n  via [Ethernet](http://sergeykhbr.github.io/riscv_vhdl/eth_link.html)\n  using EDCL protocol over UDP. To provide this functionality SOC includes\n  [**10/100 Ethernet MAC with EDCL**](http://sergeykhbr.github.io/riscv_vhdl/eth_link.html)\n  and [**Debug Support Unit (DSU)**](http://sergeykhbr.github.io/riscv_vhdl/periphery_page_1.html)\n  devices on AMBA AXI4 bus.\n\n# Step I: Simple FPGA test.\n\nYou can use the pre-built FPGA image (for Xilinx ML605 or KC705 board) and any serial\nconsole application (*putty*, *screen* or other) to run Dhrystone v2.1 benchmark as \non the animated picture below.\n\n![Zephyr demo](docs/doxygen/pics/zephyr_demo.gif)\n\n1. Unpack and load file image *riscv_soc.bit* from */rtl/bit_files/* into FPGA board.\n2. Connect to serial port. I used standard console utility *screen* on Ubuntu.\n\n        $ sudo apt-get install screen\n        $ sudo screen /dev/ttyUSB0 115200\n\n3. Use button \"*Center*\" to reset FPGA system and reprint initial messages (or just press Enter):\n\nTo end the session, use *Ctrl-A*, *Shift-K*\n\n# Step II: Build and run Software models with GUI.\n\nHow to build simulator from  scratch see [here](https://github.com/sergeykhbr/riscv_vhdl/tree/master/debugger)\n\nIt should look like the following:\n\n![Debugger demo](docs/doxygen/pics/debugger_demo.gif)  \n\nThere's dependency of two others open source projects:\n\n* **[Qt-libraries](https://www.qt.io/download/)**\n* **[SystemC library](http://accellera.org/downloads/standards/systemc)**\n\n\n# Step III: Build FPGA image\n\nDefault VHDL configuration enables River CPU with full debug support.\n\n![River top](docs/doxygen/pics/river_top.png)\n\n\n1. Open ML605 project file for Xilinx ISE14.7 *prj/ml605/riscv_soc.xise*\n   or KC705 project file for Xilinx Vivado *prj/kc705/riscv_soc.xpr*.\n2. Edit configuration constants in file **work/config_common.vhd** if needed.\n   (Skip this step by default).\n3. Use *rtl/work/tb/riscv_soc_tb.vhd\"* testbench file to verify\n   full system including *CPU*, *UART*, *Timers*, *Ethernet*, *GPIO* etc.\n4. Generate bit-file and load it into FPGA.\n\n\n## Doxygen project documentation\n\n[http://sergeykhbr.github.io/riscv_vhdl/](http://sergeykhbr.github.io/riscv_vhdl/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeykhbr%2Friscv_vhdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergeykhbr%2Friscv_vhdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeykhbr%2Friscv_vhdl/lists"}