[libre-riscv-dev] [Bug 269] auto-conversion / parser of POWER ISA Spec v3.0B

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Fri Apr 3 22:41:10 BST 2020


--- Comment #13 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Luke Kenneth Casson Leighton from comment #12)

> def cmpi(RA, RB): # pass in regs as parameters
>     code
>     blah
>     return (RS,) # return modified params as results.
> duh.

ok can you take a look?  (run pywriter.py again)

it does mean that we have to establish a "caller" system
which will also understand the number of parameters (called and returned).

in preparation for that, i got the auto-generated code to derive
from something called "ISACaller" - would you like to write that

it should look up the instruction in the dictionary (ISACaller.instrs)
which you can see has been constructed (and appended at the bottom
of the derived class)

it contains the list of "variables" that need to be initialised
to zero (technically, uninitialised), the list of variables that
need to be "read" from the regfile (with a "yield") and, once
the function returns, the list of variables to be written to the

to call a given function, you'll need those like this:

spec = self.instrs['cmpi']

actual_function, read_regs, uninit_regs, write_regs = spec

then merge read+unint (actually, move create_args() into
soc.decoder.isa.something and import it)

so: function_arg_names = create_args(read_regs+uninit_regs)

create function_args based on that list

and then call it:

result = actual_function(*function_args)

match the result with write_regs using zip:

for (fname, result) in zip(result, write_regs):
     store result in GPR[fname]

can i leave that with you?

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

More information about the libre-riscv-dev mailing list