1 of 26

Chisel Bootcamp

Hands on workshop on “Creating a

RISC V microcontroller using Chisel”

2 of 26

Outline

  • RISC-V ?
  • Getting Started with RISC-V?
  • Chisel Framework
  • Environment Setup
  • Chisel Introduction
  • Chisel Examples

3 of 26

RISC-V

01

“Risk-five” , an Open Source instruction set, and a lot more….

  • Open , but Frozen, ISA
  • Developed by Academic Community, UC Berkeley in 2010
  • Open to Customization
  • Clean State Design, No over architecturing
  • RISC V Foundation

4 of 26

Getting Started

02

--

  • GitHub : https://github.com/riscv/riscv-cores-list
  • FE310 - SOC
  • ICE40, Arty - Evaluation
  • Generators : Chisel, Bluespec.

5 of 26

Chisel Framework

03

Open Source Tools to generate Hardware Description.

1

6 of 26

Let’s start…..

7 of 26

Get equipped

https://gitlab.com/icfoss/openfpga/chisel-bootcamp/workshop/-/blob/master/README.md

8 of 26

What is chisel?

A powerful, highly abstract, HDL based on Scala

The complete power of Scala in an HDL

9 of 26

Why chisel?

Hopefully you’ll be able to answer that by the end of the session….

10 of 26

Basic Setup of a chisel project

Go ahead and clone the repo… make sure to change the name to one of your liking

https://github.com/freechipsproject /chisel-template.git

11 of 26

De-initialize the git repo

$ rm -rf .git

$git init

$git add .gitignore ./

12 of 26

Be wary of the differences

Chisel is an HDL and not a programming language.

Everything is hardware.

13 of 26

Data types

  1. Bool- Analogous to Boolean but represents the state a wire can take
  2. UInt-Analogous to conventional uint but represents a collection of Bools
  3. SInt- The signed version of UInt

14 of 26

Exercise 1

Create a simple wire through module. What goes in comes out…..

Introduction to conventions, wires and the := operator, and testing

15 of 26

Exercise 2

Create a delayed version of the previous exercise….Why? You’ll see…..

Introduction to the concept of Registers

16 of 26

Exercise 3

A single bit adder

Introduction to the Combinational Logic

17 of 26

Exercise 4

Ripple Carry Adder

Introduction to the Combinational Logic

18 of 26

Exercise 5

Adder/multiplier

Create your own adder / multiplier

19 of 26

Exercise 6

A Combinational Logic circuit:

Create your own 2 bit MUX

20 of 26

Exercise 7

Extend the MUX to 4 bits

Introduction to the Mux available in chisel

21 of 26

Exercise 8

Encoder (4x2)

22 of 26

Exercise 9

Decoder (4x2)

23 of 26

Exercise 10

Simple Packet Router

Introduction to the When statement

Simple router

Data

Rank info

High p channel

Low p channel

default

24 of 26

Exercise 11

Counter

Given what you’ve learnt so far, write your own counter

25 of 26

Exercise 12

Introduction to state machines:

The classic vending machine problem

26 of 26

Exercise 13

Packet Router

Given what you’ve learnt so far, write your own Packet router. Find the topology.