• Stars
    star
    643
  • Rank 70,000 (Top 2 %)
  • Language
    Scala
  • License
    Other
  • Created over 12 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

chisel tutorial exercises and answers

Chisel Tutorials (Release branch)

These are the tutorials for Chisel.

Chisel is an open-source hardware construction language developed at UC Berkeley that supports advanced hardware design using highly parameterized generators and layered domain-specific hardware languages.

Getting the Repo

$ git clone https://github.com/ucb-bar/chisel-tutorial.git
$ cd chisel-tutorial
$ git fetch origin
$ git checkout release

Executing Chisel

####Testing Your System First make sure that you have sbt (the scala build tool) installed. See details in sbt.

$ sbt run

This will generate and test a simple block (Hello) that always outputs the number 42 (aka 0x2a). You should see [success] on the last line of output (from sbt) and PASSED on the line before indicating the block passed the testcase. If you are doing this for the first time, sbt will automatically download the appropriate versions of Chisel3, the Chisel Testers harness and Scala and cache them (usually in ~/.ivy2).

Completing the Tutorials

To learn Chisel, we recommend learning by example and just trying things out. To help with this, we have produced exercises with circuits (src/main/scala/problems) and their associated test harnesses (src/test/scala/problems) which have clearly marked places to complete their functionality and simple test cases. You can compare your work with our sample solutions in (src/main/scala/solutions) and (src/test/scala/solutions). This hierarchical organization and separation of circuits and tests is a good practice and we encourage you to understand it and use it in the future. Typically when you work on a problem you will have two open editor windows (vi, emacs, IDE, etc) one to edit the circuit and the other to edit the tests.

To speed things up, we will keep sbt running. To get started:

$ sbt

Mux2

This should already work. Try

> test:runMain problems.Launcher Mux2

Note that Mux2 is defined in Mux4.scala.

Mux4

You can instantiate a module with val foo = Module(new Bar())

> test:runMain problems.Launcher Mux4

Counter

You can conditionally update a value without a mux by using when (cond) { foo := bar }

> test:runMain problems.Launcher Counter

Vending Machine

> test:runMain problems.Launcher VendingMachine

Memo

The type of memory that's inferred is based on how you handle the read and write enables. This is pretty much the same as how Xilinx and Altera infer memories.

> test:runMain problems.Launcher Memo

Mul

> test:runMain problems.Launcher Mul

RealGCD

> test:runMain problems.Launcher RealGCD

To check that all of your solutions are correct:

$ ./run-problem.sh all

To run all of our reference solutions:

$ ./run-solution.sh all

Note: ./run-problem.sh, ./run-solution.sh, ./run-examples.sh are convenience scripts to invoke tests

Learning More Chisel

In addition to the problems and the solutions, we have also provided some examples of more complex circuits (src/main/scala/examples) and (src/test/scala/examples). You should take a look at the source and test them out:

$ ./run-examples.sh all

The wiki attached to this repo contains more information on working with Chisel. Additional documentation may be found on the chisel3 repo wiki and the documentation section of the website.

Fixes/Updates

If you wish to submit pull requests for changes to this repo, plus check out the master branch, and make your pull requests against that branch.

More Repositories

1

chipyard

An Agile RISC-V SoC Design Framework with in-order cores, out-of-order cores, accelerators, and more
Scala
1,601
star
2

gemmini

Berkeley's Spatial Array Generator
Scala
793
star
3

riscv-sodor

educational microarchitectures for risc-v isa
Scala
673
star
4

riscv-mini

Simple RISC-V 3-stage Pipeline in Chisel
Scala
538
star
5

chisel2-deprecated

Scala
387
star
6

fpga-zynq

Support for Rocket Chip on Zynq FPGAs
Tcl
378
star
7

berkeley-hardfloat

Scala
264
star
8

hammer

Hammer: Highly Agile Masks Made Effortlessly from RTL
Python
253
star
9

chiseltest

The batteries-included testing and formal verification library for Chisel-based RTL designs.
Scala
220
star
10

dsptools

A Library of Chisel3 Tools for Digital Signal Processing
Scala
219
star
11

berkeley-softfloat-3

SoftFloat release 3
C
217
star
12

constellation

A Chisel RTL generator for network-on-chip interconnects
Scala
174
star
13

riscv-torture

RISC-V Torture Test
Scala
163
star
14

hwacha

Microarchitecture implementation of the decoupled vector-fetch accelerator
Scala
146
star
15

esp-llvm

UCB-BAR fork of LLVM! NOT UPSTREAM RISCV LLVM
C++
123
star
16

midas

FPGA-Accelerated Simulation Framework Automatically Transforming Arbitrary RTL
Scala
96
star
17

testchipip

Scala
80
star
18

onnxruntime-riscv

Fork of upstream onnxruntime focused on supporting risc-v accelerators
C++
79
star
19

sha3

Verilog
76
star
20

cosa

A scheduler for spatial DNN accelerators that generate high-performance schedules in one shot using mixed integer programming (MIP)
Python
72
star
21

ccbench

Memory System Microbenchmarks
C
57
star
22

gemmini-rocc-tests

Fork of seldridge/rocket-rocc-examples with tests for a systolic array based matmul accelerator
C
53
star
23

zscale

Z-scale Microarchitectural Implementation of RV32 ISA
C
53
star
24

chisel-gui

A prototype GUI for chisel-development
Scala
49
star
25

berkeley-testfloat-3

TestFloat release 3
C
46
star
26

hwacha-template

Template for projects using the Hwacha data-parallel accelerator
C
34
star
27

RoSE

A unified simulation platform that combines hardware and software, enabling pre-silicon, full-stack, closed-loop evaluation of your robotic system.
Python
33
star
28

barstools

Useful utilities for BAR projects
Scala
31
star
29

autophase

Python
28
star
30

shuttle

A Rocket-based RISC-V superscalar in-order core
Scala
26
star
31

riscv-benchmarks

C
22
star
32

MoCA

Scala
22
star
33

saturn-vectors

Chisel RISC-V Vector 1.0 Implementation
Assembly
22
star
34

libgloss-htif

A libgloss replacement for RISC-V that supports HTIF
C
21
star
35

nvdla-wrapper

Wraps the NVDLA project for Chipyard integration
Verilog
20
star
36

cva6-wrapper

Wrapper for ETH Ariane Core
Scala
20
star
37

esp-isa-sim

Custom extensions to the RISC-V isa simulator for the UCB-BAR ESP project
C
18
star
38

asyncqueue

Lightweight re-packaging of AsyncQueue library from rocket-chip
Scala
17
star
39

riscv-blas

Custom BLAS and LAPACK Cross-Compilation Framework for RISC-V
Fortran
17
star
40

fpga-spartan6

Support for zScale on Spartan6 FPGAs
Verilog
15
star
41

chisel-awl

Scala
13
star
42

dosa

DOSA: Differentiable Model-Based One-Loop Search for DNN Accelerators
Python
13
star
43

Baremetal-NN

A tool for converting PyTorch models into raw C codes that can be executed standalone in a baremetal runtime on RISC-V research chips.
C
12
star
44

rocket-dsp-utils

Tools for integrating DspTools components into a rocket-chip
Scala
11
star
45

protoacc

Scala
11
star
46

midas-examples

Simple MIDAS Examples
Scala
10
star
47

vaesa

Learning A Continuous and Reconstructible Latent Space for Hardware Accelerator Design
Python
10
star
48

firrtl-transform-tutorial

A template for developing custom FIRRTL transforms
Scala
10
star
49

hammer-cadence-plugins

Hammer plugins for Cadence tools
Python
10
star
50

FFTGenerator

Scala
9
star
51

esp-tools

Shell
9
star
52

fpga-images-zedboard

prebuilt images for zedboard zynq fpga
9
star
53

compress-acc

Scala
9
star
54

context-dependent-environments

A Scala library for Context-Dependent Evironments
Scala
9
star
55

firrtl-uclid

Scala
8
star
56

plsi-mdf

Macro description format
Scala
8
star
57

chisel-sift

Scala
8
star
58

hammer-synopsys-plugins

Hammer plugins for synopsys tools
Python
8
star
59

midas-release

MIDAS Public Release
Scala
8
star
60

fixedpoint

Chisel Fixed-Point Arithmetic Library
Scala
8
star
61

midas-top-release

MIDAS RocketChip Template
Scala
7
star
62

riscv-docker-images

Curated set of DockerFiles for RISC-V projects
Dockerfile
7
star
63

spec2017-workload

FireMarshal workload for SPEC2017
Python
7
star
64

midas-zynq

A zynq host-platform shell for midas generated simulators.
Tcl
7
star
65

spike-devices

Collection of device models for spike
C++
7
star
66

rerocc

Scala
7
star
67

Baremetal-IDE

A submodule of Chipyard https://github.com/ucb-bar/chipyard
HTML
7
star
68

maltese-smt

Archived! All relevant features are now part of the firrtl smt backend or the chiseltest library.
Scala
7
star
69

esp-tests

Custom extensions to the RISC-V tests for the UCB-BAR ESP project
C
6
star
70

nvdla-workload

Base NVDLA Workload for FireMarshal
Shell
5
star
71

hwacha-net

C
5
star
72

firrtl2

UC Berkeley Copy of the FIRRTL Compiler
Scala
5
star
73

AuRORA

Virtualized Accelerator Orchestration for Multi-Tenant Workloads
C
5
star
74

pyuartsi

A standalone implementation of the Tethered Serial Interface (TSI) in Python.
Python
5
star
75

chipyard-toolchain-prebuilt

Pre-built riscv-gnu-toolchain binaries. You should most likely only shallow clone this.
Makefile
4
star
76

pwm-chisel-example

pwm-chisel-example for risc-v summer 2016 workshop
Scala
4
star
77

cs152-lab4

CS152 Lab 4
C
4
star
78

ibex-wrapper

Wrapper for lowRISC Ibex
Scala
4
star
79

riscv-tools-feedstock

Shell
4
star
80

stac-top

The SRAM timing analysis chip for verifying SRAMs generated by SRAM22
Scala
3
star
81

opencl-kernels

OpenCL kernels for ucb-bar hardware
C
3
star
82

chipper-tutorial

tutorial for chipper
C++
3
star
83

coremark-workload

FireMarshal workload for CoreMark EEMBC
Shell
3
star
84

bits

Firebox Benchmarks
Python
3
star
85

2023-winter-demo-project-power-aka-bora

Python
3
star
86

Baremetal-llama

C
3
star
87

chipyard-cs152-sp24

C
3
star
88

riscv-coremark-pro

Compiles coremark-pro for riscv64 baremetal
Makefile
3
star
89

vcd2step

Converts a VCD file to a Chisel tester input file
C++
2
star
90

pocl

C
2
star
91

chisel-release

Chisel release tooling
2
star
92

chisel-torture

A tool that generates Chisel torture tests
C++
2
star
93

fpga-images-zybo

2
star
94

ara-wrapper

Scala
2
star
95

bar-fetchers

Berkeley Architecture Research pre-Fetchers
Scala
2
star
96

lbnl-torch

LBNL TORCH Reference Kernels
C
2
star
97

chisel-library-template

Use for developing Chisel+Firrtl libraries
2
star
98

fpga-images-zc706

2
star
99

baseband-modem

Digital baseband-modem processor for 2.4 GHz Bluetooth Low Energy and IEEE 802.15.4 standards
Jupyter Notebook
2
star
100

caliptra-aes-acc

SystemVerilog
2
star