return _InternalPart(self, offset, width, stride, src_loc_at=src_loc_at)
def __Repl__(self, count, *, src_loc_at=0):
return _InternalRepl(self, count, src_loc_at=src_loc_at)
- def __Repl__(self, count, *, src_loc_at=0):
- return _InternalRepl(self, count, src_loc_at=src_loc_at)
def __Cat__(self, *args, src_loc_at=0):
return _InternalCat(self, *args, src_loc_at=src_loc_at)
def __Mux__(self, val1, val0):
@final
def Repl(value, count, *, src_loc_at=0):
+ if not isinstance(value, Value): # rare instances where integers are passed
+ value = Value.cast(value)
return value.__Repl__(count, src_loc_at=src_loc_at)
s2 = Repl(Const(10), 0)
self.assertEqual(s2.shape(), unsigned(0))
+ def test_integer(self):
+ s1 = Repl(0, 3) # integer value, 1 bit long
+ self.assertEqual(s1.shape(), unsigned(3))
+ s1 = Repl(0b1010, 3) # takes 4 bits to store, repeated 3 times => 12 bit
+ self.assertEqual(s1.shape(), unsigned(12))
+
def test_count_wrong(self):
with self.assertRaises(TypeError):
Repl(Const(10), -1)