[libre-riscv-dev] 3.0B PDF spec parser and first auto-generator working well
Luke Kenneth Casson Leighton
lkcl at lkcl.net
Sat Apr 4 14:33:58 BST 2020
making good progress. this (which can be seen here
https://libre-riscv.org/openpower/isa/fixedarith/)
vvvvvv
# Add Immediate Shifted
D-Form
* addis RT,RA,SI
if RA = 0 then RT <- EXTS(SI || [0]*16)
else RT <- (RA) + EXTS(SI || [0]*16)
Special Registers Altered:
None
^^^^^
gets turned into this:
vvvv
# auto-generated, do not edit
from soc.decoder.helpers import (EXTS,)
class fixedarith(ISACaller):
def op_addis(self, RA):
if RA == 0:
RT = EXTS(concat(SI, concat(0, repeat=16)))
else:
RT = RA + EXTS(concat(SI, concat(0, repeat=16)))
return (RT,)
instrs = {}
instrs['addis'] = (op_addis, ['RA'], [], ['RT']) # records input
and output regs
^^^^
no "laborious manually-written simulator code" was written. the next
phase is, obviously, to try actually executing these code-fragments.
that's what the base-class "ISACaller" is for.
l.
More information about the libre-riscv-dev
mailing list