-
Notifications
You must be signed in to change notification settings - Fork 21
Tutorial page 7
- at the end, a collection of advanced examples that people have asked the Hangout about (we have this page already, just clean up the extra stuff at the end -- move it to the reference page already created)
This is catchall -- examples that aren't specifically supporting the previous two pages go here.
Aleksandar: I am providing a copy of the Advanced Examples of Using Chisel from here to the bottom of this page - just in case.
Now that the basics are covered, we take examples directly from Sodor code, and explain them, here. This is a live wiki, continually expanding.
There is a Hangout dedicated to this learning journey. Each Saturday we make a point of being live, to ask and answer Chisel questions. https://hangouts.google.com/?action=group&key=qOKQrvMjplnJAC133&pli=1
If you come across an example that you would like to ask about, do this:
- Use the web interface to browse the code, to the line that you want to ask about.
- move the mouse to the left, and click on the line number. This will make a "..." appear.
- use the mouse to expand the "..." and choose "copy permalink".
- Decide whether you want to ask on the Hangout, or Stackoverflow, or just paste to the Suggestions page.
- if hangout, go to link above, and ask -- paste the permalink and maybe a snippet of the code if it's simple code
- If suggestions page, make a page for yourself (can make it "anonymous X" or use your name) then paste question to the new page
- if stackoverflow, go to https://stackoverflow.com/ and click "ask question" then type title that gives a hint about the code
- In the body, say a bit about the context and paste the permalink.
- It is very important to add the right tags to the questions. At the bottom of the quesiton, in the entry box, type "chisel" to add it, and then "riscv" to add that tag too.
- someone who monitors those tags will post an answer. Alert us that the question has been asked, by pasting a link to the question on the suggestions for improvement to Learning Journey page. Someone who supports this wiki will turn that answer into a new wiki page.
These examples have been taken from Sodor code, and from Rocket Chip code
map function val misa = BigInt(0) | isa_string.map(x => 1 << (x - 'A')).reduce(_|_)
Parameterization as used in Sodor and Rocket Chip
Outside site with helpful info about Rocket code
Comments on challenges of Object Oriented style of writing hardware definitions
As promised, here are those Chisel documents again. They should make more sense now that you've done some hands-on Chisel coding:
-
Chisel 2012 DAC Paper Still just skim this, but now some of the code in it should look familiar. The examples on this page will walk through the coding examples in the paper.
-
Chisel cheatsheet This cheatsheet should start being useful now. Many of the constructs may still be too advanced, but by the end of these examples, you should have seen most of what's in the cheat sheet.
-- break down the line of code
Give examples of lines of code that have both chisel and scala constructs, and break the line down, going piece by piece, and say what scala construct that is, and give a link to a scala page that talks about that construct (NOT the scala manual! But one of the helpful tutorial pages that talks about that specific construct and related ones.. like the link I found around tabulate).
Maybe give some more information about how chisel code is almost 95% constructors -- running Chisel program pretty much all it does is go from constructor to constructor. And talk about how Chisel is for quick and dirty -- we won't use it for everything -- in places where we need to optimize the code, we'll use "black box" in Chisel, and write verilog for that critical piece, where we need control.
We have also provided some examples of more complex circuits _chisel-tutorial/examples_
. You should take a look at the source and test them out:
$ cd examples
$ make
To know more about Chisel and get an in-depth analysis, you could quickly go through the Chisel Tutorial page.
Once you have Scala working in that web environment, then if you are feeling confident, perhaps set up the Chisel environment (but don't do the examples yet!), and then do some of the scala tutorial examples inside Chisel tutorial environment (For example, just copy Mux2 to a new file, then add the Sala code to the file.
This bootcamp is an alternative that covers multiple aspects: introduction to Scala, basics of Chisel2, generating verilog, making a test harness, and so on: bootcamp
rearrange the rest of these links and text according to the above structure. Pick out the best links for getting a quick idea of Chisel syntax. Don't want hands on here yet. Just reference material on syntax -- the cheat sheet -- the white paper about Chisel
-
There is a lot of content about Chisel available on the internet as well. Most of the information is captured in a stackoverflow question, the same is replicated here -
-
A Chisel 2 documentation page, including tutorial, manual, and cheat-sheet: https://chisel.eecs.berkeley.edu/documentation.html
-
Chisel 3 wiki: https://github.com/ucb-bar/chisel3/wiki
4.Style guide, which helps those new, like me, understand nuances and figure out how to do non-obvious things: https://github.com/ccelio/chisel-style-guide
- This page has a list of repositories, including chisel example code, a skeleton for new projects, tutorials, documentation (see below): https://github.com/ucb-bar
- The Chisel user group: https://groups.google.com/forum/#!forum/chisel-users =====================================================
Some items extracted from the above ucb-bar page:
- A skeleton for "clean" new Chisel projects: https://github.com/ucb-bar/pwm-chisel-example
- Teaching processors (Simple RISC-V processors, as examples to learn Chisel): https://github.com/ucb-bar/riscv-sodor
- wiki for teaching processors: https://github.com/ucb-bar/riscv-sodor/wiki
- Test harnesses for testing Chisel modules -- [edit] warning: early version for Chisel3, which seems limited to non-interactive tests: https://github.com/ucb-bar/chisel-testers
- Chisel tutorial: https://github.com/ucb-bar/chisel-tutorial
- Chisel-doc repository, with its own makefile, that builds documentation: https://github.com/ucb-bar/chisel-doc
- Chisel quick video tutorial https://www.youtube.com/watch?v=pfM1WUWbfBs&t=286s