From e9ce8cefa80c97dc9dc027edb436b5ca97ae9d9f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 19 Mar 2019 04:16:06 +0000 Subject: [PATCH] move connect_out function to NextControl --- src/add/example_buf_pipe.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/add/example_buf_pipe.py b/src/add/example_buf_pipe.py index 41138001..568c7c69 100644 --- a/src/add/example_buf_pipe.py +++ b/src/add/example_buf_pipe.py @@ -88,6 +88,15 @@ class NextControl: eq(nxt.data, self.data), ] + def connect_out(self, nxt): + """ helper function to connect stage to an output source. do not + use to connect stage-to-stage! + """ + return [nxt.o_valid.eq(self.o_valid), + self.i_ready.eq(nxt.i_ready), + eq(nxt.data, self.data), + ] + def eq(o, i): if not isinstance(o, Sequence): @@ -151,7 +160,6 @@ class BufferedPipeline: def connect_to_next(self, nxt): """ helper function to connect to the next stage data/valid/ready. - data/valid is passed *TO* nxt, and ready comes *IN* from nxt. """ return self.n.connect_to_next(nxt.p) @@ -165,10 +173,7 @@ class BufferedPipeline: """ helper function to connect stage to an output source. do not use to connect stage-to-stage! """ - return [nxt.n.o_valid.eq(self.n.o_valid), - self.n.i_ready.eq(nxt.n.i_ready), - eq(nxt.n.data, self.n.data), - ] + return self.n.connect_out(nxt.n) def set_input(self, i): """ helper function to set the input data -- 2.30.2