[Libre-soc-bugs] [Bug 1226] are special_sprs tests in caller.py backwards?

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Nov 30 12:55:10 GMT 2023


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

Luke Kenneth Casson Leighton <lkcl at lkcl.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---

> note the `if special in special_sprs: use self.spr else: use self.namespace`

yes.

> that looks backwards to me, shouldn't the special SPRs be kept in namespace
> and all the rest in self.spr?!

no.

> 
> This causes a problem when running emulated sc without initializing SRR0 (I
> didn't initialize it cuz we're user space, who cares what value a register
> we can't access has):

you found that it does indeed matter.
uninitialised registers matter.


>         # "special" registers
>         for special in info.special_regs:
>             if special in special_sprs:
>                 inputs[special] = self.spr[special]
>             else:
> >               inputs[special] = self.namespace[special]
> E               KeyError: 'SRR0'

thqt is the correct behaviour.

> if the code had instead tried to access self.spr['SRR0'], then
> SPR.__getitem__ would have filled in a default value rather than failing.

which it should not be doing.

now you know to pass in an initial value to the unit test.

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


More information about the libre-soc-bugs mailing list