[Libre-soc-misc] [Bug 523] demo program needed showing register dependencies

Jacob Lifshay programmerjake at gmail.com
Thu Nov 5 08:35:47 GMT 2020


Replying on libre-soc-misc at the request of Luke.

> https://bugs.libre-soc.org/show_bug.cgi?id=523
>
> --- Comment #15 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
> (In reply to Cole Poirier from comment #14)
> > (In reply to Luke Kenneth Casson Leighton from comment #13)
> > >
> > > once you have completed the work that you are doing - in rust - we have
> > > to *throw it away* and* entirely start again* in a programming language that
> > > is common to everyone.
> >
> > I think that Jacob is writing it in C++ specifically so that you can
> > participate.

That is the case. If I didn't care about Luke participating, I'd write
the whole thing in Rust, not worrying about FFI makes it much easier.
Also, Rust has soo many nice features that I'm missing now that I'm
back to writing C++.

> > I'm not sure if you saw his comment about that. I think perhaps
> > he's using the rust build system because it's much easier to compile c++
> > into WASM using that.

That is partially the case, there's also the fact that many of the
libraries we would need/like are easily available from rust: comrak
(gfm markdown renderer), power-instruction-analyzer, vcd (used for
writing vcd files), structopt & clap (awesome command line argument
parsing libraries that make getopt look antiquated and primitive).

> > Correct me if I'm wrong Jacob.
> <snip>
> i also wanted to be able to generate gtkwave files and for that we can bring
> in Cesar's excellent work (to save time), and haven't been able to get round
> to doing so.

I added support for writing vcd files using the Rust vcd library.

I also just finished implementing a simple demo circuit: a shift
register. I'm implementing a nmigen-style simulator loop (though it
only has settle and step, and they may have slightly different
semantics) since that makes it much easier to describe the CPU's
internals in a cycle-accurate manner. The demo circuit and stuff is
all written in C++, so Luke, you can look in the c-src folder and see
if you think you'd be able to work on that. I think you will find it
much easier than you expect (assuming you're familiar with decently
modern C++). I think you will also find that you basically won't even
need to look at the Rust code for the vast majority of things you
might want to do.

https://salsa.debian.org/Kazan-team/power-cpu-sim/-/tree/master/c-src

Jacob



More information about the Libre-soc-misc mailing list