• Stars
    star
    219
  • Rank 181,133 (Top 4 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 7 months ago

Reviews

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

Repository Details

A Library of Chisel3 Tools for Digital Signal Processing

DSP Tools Development Environment

Test

This repository serves as a good starting point for making and easily testing your various DSP generators in Chisel (1 generator at a time). See UC Berkeley Chisel homepage for more information about Chisel.

For a list of common errors, check out the wiki page. Feel free to add your own!


Key Enhancements

Dsptools is a library that can be used with any Chisel library. Some of the goals of dsptools are to enable:

  1. Pipeline delay checking (Isn't it annoying when the delays of two signals into an operation don't line up because you forgot to delay a corresponding signal in your haste to close timing?)

  2. Enhanced support for designing and testing DSP with generic types (i.e. switching between DSPReal for verifying functional correctness with double-precision floating point and FixedPoint for evaluating fixed-point design metrics by changing a single parameter).

  3. More useful and universal testing platform for numeric types!

Numbers are displayed in their correct formats instead of hex for peek, poke, and expect operations. Additionally, if your tester extends DSPTester, you can optionally dump your test sequence to a Verilog testbench that replays the test for functional verification on all simulation platforms (i.e. Xilinx, Altera, etc. instead of only VCS). The tolerance of comparisons with expected values can also be changed via DSPTester.setTol(floTol = decimal_tolerance, fixedTol = number_of_bits).

  1. Miscellaneous additional features
  • Wide range of LUT modules for ease of generating lookup tables from pre-calculated constants (no intermediate representation)
  • Memory modules that abstract out confusion associated with Chisel Mem
  • Generates useful helper files with each Verilog output (constraints, generator parameters used, etc.).
  • Easier to rename modules & signals and have renaming actually succeed.
  • Expanding Support for non-base-2 math.
  • Adds support for numerical processing in the Chisel Environment via Breeze.

Getting Started

Dsptools is published alongside Chisel, FIRRTL, and the other related projects. It can be used by adding

libraryDependencies += "edu.berkeley.cs" %% "dsptools" % "XXXX"

to your build.sbt, where XXXX is the desired version. See Github for the latest release. Snapshots are also published on Sonatype, which are beneficial if you want to use the latest features.

Projects that dsptools depends on are:


Numeric Typeclasses

This library defines a number of typeclasses for numeric types. A brief explanation of how typeclasses work in scala can be found here and here. Our DSP-specific typeclasses are built on top of spire.

The goal of these typeclasses is to make it easy to write chisel modules that treat the number representation as a parameter. For example, using typeclasses you can write chisel that generates an FIR filter for both real and complex numbers. You can also use typeclasses to write chisel that generates a circuit implementation using floating point (via Verilog's real type). After testing that your circuit implementation works with floating point, you can use the same code to generate a fixed point version of the circuit suitable for synthesis.

For a additional, more detailed description of the Numeric classes in dsptools: see The Numbers ReadMe

A generic function in scala is defined like so:

def func[T](in: T): T

This means that you can call func(obj) for an object of any type. If obj is of type Q, you can write func[Q](obj) to specify that we want the Q version of the generic function func, but this is only necessary if the scala compiler can't figure out what Q is supposed to be.

You can also write

class SomeClass[T]

and use T like it is a real type for any member functions of variables. To write a generic chisel Module, we might try to write

class Passthrough[T](gen: T) extends Module {
  val io = new IO(Bundle {
    val in = Input(gen)
    val out = Output(gen)
  })
  io.out := io.in
}

Here, gen is a parameter specifying the type you want to use for your IO's, so you could write Module(new Passthrough(SInt(width=10))) or Module(new Passthrough(new Bundle { ... })). Unfortunately, there's a problem with this. T can be any type, and a lot of types don't make sense, like String or ()=>Unit. This will not compile, because Input(), Output(), and := are functions defined on chisel types. We can fix this problem by writing

class Passthrough[T<:Data](gen: T) extends Module

This type constraint means that we have to choose T to be a subtype of the chisel type Data. Things like UInt, SInt, and Bundle are subtypes of Data. Now the example above should compile. This example isn't very interesting, though. Data lets you do basic things like assignment and make registers, but doesn't define any mathematical operations, so if we write

class Doubler[T<:Data](gen: T) extends Module {
  val io = IO(new Bundle {
    val in = Input(gen)
    val out = Output(gen)
  })
  io.out := io.in + io.in
}

it won't compile. This is where typeclasses come in. This library defines a trait

trait Real[T] {
  ...
  def plus(x: T, y: T): T
  ...
}

as well as an implicit conversion so that a+b gets converted to Real[T].plus(a,b). Real[T] is a typeclass. Typeclasses are a useful pattern in scala, so there is syntactic sugar to make using them easy:

import dsptools.numbers._
class Doubler[T<:Data:Real](gen: T) extends Module

Note: If you don't include the :Real at the end, the scala compiler will think io.in + io.in is string concatenation and you'll get a weird error saying

[error]  found   : T
[error]  required: String

Some useful typeclasses:

  • Ring

    • defines +, *, -, **, zero, one
    • defined in Spire
    • Read: https://en.wikipedia.org/wiki/Ring_(mathematics)
    • Note: We chose to restrict ourselves to Ring rather than Field because division is particularly expensive and nuanced in hardware. Rather than typing a / b we think it is better to require users to instantiate a module and think about what's going on.
  • Eq

    • defines === and =/= (returning chisel Bools!)
  • PartialOrder

    • extends Eq
    • defines >, <, <=, >= (returning a ValidIO[ComparisonBundle] that has valid false if the objects are not comparable
  • Order

    • extends PartialOrder
    • defines >, <, <=, >=, min, max
  • Sign

    • defines abs, isSignZero, isSignPositive, isSignNegative, isSignNonZero, isSignNonPositive, isSignNonNegative
  • Real

    • extends Ring with Order with Sign
    • defines ceil, round, floor, isWhole
    • defines a bunch of conversion methods from ConvertableTo, e.g. fromDouble, fromInt
  • Integer

    • extends Real
    • defines mod

Rocket-chip

Integration of dsptools with a rocket-chip based project:

The github project Rocket Dsp Utils contains useful tools that can be used to integrate components from this project with a rocket-chip based one.

These tools formerly were contained in this repo under the rocket sub-directory.


This code is maintained by Chick, Angie and Paul. Let us know if you have any questions/feedback!

Copyright (c) 2015 - 2021 The Regents of the University of California. Released under the Modified (3-clause) BSD license.

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

chisel-tutorial

chisel tutorial exercises and answers
Scala
643
star
5

riscv-mini

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

chisel2-deprecated

Scala
387
star
7

fpga-zynq

Support for Rocket Chip on Zynq FPGAs
Tcl
378
star
8

berkeley-hardfloat

Scala
264
star
9

hammer

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

chiseltest

The batteries-included testing and formal verification library for Chisel-based RTL designs.
Scala
220
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