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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 7 04:09:59 BST 2020


--- Comment #73 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Cole Poirier from comment #71)
> (In reply to Luke Kenneth Casson Leighton from comment #68)
> > actually... cole, can you do the same thing as i just did with
> > msr_check_pr() create a function called trap(m, addr, nia)?
> > 
> > except this time it is a member function of the class, so trap(self, m,
> > addr, nia)
> > 
> > and just as you see i redid comb=m.d.comb in msr_check_pr, repeat/copy the
> > convenience variables that allow you to set self.o.nia etc etc
> > 
> > the reason for making this function is because you can see it is used twice
> > already.
> > 
> > also i am thinking it may be a good idea to add the address (0x700, etc)
> > actually to the trap_input_record and pass it in from the *decode* phase.
> Sorry, I'm very shaky on the dynamic input records and how they work with
> the decoder.

will explain tomorrow when it is not 4am.
briefyly: every Record has a dictionary called fields.  by walking this
dictionary we can cheat and copy *only* a subset of fields... as long as the
names all match up.

see eq_from_execute1 and grep source code for where it is used.

> One difference between OP_TRAP and OP_SC is that the end of the OP_TRAP
> function is:
> ```
> # take a copy of the current PC in SRR0
> comb += srr0_o.data.eq(cia_i)   # old PC
> comb += srr0_o.ok.eq(1)
> ```
> While the end of the OP_SC function is:
> ```
> # and store the (next-after-return) PC in SRR0
> comb += srr0_o.data.eq(cia_i+4) # addr to begin from on return
> comb += srr0_o.ok.eq(1)
> ```
> So should the function be:
> ```
> def trap(self, m, addr, nia_o, srr0_o, trap_addr):
>     comb = m.d.comb
>     comb += nia_o.data.eq(trap_addr)
>     comb += nia_o.ok.eq(1)
>     comb += srr0_o.data.eq(addr) # addr to begin from on return
>     comb += srr0_o.ok.eq(1)

yes! well done.  ok i would cut out srr0_o from those args and just redo them
inside the fn.

so now also cookie cut srr0_0 and nia_o from lines 89 and 90 "convenience"
variables.  see how that works?

so OP_SC should call self.trap(0xc00, cia_i+4) and OP_TRAP should be obvious.

> ```
> The below is where my shakiness on the CompXOpSubset and the decoder starts
> to confuse me. If you can briefly explain that to me here, I can use this
> when doing the documentation after the tape-out deadline.



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

More information about the libre-riscv-dev mailing list