Giter VIP home page Giter VIP logo

twitchcore's Introduction

twitchcore

A RISC-V core, first in Python, then in Verilog, then on FPGA.

Getting Started

Prerequisites

  • icarus-verilog
  • riscv-gnu-toolchain
brew install icarus-verilog riscv-gnu-toolchain

Installation

  1. Clone this repo
git clone https://github.com/geohot/twitchcore
cd twitchcore
  1. Clone and build riscv-tests
git clone https://github.com/riscv/riscv-tests
cd riscv-tests
git submodule update --init --recursive
autoconf
./configure
make
make install
cd ..
  1. Create a virtual environment (optional)
python3 -m venv env
source env/bin/activate
  1. Install Python packages
pip install -r requirements.txt

TODO

  • Fix unaligned loads/stores (I think this is good now, at least acceptable)
  • Make pipelining work
  • Add M instructions for fast multiply and divide
  • Add better introspection
  • Switch to 64-bit
  • Add "RISK" ML accelerator ("K" Standard Extension)

TODO (later)

  • Many ROBs like M1 go very fast

Notes on Memory system

8 million elements (20MB) = 23-bit address path

We want to support a load/store instruction into 32x32 matrix register (2432 bytes) like this:

  • Would be R-Type with rs1 and rs2 (64-bit)
  • rs1 contains the 23-bit base address, plus two masks in the upper bytes (0 is no mask)
  • rs2 contains two 24-bit strides for x and y. Several of these bits aren't connected
  • "rd" is the extension register to load into / store from

Use some hash function on the addresses to avoid "bank conflicts", can upper bound the fetch time.

Notes on ALU

matmul/mulacc are the big ones, 65536 FLOPS and 2048 FLOPS respectively

Have to think this through more with the reduce instructions too.

It's okay if the matmul takes multiple cycles I think, but the mulacc would be nice to be one.

matmul

  • load with stride 0 in X
  • mul
  • reduce

Notes on mini edition in 100T

16x16 registers (608 bytes), 256 FMACs (does it fit)

  • 128k elements = 17-bit address path
  • rs1 = 2x4-bit masks + 17-bit address
  • rs2 = 2x16-bit strides

How to run a RISC-V test:

You can run a risc-v test (source code available in firmwares) by:

 ./simulate.sh firmwares/add.hex    

twitchcore's People

Contributors

geohot avatar hossein1387 avatar icodecoolstuff avatar jla524 avatar

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.