[Libre-soc-dev] pia as cycle accurate simulator?

Jacob Lifshay programmerjake at gmail.com
Thu Oct 15 02:51:09 BST 2020

On Wed, Oct 14, 2020, 18:23 Luke Kenneth Casson Leighton <lkcl at lkcl.net>

> On 10/15/20, Jacob Lifshay <programmerjake at gmail.com> wrote:
> > added the rest of the instructions in the Fixed-Point Arithmetic
> > Instructions section of the Power v3.1 spec to
> > power-instruction-analyzer, with the following exceptions:
> > paddi -- not supported on POWER9 since it's one of the new prefixed
> > instructions
> yeh we don't want those, they're V3.1B
> > addpcis -- results dependent on instruction's address, which
> > power-instruction-analyzer can't currently control.
> > darn -- results random -- not easily testable
> >
> > All implemented instructions pass the tests.
> fantastic.
> > Next, I guess I'll add the rest of the fixed-point instructions that
> > aren't loads, stores, branches, traps, or random or depend on the
> > instruction's address.
> that'd be great.
> my thoughts here are, it's pretty close to becoming the core of an
> actual simulator.

I think we should have the simulator be a separate crate built on top of
power-instruction-analyzer. we'd probably need a few kloc more to implement
a simulator, since pia doesn't have an instruction decoder and doesn't
handle reading/writing registers -- it just implements the ALU-portion of
the instructions.

> what do you reckon, and could we then drop SV on top in an

Sure, though it will require some thought to decide which level of the
simulator's architecture to implement SV at.

object-orientated fashion?

well, since it'll be written in Rust, it won't technically be object
oriented since rust doesn't really use that paradigm. Rust instead uses
something a bit different -- more like interface-oriented programming (I
don't know the actual name, other than Rust) since that's what Traits are.
Rust in particular doesn't really use inheritance or is-a relationships,
instead, it is more like types implement particular interfaces (called
traits in Rust).

Note that I think you should spend some time working on a decent-sized Rust
project, since I think most of the benefits you attribute to
object-oriented programming can be achieved in a cleaner and easier to
extend fashion using interface-oriented programming. Obviously this will
most likely have to be delayed till after the december tape-out.

> (in spike i did element width overrides through c++ OO overrides, it
> was a while ago now, i think you helped with that?)

I think I might have, a little, but you did the majority of the work on


More information about the Libre-soc-dev mailing list