[libre-riscv-dev] Why nMigen?

Cole Poirier colepoirier at gmail.com
Tue Mar 3 07:02:38 GMT 2020


> On Mar 2, 2020, at 1:27 PM, Jacob Lifshay <programmerjake at gmail.com> wrote:
> 
> On Mon, Mar 2, 2020, 12:57 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> wrote:
> 
>> several others were eliminated as well, including doing our own HDL,
>> because we would literally be the only people in the world using it.
>> 
> 
> If that was an option, building it on Rust in a similar style to nmigen
> would be a great option because Rust has a largish user base, a lot of the
> syntax and semantics are similar to C/C++, it has a very powerful type
> system (where you can statically prove at compile-time that whatever code
> you wrote meets custom constraints), it is quite easy to install (I
> couldn't get Scala to work), it has a very powerful procedural macros
> system (generating new Rust code at compile time), and it can easily use
> yosys's APIs through FFI.
> 
> some more info:
> https://stackoverflow.blog/2020/01/20/what-is-rust-and-why-is-it-so-popular/
> 
> Jacob

I continue to adore your appreciation for rust Jacob. Speaking as someone who only started programming a bit over two years ago, my first language was python, I loved it and still love it. However I’ve spent the past year leaning rust and it has given me the ability to program things that I would never have dreamed of doing in python due to my complete lack of software engineering skills. I also feel it’s necessary to point out, that I’ve tried C and C++ but they are just so much harder and finicky, especially coming from python. These older languages are also incredibly hard to configure, build, and use libraries with, cargo is such an incredible and ergonomic feature. For me writing rust is like writing python but with a lot more useful information about the functions, types, structs, etc. as well the confidence that comes from the compile time checks and guarantees rust’s mandatory static analysis provides. What I think makes rust so much easier for me to be productive with, while developing my understanding at a good rate, is the incredibly useful feedback from the compiler (shout out to Evan Czplanski, creator of Elm, the Haskell-inspired transpiled-to-js functional UI language, which the rust compiler error helpfulness/readability is inspired by). I think that rust would likely solve the bugs that arise from nmigen’s destructive interaction with python design/language features, and I think static but mostly inferred typing is an unbridled good. I also think the sophisticated systems engineering/programming features of the language as well as its performance would be of great benefit. Its entirely possible I completely misunderstand nmigen and the problem space but from my current understanding this is my perspective. I think this would be a good candidate for a later task in a future iteration of Libre-SOC.

Cole


More information about the libre-riscv-dev mailing list