Implements sub: passing tests

This commit is contained in:
2025-11-09 18:33:12 +01:00
parent 441f665d34
commit 03e315903e
3 changed files with 42 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ import chisel3.util.switch
import chisel3.util.is
object AluOpCode extends ChiselEnum {
val Add, And, Or, Xor, ShiftLeft, ShiftRight, ShiftArithmeticRight,
val Add, Sub, And, Or, Xor, ShiftLeft, ShiftRight, ShiftArithmeticRight,
LessThanSigned, LessThanUnsigned, GreaterEqualSigned,
GreaterEqualUnsigned, Equal = Value
}
@@ -28,6 +28,10 @@ class Alu extends Module {
io.out := io.a + io.b;
}
is(Sub) {
io.out := io.a - io.b;
}
is(And) {
io.out := io.a & io.b;
}