convert ControlBase to iter
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 20 Apr 2019 21:08:00 +0000 (22:08 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 20 Apr 2019 21:08:00 +0000 (22:08 +0100)
src/add/singlepipe.py

index 760f4462c096e93b6ad4a5ba4628c8fa49ee33b2..88709ffc8a16067e65c6036885a779409d422c73 100644 (file)
@@ -687,8 +687,12 @@ class ControlBase:
         """
         return eq(self.p.i_data, i)
 
+    def __iter__(self):
+        yield from self.p
+        yield from self.n
+
     def ports(self):
-        return self.p.ports() + self.n.ports()
+        return list(self)
 
     def _elaborate(self, platform):
         """ handles case where stage has dynamic ready/valid functions