Giter Site home page Giter Site logo

chisel's Introduction

About Chisel

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

Chisel is embedded in the Scala programming language, which raises the level of hardware design abstraction by providing concepts including object orientation, functional programming, parameterized types, and type inference.

Chisel can generate a high-speed C++-based cycle-accurate software simulator, or low-level Verilog designed to pass on to standard ASIC or FPGA tools for synthesis and place and route.

Visit the community website for more information.

Getting started

Chisel Users

To start working on a circuit with Chisel, create simple build.sbt and scala source file containing your Chisel code as follow.

$ cat build.sbt
scalaVersion := "2.10.2"

resolvers ++= Seq(
  "scct-github-repository" at "http://mtkopone.github.com/scct/maven-repo"
)

libraryDependencies += "edu.berkeley.cs" %% "chisel" % "latest.release"

(You want your build.sbt file to contain a reference to Scala version greater or equal to 2.10 and a dependency on the Chisel library.)

Edit the source files for your circuit

$ cat Hello.scala
import Chisel._

class HelloModule extends Module {

    val io = new Bundle {}

    printf("Hello World!\n")
}

class HelloModuleTests(c: HelloModule) extends Tester(c, Array(c.io)) {
    defTests {
        true
    }
}

object hello {
    def main(args: Array[String]): Unit = {
        chiselMainTest(Array[String]("--backend", "c", "--genHarness"),
            () => Module(new HelloModule())){c => new HelloModuleTests(c)}
    }
}

At this point you will need to download and install sbt for your favorite distribution. You will need sbt version 0.12.4 or higher because recent versions of sbt generate jars without the scala third-point version number (i.e. chisel_2.10-2.0.2.jar instead of chisel_2.10*.2*-2.0.2.jar).

Execute sbt run to generate the C++ simulation source for your circuit

$ sbt run

Compile the resulting C++ output to generate a simulation executable

$ g++ -std=c++11 -o HelloModule HelloModule.cpp HelloModule-emulator.cpp

Run the simulation executable for one clock cycle to generate a simulation trace

$ ./HelloModule 1
Hello World!

Going further, you should read on the sbt directory structure to organize your files for bigger projects. SBT is the "official" build system for Scala but you can use any other Java build system you like (Maven, etc).

Chisel is implemented 100% in Scala!

Chisel developers

Before you generate a pull request, run the following commands to insure all unit tests (with code coverage) pass and to check for coding style compliance respectively.

$ sbt scct:test
$ sbt scalastyle

You can follow Chisel metrics on style compliance and code coverage on the website.

If you are debugging an issue in a third-party project which depends on the Chisel jar, first check that the chisel version in your chisel code base and in the third-party project library dependency match. After editing the chisel code base, delete the local jar cache directory to make sure you are not picking up incorrect jar files, then publish the Chisel jar locally and remake your third-party project. Example:

$ cat *srcTop*/chisel/build.sbt
...
version := "2.1-SNAPSHOT"
...

$ cat *srcTop*/riscv-sodor/project/build.scala
...
libraryDependencies += "edu.berkeley.cs" %% "chisel" % "2.1-SNAPSHOT"
...

$ rm -rf ~/.sbt ~/.ivy2
$ cd *srcTop*/chisel && sbt publish-local
$ cd *srcTop*/riscv-sodor && make run-emulator

Publishing to public Maven repo:

$ diff -u build.sbt
-version := "2.1-SNAPSHOT"
+version := "2.1"

$ sbt publish-signed

chisel's People

Contributors

jackbackrack avatar huytbvo avatar aswaterman avatar bwrcbcr avatar jcmartin avatar hcook avatar kasanovic avatar yunsup avatar marmbrus avatar sdtwigg avatar schoeberl avatar ccelio avatar metanest avatar rimasaviz avatar sbeamer avatar

Watchers

James Cloos 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.