2020-08-17 11:50:53 +08:00
|
|
|
from .insn_rv32i_sb_type import *
|
2020-08-11 16:46:07 +08:00
|
|
|
|
|
|
|
"""
|
|
|
|
BEQ instruction
|
|
|
|
"""
|
|
|
|
|
|
|
|
class InsnBeq(InsnRV32ISBType):
|
2020-08-20 17:28:09 +08:00
|
|
|
def __init__(self, params):
|
|
|
|
super().__init__(params, 0b000)
|
2020-08-21 10:33:02 +08:00
|
|
|
|
2020-08-11 16:46:07 +08:00
|
|
|
def elaborate(self, platform):
|
|
|
|
m = super().elaborate(platform)
|
|
|
|
|
2020-08-20 17:28:09 +08:00
|
|
|
next_pc = Signal(self.params.xlen)
|
2020-08-11 16:46:07 +08:00
|
|
|
m.d.comb += next_pc.eq(Mux(self.rvfi_rs1_rdata == self.rvfi_rs2_rdata, self.rvfi_pc_rdata + self.insn_imm, self.rvfi_pc_rdata + 4))
|
|
|
|
m.d.comb += self.spec_pc_wdata.eq(next_pc)
|
|
|
|
m.d.comb += self.spec_trap.eq(Mux(self.ialign16, next_pc[0] != 0, next_pc[:2] != 0) | ~self.misa_ok)
|
|
|
|
|
|
|
|
return m
|