From: Luke Kenneth Casson Leighton Date: Thu, 14 May 2020 16:57:34 +0000 (+0100) Subject: cleanup Logical X-Git-Tag: div_pipeline~1229 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16a1b64880d426f32613fccf4627c94c57247a1f;p=soc.git cleanup Logical --- diff --git a/src/soc/logical/main_stage.py b/src/soc/logical/main_stage.py index 426564bb..56f2ee39 100644 --- a/src/soc/logical/main_stage.py +++ b/src/soc/logical/main_stage.py @@ -26,25 +26,29 @@ class LogicalMainStage(PipeModBase): def elaborate(self, platform): m = Module() comb = m.d.comb + a, b, o = self.i.a, self.i.b, self.o.o ########################## - # main switch for logic ops AND, OR and XOR, parity, and popcount + # main switch for logic ops AND, OR and XOR, cmpb, parity, and popcount with m.Switch(self.i.ctx.op.insn_type): + + ###### AND, OR, XOR ####### with m.Case(InternalOp.OP_AND): - comb += self.o.o.eq(self.i.a & self.i.b) + comb += o.eq(a & b) with m.Case(InternalOp.OP_OR): - comb += self.o.o.eq(self.i.a | self.i.b) + comb += o.eq(a | b) with m.Case(InternalOp.OP_XOR): - comb += self.o.o.eq(self.i.a ^ self.i.b) + comb += o.eq(a ^ b) + ###### cmpb ####### with m.Case(InternalOp.OP_CMPB): for i in range(8): slc = slice(i*8, (i+1)*8) - with m.If(self.i.a[slc] == self.i.b[slc]): - comb += self.o.o[slc].eq(Repl(1, 8)) + with m.If(a[slc] == b[slc]): + comb += o[slc].eq(Repl(1, 8)) with m.Else(): - comb += self.o.o[slc].eq(Repl(0, 8)) + comb += o[slc].eq(Repl(0, 8)) ###### popcount ####### # TODO with m.Case(InternalOp.OP_POPCNT):