[Libre-soc-bugs] [Bug 1177] revert unauthorized change to pseudocode language

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Oct 4 07:18:00 BST 2023


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

--- Comment #5 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #4)
> (In reply to Jacob Lifshay from comment #3)
> > imo a better approach is to have the simulator read all destination
> > registers
> 
> nom nom nom.. thinking it over... this is a great idea / principle. i don't
> know why it wasn't brought up before now :)

cuz no one thought of it before? :)

> 
> how to implement without causing chaos on some of the "overwrite"
> instructions
> like ternlogi...
> 
> where, there, if done naively (always-write-back) the fact that the
> instruction may choose any one of *3* registers to write-back, the
> simulator could write *all* of them, corrupting results.

well, for ternlogi specifically, since it always writes RT and the simulator
knows RT is an output (due to the csvs), it isn't actually a problem. just do:
read gprs into RT, RA, RB variables
run pseudocode
write RT variable to gpr.

> 
> so... a solution to that: mirror what is in TestIssuer, with the
> data/ok flag.  if you *really* want the register written, you set
> the "ok" flag.

I think that's a good idea, with some caveats:

> better:
> 
>      if eq(RA, 0):
>          RT = copy_it_icr_the_name(RB)
>          RT.ok = True

SelectableInt should not be where we stick the .ok field, either we should
have:

RT be a class with .data and .ok fields and all pseudocode read/writes of RT
access .data
or have some kind of separate output for the `ok`s such as a dict or have each
output fill two slots, like so:
* option #1:
    # we need to return RT and RS:
    return (RT, RT_ok, RS, RS_ok)
* option #2:
    return ((RT, RT_ok), (RS, RS_ok))
* option #3:
    def op_theinsn(self, RT, RA, RB, oks):
        if eq(RA, 0):
            RT = copy_it_icr_the_name(RB)
            oks['RT'] = True
        return (RT,)


though, tbh we should use a different name than `ok`, how about `written` or
`outs`?

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


More information about the libre-soc-bugs mailing list