X-Git-Url: https://git.libre-soc.org/?p=soc.git;a=blobdiff_plain;f=src%2Fsoc%2Fdecoder%2Fisa%2Fcaller.py;h=7ca27b10cf89c0a08ae642e20b34c4cb7c232487;hp=5de6de592708bdbd7de139bfefb610d73c52ef32;hb=fc2269a3294e646b166a8385e4e33e2ffb0bb07a;hpb=920cd58c14b169164dc8fe4fb36ba1490cb08f74 diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 5de6de59..7ca27b10 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -426,7 +426,7 @@ class ISACaller: self.fake_pc += 4 print ("NIA, CIA", self.pc.CIA.value, self.pc.NIA.value) - def call(self, name): + def get_assembly_name(self): # TODO, asmregs is from the spec, e.g. add RT,RA,RB # see http://bugs.libre-riscv.org/show_bug.cgi?id=282 asmcode = yield self.dec2.dec.op.asmcode @@ -449,18 +449,27 @@ class ISACaller: asmop += "a" if int_op == InternalOp.OP_MFCR.value: dec_insn = yield self.dec2.e.insn - if dec_insn & (1<<20): # sigh + if dec_insn & (1<<20) != 0: # sigh asmop = 'mfocrf' else: asmop = 'mfcr' + # for whatever weird reason this doesn't work if int_op == InternalOp.OP_MTCRF.value: dec_insn = yield self.dec2.e.insn - if dec_insn & (1<<20): # sigh + print ("mtcrf", bin(dec_insn), (dec_insn & (1<<20))) + if dec_insn & (1<<21) != 0: # sigh asmop = 'mtocrf' else: asmop = 'mtcrf' - print ("call", name, asmcode, asmop) - assert name == asmop, "name %s != %s" % (name, asmop) + return asmop + + def call(self, name): + # TODO, asmregs is from the spec, e.g. add RT,RA,RB + # see http://bugs.libre-riscv.org/show_bug.cgi?id=282 + asmop = yield from self.get_assembly_name() + print ("call", name, asmop) + if name not in ['mtcrf', 'mtocrf']: + assert name == asmop, "name %s != %s" % (name, asmop) info = self.instrs[name] yield from self.prep_namespace(info.form, info.op_fields)