From b58c1a8f96dfaa63e89c7f3d7fd65f0fec9c1932 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 13 Mar 2019 04:26:24 +0000 Subject: [PATCH] only process data if the input strobe is valid --- src/add/example_buf_pipe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add/example_buf_pipe.py b/src/add/example_buf_pipe.py index 337ce50e..fa52f3c7 100644 --- a/src/add/example_buf_pipe.py +++ b/src/add/example_buf_pipe.py @@ -40,7 +40,6 @@ """ from nmigen import Signal, Cat, Const, Mux, Module -from nmigen.compat.sim import run_simulation from nmigen.cli import verilog, rtlil class BufPipe: @@ -92,7 +91,8 @@ class BufPipe: # store result of processing in combinatorial temporary result = Signal(32) - m.d.comb += result.eq(self.process(self.i_data)) + with m.If(self.i_p_stb): # input is valid: process it + m.d.comb += result.eq(self.process(self.i_data)) with m.If(o_p_busyn): # not stalled m.d.sync += self.r_data.eq(result) -- 2.30.2