# fence
c[F3.fence] = \
If((self.immediate[8:12] == immz) & (self.rs1 == regz) & \
- (self.rd == regz),
+ (self.rd == regz),
self.decode_action.eq(DA.fence)
).Else(
self.decode_action.eq(DA.trap_illegal_instruction))
# fence.i
c[F3.fence_i] = \
If((self.immediate[0:12] == immz) & (self.rs1 == regz) & \
- (self.rd == regz),
+ (self.rd == regz),
self.decode_action.eq(DA.fence_i)
).Else(
self.decode_action.eq(DA.trap_illegal_instruction))
regz = Constant(0, 5)
# ebreak
c[F3.ecall_ebreak] = \
- If((self.immediate != ~b1) | (self.rs1 != regz) | \
- (self.rd != regz),
- self.decode_action.eq(DA.trap_illegal_instruction)
+ If((self.immediate == ~b1) ^ (self.rs1 == regz) & \
+ (self.rd == regz),
+ self.decode_action.eq(DA.trap_ecall_ebreak)
).Else(
- self.decode_action.eq(DA.trap_ecall_ebreak))
+ self.decode_action.eq(DA.trap_illegal_instruction))
# csrs
for op in [ F3.csrrw, F3.csrrs, F3.csrrc,
F3.csrrwi, F3.csrrsi, F3.csrrci]: