hdl.ast: Cat.{operands→parts}
authorwhitequark <whitequark@whitequark.org>
Tue, 18 Dec 2018 19:15:44 +0000 (19:15 +0000)
committerwhitequark <whitequark@whitequark.org>
Tue, 18 Dec 2018 19:15:50 +0000 (19:15 +0000)
doc/COMPAT_SUMMARY.md
nmigen/back/pysim.py
nmigen/hdl/ast.py
nmigen/hdl/xfrm.py
nmigen/test/test_hdl_ast.py

index 70f15454ba4748c92bd92890965d06eef01bcf29..86ba8f919d850435cba34f2836af203afc49c1cb 100644 (file)
@@ -66,7 +66,7 @@ Compatibility summary
       - (+) `Mux` id
       - (+) `_Slice` → `Slice`, `stop=`→`end=`, `.stop`→`.end`
       - (+) `_Part` → `Part`
-      - (+) `Cat` id, `.l`→`.operands`
+      - (+) `Cat` id, `.l`→`.parts`
       - (+) `Replicate` → `Repl`, `v=`→`value=`, `n=`→`count=`, `.v`→`.value`, `.n`→`.count`
       - (+) `Constant` → `Const`, `bits_sign=`→`shape=`
       - (+) `Signal` id, `bits_sign=`→`shape=`, `attr=`→`attrs=`, `name_override=`∼, `related=`, `variable=`∼
index 206f19972109e66d80103024819f1e67f5525ff7..7baa654f46e510a241ecdb29fa10ef07e149699b 100644 (file)
@@ -165,7 +165,7 @@ class _RHSValueCompiler(AbstractValueTransformer):
         shape  = value.shape()
         parts  = []
         offset = 0
-        for opnd in value.operands:
+        for opnd in value.parts:
             parts.append((offset, (1 << len(opnd)) - 1, self(opnd)))
             offset += len(opnd)
         def eval(state):
@@ -248,7 +248,7 @@ class _LHSValueCompiler(AbstractValueTransformer):
     def on_Cat(self, value):
         parts  = []
         offset = 0
-        for opnd in value.operands:
+        for opnd in value.parts:
             parts.append((offset, (1 << len(opnd)) - 1, self(opnd)))
             offset += len(opnd)
         def eval(state, rhs):
index b9a7d7ae808cf5ee5d8bf7c2d5e101c85f81c8ec..e890b4aa14b9223ff2736cf14fe2941b0cbea56f 100644 (file)
@@ -437,19 +437,19 @@ class Cat(Value):
     """
     def __init__(self, *args):
         super().__init__()
-        self.operands = [Value.wrap(v) for v in flatten(args)]
+        self.parts = [Value.wrap(v) for v in flatten(args)]
 
     def shape(self):
-        return sum(len(op) for op in self.operands), False
+        return sum(len(op) for op in self.parts), False
 
     def _lhs_signals(self):
-        return union(op._lhs_signals() for op in self.operands)
+        return union(op._lhs_signals() for op in self.parts)
 
     def _rhs_signals(self):
-        return union(op._rhs_signals() for op in self.operands)
+        return union(op._rhs_signals() for op in self.parts)
 
     def __repr__(self):
-        return "(cat {})".format(" ".join(map(repr, self.operands)))
+        return "(cat {})".format(" ".join(map(repr, self.parts)))
 
 
 class Repl(Value):
index a87a52473b0a46bd9792671b59946db657739074..4c7f2b3ea37ab0e9448e7a3742bcd2159a3022ad 100644 (file)
@@ -113,7 +113,7 @@ class ValueTransformer(AbstractValueTransformer):
         return Part(self.on_value(value.value), self.on_value(value.offset), value.width)
 
     def on_Cat(self, value):
-        return Cat(self.on_value(o) for o in value.operands)
+        return Cat(self.on_value(o) for o in value.parts)
 
     def on_Repl(self, value):
         return Repl(self.on_value(value.value), value.count)
index 85e72f036b575d0b10abd6b361d926fbb9ef6924..bf6b0fd375fbd00d7343c3cdf2a7e667ceb1fa18 100644 (file)
@@ -42,15 +42,15 @@ class ValueTestCase(FHDLTestCase):
         self.assertEqual(s2.end, 2)
         s3 = Const(31)[::2]
         self.assertIsInstance(s3, Cat)
-        self.assertIsInstance(s3.operands[0], Slice)
-        self.assertEqual(s3.operands[0].start, 0)
-        self.assertEqual(s3.operands[0].end, 1)
-        self.assertIsInstance(s3.operands[1], Slice)
-        self.assertEqual(s3.operands[1].start, 2)
-        self.assertEqual(s3.operands[1].end, 3)
-        self.assertIsInstance(s3.operands[2], Slice)
-        self.assertEqual(s3.operands[2].start, 4)
-        self.assertEqual(s3.operands[2].end, 5)
+        self.assertIsInstance(s3.parts[0], Slice)
+        self.assertEqual(s3.parts[0].start, 0)
+        self.assertEqual(s3.parts[0].end, 1)
+        self.assertIsInstance(s3.parts[1], Slice)
+        self.assertEqual(s3.parts[1].start, 2)
+        self.assertEqual(s3.parts[1].end, 3)
+        self.assertIsInstance(s3.parts[2], Slice)
+        self.assertEqual(s3.parts[2].start, 4)
+        self.assertEqual(s3.parts[2].end, 5)
 
     def test_getitem_wrong(self):
         with self.assertRaises(TypeError):