Suggestions on how to learn chisel?

551 views
Skip to first unread message

Po-wei Huang

unread,
Jun 10, 2017, 12:53:59 PM6/10/17
to chisel...@googlegroups.com
Hi Chisel users,
Because of Rocket and Boom, I’m interested in chisel.
However, after I read the chisel manual, it seems that the code in Rocket and BOOM used a lot of Scala feature and techniques.
So, should I learn scala first, and then go to chisel? Or is there any other strategy?

If anyone could share his experience on learning chisel, I will be deeply appreciated!
I haven’t learned functional programming before. ( I got a EE degree for my BS, and I didn't thought about learning functional programming in my BS…)
But I do get good understanding of verilog/systemverilog/C++ and a little bit of Java.

I found that other people in risc-v hw-dev mailing list also have similar thought, ex. quotes from Mr.Eldridge.
So, I will be really appreciated for your help. Any viewpoint from HW or SW engineers will be great!

BTW, about my personal experience: 
I really try to learn chisel seriously. So, after buying some books on Scala, I went to hackerank and started practicing scala.They had a section on functional programming.
But I’m not sure whether this is a good route to learn chisel. It looks like a long path, but I don’t know better way now.

Thanks in ahead,
Po-wei

Quote from Mr.Eldridge
"Related to this, I've struggled with what is the best way to introduce someone to Chisel and get them up to speed as quickly as possible. Stream of consciousness thoughts:
  * What order should people learn? Is knowledge of Scala (or some other functional programming, e.g., Haskell or computer science knowledge re: the lambda calculus) necessary first or should this be mixed in later?
  * Do people start with very structural Verilog-like Chisel and then scale up from there? This is how I got going, but I think this is highly inefficient. I would routinely run into something that I wanted to do (e.g., pass in the IO to a module as a parameter) and then have to go figure out how to do it in Scala first.
  * Is there a pedagogy here for what concepts should be introduced and when?
  * Alternatively, does it just take effort and time?"

開始轉寄郵件:

寄件人: kritik bhimani <bhiman...@gmail.com>
標題: Re: [hw-dev] Coding style of Rocket a barrier to adoption of Rocket
日期: 2017年6月5日 GMT+8 下午2:33:35
收件人: RISC-V HW Dev <hw-...@groups.riscv.org>

my blog post https://codelec.github.io/gsoc/gsoc1/ 

On Wednesday, May 31, 2017 at 12:48:19 AM UTC+5:30, Stefan Wallentowitz wrote:
Hi Krste and all,

On 30.05.2017 18:34, kr...@berkeley.edu wrote:
> Chisel advocacy/opposition is not a great topic for this mailing list.
> Nothing requires using Chisel to use RISC-V.  There are many
> open-source and commercial RISC-V cores not written in Chisel.  While
> Rocket Chip has been the largest (but not only) driver of Chisel
> language development, there is a separate Chisel users mailng list to
> discuss Chisel features and to complain about lack of Chisel tutorial
> material, and to volunteer to help write some.

Fully agree. Also please note my comments were not meant as criticism,
but as highlighting the usual problems open source projects at a high
pace face that gain a lot of attraction.

> Rocket was never meant or marketed as "the" reference implementation,
> and the Rocket Chip code base is complex partly because it is a
> complete SoC generator, not just a single processor core.

Sorry, that was my misconception.

> There are also the Sodor cores, now being updated thanks to Google
> summer of code (and Stefan!), which are examples of simpler Chisel
> coding style as well as being useful pedagogical processor core
> designs.

Great chance for advertisement, thanks!

Chris Celio and I are mentoring a Google Summer of Code student, Kritik
Bhimani, that updates the Sodor repository to Chisel3 and the latest
privileged spec. I assume Kritik will soon post an initial blog article
about the roadmap and how to best follow the work. If you are interested
you can join us on Gitter (https://gitter.im/librecores/riscv-sodor) or
follow the Github repo (https://github.com/librecores/riscv-sodor, stuff
will apparently be pushed upstream).

Cheers,
Stefan


--
You received this message because you are subscribed to the Google Groups "RISC-V HW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hw-dev+un...@groups.riscv.org.
To post to this group, send email to hw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/hw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/hw-dev/f198f559-8324-42e9-893d-928d12b578ad%40groups.riscv.org.

Foutse YUEHGOH

unread,
Jun 12, 2017, 4:15:53 AM6/12/17
to chisel-users
Hi!
I am new on both Chisel and verilog. But to me since you know verilog, you have chances to learn chisel more faster along site with scala. The tutorial assumes no knowledge in scala from the user, so a startegy I could propose is you try to understand the differences between, chisel and verilog. See the additional features and way of defining this in chisel, try to compare the corresponding generated verilog code from chisel and with your notion in verilog, I think you will understand it much faster.
I hope this helps.
Since we are both new in chisel and you are good at verilog, maybe I can seek help from you on verilog, if you don't mind.

Po-wei Huang

unread,
Jun 12, 2017, 7:53:38 AM6/12/17
to foutse....@aims-senegal.org, chisel...@googlegroups.com
Hi,
Thanks for your feedback. Merci beaucoup!

I’ve seen the tutorial, but haven’t read through the compiled verilog code thoroughly. I will try that.
But my problem is more about those scala features like trait and pattern matching. I thought the best way now is to study scala instead of avoding it.
No problem. I could help you if you have some problems about verilog.

Best
Po-wei

You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
To post to this group, send email to chisel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/1fc824e9-c60c-4a43-9a52-92540a9e84b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Po-wei Huang

unread,
Jun 29, 2017, 1:37:20 PM6/29/17
to chisel...@googlegroups.com
Hi all,
Thanks for everyone who helped me before. 
While I’m only a beginner on chisel, I could share some experience about how I picked up chisel.

So, after the previous email, I got a book about Scala (Scala for the impatient), and read some chapters.
I read those chapters about trait, higher order function, object, pattern matching, collections, and maps. 
IMO, these are the most important concept to understand rocket. 

Besides getting a book, the website of scala tutorial from twitter might also be useful.

Then, I came to chisel wiki, and read the user guide. That guide is helpful, and after you read the concepts above, you could read the code example easily.
Or you could go to CS250 scala and chisel page on chisel wiki. That’s also a good piece.

After these two steps with some code example,  I’m not afraid of chisel code now. It’s really a good language.

So here are some advantages and thought I had when I learn chisel:
Adv 1.No clock or reset at every always_FF

Adv 2.Simpler expression for synchronous circuit: when, reg(next=x). 
These are all good. I had to write a lot in verilog for simple circuit that delay for one cycle.
Adv 3. Reuse the library of scala
I mean the ROM table of sin function in chisel-wiki. To make a rom table, I need to use other language, and save the result into a file. Then, I had to use verilog to get the parameter. Now, I could reuse the math library in scala.
However, myHDL could also do that. We could use python libraries. So, it looks like a feature as long as we use popular languages with many libraries.
Adv and Q4. Functional syntax from scala
The map. I could use a.map(b) to connect every element to a function or to a circuit. 
I don’t need to write for loop. In verilog, there are a lot  for(….) a[i]=b; It’s ugly.

Besides this, is there any reason why chisel adopt functional language like scala? I’m a new comer to functional language, so I’m interested in that.
Adv and Q 5. OO. But systemverilog also got this. So, my first intuition is that an OO+func language is needed, so scala is picked. Then, it comes again, why functional for next gen HDL?

These are the advantages  and questions I found for chisel. I know there are more strengths, like more parameterizable. But I haven’t deeply captured this. Maybe I would share it later.
Thank you and any feedback will be appreciated.

Thanks,
Po-wei 
Reply all
Reply to author
Forward
0 new messages