X-Git-Url: https://git.libre-soc.org/?p=ieee754fpu.git;a=blobdiff_plain;f=src%2Fadd%2Fexample_buf_pipe.py;h=4eea3a25d665b41f84730a605521a2b427d033fb;hp=b83d5035cc01c7ec338c1589359323b213e3099f;hb=e99c2ba2d7cb6f5f5ea5561c28ba05ed1b59c423;hpb=f3945d1317aa236b752c1e286801caa2c3a07703 diff --git a/src/add/example_buf_pipe.py b/src/add/example_buf_pipe.py index b83d5035..4eea3a25 100644 --- a/src/add/example_buf_pipe.py +++ b/src/add/example_buf_pipe.py @@ -282,15 +282,12 @@ class BufferedPipeline(PipelineBase): ] # store result of processing in combinatorial temporary - #with m.If(self.p.i_valid): # input is valid: process it m.d.comb += eq(result, self.stage.process(self.p.i_data)) + # if not in stall condition, update the temporary register with m.If(self.p.o_ready): # not stalled m.d.sync += eq(r_data, result) # update buffer - #with m.If(self.p.i_rst): # reset - # m.d.sync += self.n.o_valid.eq(0) - # m.d.sync += self.p.o_ready.eq(0) with m.If(self.n.i_ready): # next stage is ready with m.If(self.p.o_ready): # not stalled # nothing in buffer: send (processed) input direct to output @@ -299,10 +296,9 @@ class BufferedPipeline(PipelineBase): ] with m.Else(): # p.o_ready is false, and something is in buffer. # Flush the [already processed] buffer to the output port. - m.d.sync += [self.n.o_valid.eq(1), + m.d.sync += [self.n.o_valid.eq(1), # declare reg empty eq(self.n.o_data, r_data), # flush buffer - # clear stall condition, declare register empty. - self.p.o_ready.eq(1), + self.p.o_ready.eq(1), # clear stall condition ] # ignore input, since p.o_ready is also false. @@ -310,9 +306,9 @@ class BufferedPipeline(PipelineBase): with m.Elif(o_n_validn): # next stage being told "ready" m.d.sync += [self.n.o_valid.eq(p_i_valid), self.p.o_ready.eq(1), # Keep the buffer empty - # set the output data (from comb result) - eq(self.n.o_data, result), + eq(self.n.o_data, result), # set output data ] + # (n.i_ready) false and (n.o_valid) true: with m.Elif(i_p_valid_o_p_ready): # If next stage *is* ready, and not stalled yet, accept input