Add RV64M R-Type Instruction

This commit is contained in:
Donald Sebastian Leung 2020-08-28 11:37:54 +08:00
parent 5d17b917b4
commit 8fa2a33ecf
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
from .insn import *
"""
RV64M R-Type Instruction
"""
class InsnRV64MRType(Insn):
def __init__(self, params, funct3):
super().__init__(params)
self.funct3 = funct3
def elaborate(self, platform):
m = super().elaborate(platform)
if self.params.csr_misa:
m.d.comb += self.misa_ok.eq((self.rvfi_csr_misa_rdata & 0x1000) == 0x1000)
m.d.comb += self.spec_csr_misa_rmask.eq(0x1000)
else:
m.d.comb += self.misa_ok.eq(1)
m.d.comb += self.spec_valid.eq(self.rvfi_valid & (~self.insn_padding) & (self.insn_funct7 == 0b0000001) & (self.insn_funct3 == self.funct3) & (self.insn_opcode == 0b0111011))
m.d.comb += self.spec_rs1_addr.eq(self.insn_rs1)
m.d.comb += self.spec_rs2_addr.eq(self.insn_rs2)
m.d.comb += self.spec_rd_addr.eq(self.insn_rd)
m.d.comb += self.spec_pc_wdata.eq(self.rvfi_pc_rdata + 4)
return m