From 10833548e34e3fc6dfa9b6b6bf19b62a2f8b570f Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Thu, 2 Jul 2020 05:55:59 -0300 Subject: [PATCH] Present the ALU result only when valid_o is active This should help to catch latching of invalid data. Also, better demonstrates the valid / ready protocol. --- src/soc/experiment/alu_hier.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/soc/experiment/alu_hier.py b/src/soc/experiment/alu_hier.py index 581fd113..5dcf958c 100644 --- a/src/soc/experiment/alu_hier.py +++ b/src/soc/experiment/alu_hier.py @@ -268,7 +268,8 @@ class ALU(Elaboratable): # choose between zero-delay output, or registered with m.If(go_now): m.d.comb += self.o.eq(sub.o) - with m.Else(): + # only present the result at the last computation cycle + with m.Elif(alu_done): m.d.comb += self.o.eq(alu_r) return m -- 2.30.2