From: Michael Nolan Date: Fri, 8 May 2020 17:49:27 +0000 (-0400) Subject: Have input_stage set the b operand to imm_data if it is valid X-Git-Tag: div_pipeline~1339 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=939c409c32e7a522edeb4879d14c30a4efb6b2f8;p=soc.git Have input_stage set the b operand to imm_data if it is valid --- diff --git a/src/soc/alu/formal/proof_input_stage.py b/src/soc/alu/formal/proof_input_stage.py index ab679e01..b3fc7f28 100644 --- a/src/soc/alu/formal/proof_input_stage.py +++ b/src/soc/alu/formal/proof_input_stage.py @@ -56,7 +56,11 @@ class Driver(Elaboratable): comb += Assert(dut.o.a == ~a) with m.Else(): comb += Assert(dut.o.a == a) - comb += Assert(dut.o.b == b) + + with m.If(rec.imm_data.imm_ok): + comb += Assert(dut.o.b == rec.imm_data.imm) + with m.Else(): + comb += Assert(dut.o.b == b) diff --git a/src/soc/alu/input_stage.py b/src/soc/alu/input_stage.py index f7c38673..6d5e1e46 100644 --- a/src/soc/alu/input_stage.py +++ b/src/soc/alu/input_stage.py @@ -28,7 +28,11 @@ class ALUInputStage(PipeModBase): comb += self.o.a.eq(a) - comb += self.o.b.eq(self.i.b) + # If there's an immediate, set the B operand to that + with m.If(self.i.ctx.op.imm_data.imm_ok): + comb += self.o.b.eq(self.i.ctx.op.imm_data.imm) + with m.Else(): + comb += self.o.b.eq(self.i.b) comb += self.o.ctx.eq(self.i.ctx)