[Libre-soc-dev] MMU SPR handling / trying to understand how pipeline elements get connected to each other

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Jan 23 13:38:35 GMT 2021


On Thu, Jan 21, 2021 at 7:18 PM Luke Kenneth Casson Leighton
<lkcl at lkcl.net> wrote:
>
>
>
> On Thursday, January 21, 2021, Tobias Platen <libre-soc at platen-software.de> wrote:
> > In the original microwatt based design the config SPRs of the MMU are set by FSMMMUStage, but when using the NonProductionCore the MicrOp.OP_MTSPR and MicrOp.OP_MFSPR operations are handled by the SPRMainStage. In the case that a SPR number belongs to the MMU those must be forwarded to the MMU
>
> no, much simpler.  mfspr is redirected.  see decode2.vhdl for example.

sorry, tobias, i had time to look it up rather than guessing.  here:
https://github.com/antonblanchard/microwatt/blob/master/decode1.vhdl#L587

decode1.vhdl.

note it says, "case spr in SPR_DAR override_decode.unit = LDST"

that's how it's done.  basically the SPR operations all default to
going to the SPR pipeline, where in this case we don't want that: we
want some to go to the MMU pipeline.

therefore you need to detect and OVERRIDE that, in the PowerDecoder.

you will need to do something equivalent, around line 728, of power_decoder2.py
https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/decoder/power_decoder2.py;hb=HEAD#l728

the field you want to modify is fn_unit: use the following pattern:

 fu = self.op_get("function_unit")
 if fu is not None:
     if self.dec.op.internal_op == OP_MTMSR:
        if spr_out == {whatever}:
           self.do_copy("fn_unit", Function.MMU)

same thing for spr in, for MFMSR

you get the general idea.  i will raise a bugreport with this in.

l.



More information about the Libre-soc-dev mailing list