[libre-riscv-dev] [Bug 325] create POWER9 TRAP pipeline

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 7 22:31:40 BST 2020


https://bugs.libre-soc.org/show_bug.cgi?id=325

--- Comment #83 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Cole Poirier from comment #81)
> (In reply to Luke Kenneth Casson Leighton from comment #80)
> > it is... however look at the PDF SPEC (or see comment #1 which contains
> > the pseudo-code.  that's not a function, is it?
> 
> No indeed it seems more similar to a keyword. 

i basically disregarded entirely the statement at the top of the POWER v3.0B
PDF, "this pseudocode is in no way intended to be an executable language"
and did exactly that.  teehee


> Ah, so just translating that
> psuedo code into the TRAP method of ISACaller?

yeeees :)

> >     @inject()
> >     def op_twi(self, RA):
> >         a = EXTS(RA[32:64])
> >         if lt(a, EXTS(SI)) & TO[0]:self.TRAP()
> >         if gt(a, EXTS(SI)) & TO[1]:self.TRAP()
> > 
> > 
> > *now* it can call the function which was added in caller.py, *now* we
> > can get that function to make the required modifications to the SPRs
> > and to the PC (NIA - Next Instruction Address).
> 
> Aha, this is actually starting to make A LOT of sense :)

ta-daaaa :)

so i saw the latest commit, and added some TODO comments.  if you
can do them *at the same time* as actually adding things in
caller.py ISACAller.TRAP, then you will see clearly the direct connection
between the two.

oh - yes, add a test_twi (or test_tdi) as well, you will have to
set an initial register RA, such as:

            initial_regs = [0] * 32
            initial_regs[2] = random.randint(0, (1<<32)-1)

or maybe do a fixed number, initially, so you know exactly what
you are testing against.  remember if you set initial_regs[2]
then that means that "RA" in the instruction has to be 2.
from fixedtrap.mdwn:

D-Form

* twi TO,RA,SI

therefore, what you put in the listing, would have to be twi TO,-->2<--,SI


TO is a bitfield, saying whether you want to compare equals, greater, less-than
etc. etc.

SI is an immediate that you want to compare against register RA.

so just pick something that, *manually*, you know will be "equal", or
something.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-riscv-dev mailing list