hdl.ast: suggest bit_select or word_select when indexing with Value.
Fixes #1044.
This commit is contained in:
parent
9e9790377a
commit
b40c18fb00
2 changed files with 13 additions and 0 deletions
|
|
@ -303,6 +303,15 @@ class ValueTestCase(FHDLTestCase):
|
|||
with self.assertRaisesRegex(TypeError,
|
||||
r"^Cannot index value with 'str'$"):
|
||||
Const(31)["str"]
|
||||
with self.assertRaisesRegex(TypeError,
|
||||
r"^Cannot index value with a value; use Value.bit_select\(\) instead$"):
|
||||
Const(31)[Signal(3)]
|
||||
s = Signal(3)
|
||||
with self.assertRaisesRegex(TypeError,
|
||||
r"^Cannot slice value with a value; use Value.bit_select\(\) or Value.word_select\(\) instead$"):
|
||||
Const(31)[s:s+3]
|
||||
|
||||
|
||||
|
||||
def test_shift_left(self):
|
||||
self.assertRepr(Const(256, unsigned(9)).shift_left(0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue