From 2c8019d98c27ec5fc250c1fe697df7c41d9f17d6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 30 Apr 2019 00:49:57 +0100 Subject: [PATCH] whoops, use _spec on new_specs --- src/add/iocontrol.py | 22 ++++++++++++---------- src/add/stageapi.py | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/add/iocontrol.py b/src/add/iocontrol.py index 524bccb5..14d2730e 100644 --- a/src/add/iocontrol.py +++ b/src/add/iocontrol.py @@ -262,26 +262,28 @@ class NextControl(Elaboratable): return self.ready_i & self.d_valid return self.ready_i - def connect_to_next(self, nxt): + def connect_to_next(self, nxt, do_data=True): """ helper function to connect to the next stage data/valid/ready. data/valid is passed *TO* nxt, and ready comes *IN* from nxt. use this when connecting stage-to-stage """ - return [nxt.valid_i.eq(self.valid_o), - self.ready_i.eq(nxt.ready_o), - nmoperator.eq(nxt.data_i, self.data_o), - ] + res = [nxt.valid_i.eq(self.valid_o), + self.ready_i.eq(nxt.ready_o)] + if do_data: + res.append(nmoperator.eq(nxt.data_i, self.data_o)) + return res - def _connect_out(self, nxt, direct=False, fn=None): + def _connect_out(self, nxt, direct=False, fn=None, do_data=True): """ internal helper function to connect stage to an output source. do not use to connect stage-to-stage! """ ready_i = nxt.ready_i if direct else nxt.ready_i_test + res = [nxt.valid_o.eq(self.valid_o), + self.ready_i.eq(ready_i)] + if not do_data: + return res data_o = fn(nxt.data_o) if fn is not None else nxt.data_o - return [nxt.valid_o.eq(self.valid_o), - self.ready_i.eq(ready_i), - nmoperator.eq(data_o, self.data_o), - ] + return res + [nmoperator.eq(data_o, self.data_o)] def elaborate(self, platform): m = Module() diff --git a/src/add/stageapi.py b/src/add/stageapi.py index ef4327c5..9651bf79 100644 --- a/src/add/stageapi.py +++ b/src/add/stageapi.py @@ -178,7 +178,8 @@ class StageHelper(Stage): def new_specs(self, name): """ allocates new ispec and ospec pair """ - return self.ispec("%s_i" % name), self.ospec("%s_o" % name) + return (_spec(self.ispec, "%s_i" % name), + _spec(self.ospec, "%s_o" % name)) def process(self, i): if self.stage and hasattr(self.stage, "process"): -- 2.30.2