Skip to content

Commit

Permalink
Merge branch 'piotro/b-fix' into piotro/enable-regression-extenstions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 committed Feb 29, 2024
2 parents a1973af + 2a74cd4 commit f036568
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion coreblocks/frontend/instr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ class Encoding:
Encoding(Opcode.OP, Funct3.MIN, Funct7.MIN),
Encoding(Opcode.OP, Funct3.MINU, Funct7.MIN),
Encoding(Opcode.OP, Funct3.ORN, Funct7.ORN),
Encoding(Opcode.OP, Funct3.XNOR, Funct7.XNOR),
],
OpType.BIT_ROTATION: [
Encoding(Opcode.OP, Funct3.ROL, Funct7.ROL),
Encoding(Opcode.OP, Funct3.ROR, Funct7.ROR),
Encoding(Opcode.OP_IMM, Funct3.ROR, Funct7.ROR),
Encoding(Opcode.OP, Funct3.XNOR, Funct7.XNOR),
],
OpType.UNARY_BIT_MANIPULATION_1: [
Encoding(Opcode.OP_IMM, Funct3.REV8, funct12=Funct12.REV8_32),
Expand Down
4 changes: 2 additions & 2 deletions coreblocks/fu/shift_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def get_instructions(self) -> Sequence[tuple]:
(self.Fn.SRL, OpType.SHIFT, Funct3.SR, Funct7.SL),
(self.Fn.SRA, OpType.SHIFT, Funct3.SR, Funct7.SA),
] + [
(self.Fn.ROR, OpType.BIT_MANIPULATION, Funct3.ROR, Funct7.ROR),
(self.Fn.ROL, OpType.BIT_MANIPULATION, Funct3.ROL, Funct7.ROL),
(self.Fn.ROR, OpType.BIT_ROTATION, Funct3.ROR),
(self.Fn.ROL, OpType.BIT_ROTATION, Funct3.ROL),
] * self.zbb_enable


Expand Down
2 changes: 2 additions & 0 deletions coreblocks/params/optypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class OpType(IntEnum):
SINGLE_BIT_MANIPULATION = auto()
ADDRESS_GENERATION = auto()
BIT_MANIPULATION = auto()
BIT_ROTATION = auto()
UNARY_BIT_MANIPULATION_1 = auto()
UNARY_BIT_MANIPULATION_2 = auto()
UNARY_BIT_MANIPULATION_3 = auto()
Expand Down Expand Up @@ -88,6 +89,7 @@ class OpType(IntEnum):
],
Extension.ZBB: [
OpType.BIT_MANIPULATION,
OpType.BIT_ROTATION,
OpType.UNARY_BIT_MANIPULATION_1,
OpType.UNARY_BIT_MANIPULATION_2,
OpType.UNARY_BIT_MANIPULATION_3,
Expand Down
16 changes: 8 additions & 8 deletions test/fu/test_alu.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class AluUnitTest(FunctionalUnitTestCase[AluFn.Fn]):
AluFn.Fn.MAXU: ExecFn(OpType.BIT_MANIPULATION, Funct3.MAXU, Funct7.MAX),
AluFn.Fn.MIN: ExecFn(OpType.BIT_MANIPULATION, Funct3.MIN, Funct7.MIN),
AluFn.Fn.MINU: ExecFn(OpType.BIT_MANIPULATION, Funct3.MINU, Funct7.MIN),
AluFn.Fn.CPOP: ExecFn(OpType.UNARY_BIT_MANIPULATION_5, Funct3.CPOP, Funct7.CPOP),
AluFn.Fn.SEXTB: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.SEXTB, Funct7.SEXTB),
AluFn.Fn.ZEXTH: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.ZEXTH, Funct7.ZEXTH),
AluFn.Fn.SEXTH: ExecFn(OpType.UNARY_BIT_MANIPULATION_2, Funct3.SEXTH, Funct7.SEXTH),
AluFn.Fn.ORCB: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.ORCB, Funct7.ORCB),
AluFn.Fn.REV8: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.REV8, Funct7.REV8),
AluFn.Fn.CLZ: ExecFn(OpType.UNARY_BIT_MANIPULATION_3, Funct3.CLZ, Funct7.CLZ),
AluFn.Fn.CTZ: ExecFn(OpType.UNARY_BIT_MANIPULATION_4, Funct3.CTZ, Funct7.CTZ),
AluFn.Fn.SEXTB: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.SEXTB),
AluFn.Fn.ZEXTH: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.ZEXTH),
AluFn.Fn.REV8: ExecFn(OpType.UNARY_BIT_MANIPULATION_1, Funct3.REV8),
AluFn.Fn.SEXTH: ExecFn(OpType.UNARY_BIT_MANIPULATION_2, Funct3.SEXTH),
AluFn.Fn.ORCB: ExecFn(OpType.UNARY_BIT_MANIPULATION_2, Funct3.ORCB),
AluFn.Fn.CLZ: ExecFn(OpType.UNARY_BIT_MANIPULATION_3, Funct3.CLZ),
AluFn.Fn.CTZ: ExecFn(OpType.UNARY_BIT_MANIPULATION_4, Funct3.CTZ),
AluFn.Fn.CPOP: ExecFn(OpType.UNARY_BIT_MANIPULATION_5, Funct3.CPOP),
}

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions test/fu/test_shift_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class ShiftUnitTest(FunctionalUnitTestCase[ShiftUnitFn.Fn]):
ShiftUnitFn.Fn.SLL: ExecFn(OpType.SHIFT, Funct3.SLL),
ShiftUnitFn.Fn.SRL: ExecFn(OpType.SHIFT, Funct3.SR, Funct7.SL),
ShiftUnitFn.Fn.SRA: ExecFn(OpType.SHIFT, Funct3.SR, Funct7.SA),
ShiftUnitFn.Fn.ROL: ExecFn(OpType.BIT_MANIPULATION, Funct3.ROL, Funct7.ROL),
ShiftUnitFn.Fn.ROR: ExecFn(OpType.BIT_MANIPULATION, Funct3.ROR, Funct7.ROR),
ShiftUnitFn.Fn.ROL: ExecFn(OpType.BIT_ROTATION, Funct3.ROL, Funct7.ROL),
ShiftUnitFn.Fn.ROR: ExecFn(OpType.BIT_ROTATION, Funct3.ROR, Funct7.ROR),
}

@staticmethod
Expand Down

0 comments on commit f036568

Please sign in to comment.