Giter VIP home page Giter VIP logo

vexriscv-verilog's Introduction

General informations

This repository contain a Wishbone VexRiscv configuration in :
src/main/scala/vexriscv GenCoreDefault.scala

  • RV32IM
  • 5 stage : F -> D -> E -> M -> WB + fully bypassed
  • single cycle ADD/SUB/Bitwise/Shift ALU
  • i$ : 4 kB 1 way
  • d$ : 4 kB 1 way + victim buffer
  • Branch prediction => Static
  • branch/jump done in the M stage
  • memory load values are bypassed in the WB stage (late result)
  • 33 cycle division with bypassing in the M stage (late result)
  • single cycle multiplication with bypassing in the WB stage (late result)
  • Light subset of the RISC-V machine CSR with an 32 bits external interrupt extension
  • Available in normal an -Debug, with the Debug bus exposed

Requirements

  • Java 8
  • SBT (Scala build tool, kind of make file but for scala)

On Debian =>

sudo add-apt-repository -y ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y
sudo update-alternatives --config java
sudo update-alternatives --config javac

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt -y

Usages

Generate the verilog from default core configuration :
sbt "runMain vexriscv.GenCoreDefault"

Note : The first time you run it it will take time to download all dependancies (including Scala itself). You have time to drink a coffee.

Cleaning SBT :
sbt clean reload
Updating the VexRiscv :

The build.sbt file is the "makefile" of this scala project. In it you can update the following lines to change the VexRiscv version :

lazy val vexRiscv = RootProject(uri("VexRiscvGitRepositoryUrl[#commitHash]"))

If you want you can also use a local folder as a VexRiscv version :

lazy val vexRiscv = RootProject(file("local/path/to/the/VexRiscv"))
Configuration options :

VexRiscv supports several configuration options:

  • -d: If specified, builds VexRiscv with a debug bus
  • -dCacheSize=cacheSize: Specify the data cache size. Defaults to 4096.
  • -iCacheSize=cacheSize: Specify the instruction cache size. Defaults to 4096.
  • **-mulDiv=**true/false: Include multiplication/division circuitry.
  • **-singleCycleMulDiv=**true/false: If this option is true, multiplication, division, and shifting are optimized for speed. Otherwise, they are optimized for area.

As an example, you can build a VexRiscv core with a 2048-byte cache size by running:

sbt "runMain vexriscv.GenCoreDefault -d --iCacheSize=2048"

VexRiscv-Lite.v was built using:

sbt "runMain vexriscv.GenCoreDefault --iCacheSize 2048 --dCacheSize 0 --mulDiv true --singleCycleMulDiv false"

vexriscv-verilog's People

Contributors

cr1901 avatar dolu1990 avatar enjoy-digital avatar joannabrozek avatar occheung avatar sbourdeauducq avatar xobs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vexriscv-verilog's Issues

Add VexRISCV configuration suitable for iCE40 sized devices

The current VexRISCV configuration works well on big FPGAs like the Artix-7 and Spartan 6 but is too big for the tiny iCE40 based devices.

It would be good to add a variant which works well on the iCE40, two options seem to exist;

VexRiscv small and productive (RV32I, 0.82 DMIPS/Mhz)  ->
  Artix 7    -> 327 Mhz 698 LUT 558 FF
  Cyclone V  -> 158 Mhz 524 ALMs
  Cyclone IV -> 146 Mhz 1,061 LUT 552 FF
  iCE40      -> 55 Mhz 1541 LC

VexRiscv small and productive with I$ (RV32I, 0.72 DMIPS/Mhz, 4KB-I$)  ->
  Artix 7    -> 331 Mhz 727 LUT 600 FF
  Cyclone V  -> 152 Mhz 536 ALMs
  Cyclone IV -> 156 Mhz 1,075 LUT 565 FF
  iCE40      -> 54 Mhz 1686 LC

It probably good to steal the VexRISCV configuration from the MuraxSoC configuration;

Depending the CPU configuration, on the ICE40-hx8k FPGA with icestorm for synthesis, the full SoC has the following area/performance :

RV32I interlocked stages => 51 Mhz, 2387 LC 0.45 DMIPS/Mhz
RV32I bypassed stages => 45 Mhz, 2718 LC 0.65 DMIPS/Mhz
Its implementation can be found here: src/main/scala/vexriscv/demo/Murax.scala.

Merging VexRiscv 1.1

Hi,

VexRiscv 1.1 was just released. And improved/fix/added stuff :

  • Compatible with mainline linux
  • Write-throug data cache
  • Better RISC-V CSR compliance
  • Fix some bugs occurring when using both exception and interruptions.

If that's fine for you, i will merge it into VexRiscv-verilator.
Also if i do so, i would like to move the VexRiscv dependance from SBT to a regular git submodule.

VexRiscv-Min variant misbheaving

Swapping between the Min and Lite variant produces drastically different results.

AFAICT the 'Min' variant is skipping some instructions, executing some of them twice (I see doubled up memory writes), ...

All on very simple design with just one bram connected to instruction port and one to the data port.

Has anyone run the -Min variant ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.