hdl.ir: Update error message for Instance arguments

48d4ee4 added the option to specify attributes using Instance arguments,
but the error message wasn't updated accordingly.
This commit is contained in:
Xiretza 2020-10-16 18:36:56 +02:00 committed by whitequark
parent a6db99b05e
commit eb152da59b
2 changed files with 4 additions and 4 deletions

View file

@ -574,7 +574,7 @@ class Instance(Fragment):
self.named_ports[name] = (Value.cast(value), kind) self.named_ports[name] = (Value.cast(value), kind)
else: else:
raise NameError("Instance argument {!r} should be a tuple (kind, name, value) " raise NameError("Instance argument {!r} should be a tuple (kind, name, value) "
"where kind is one of \"p\", \"i\", \"o\", or \"io\"" "where kind is one of \"a\", \"p\", \"i\", \"o\", or \"io\""
.format((kind, name, value))) .format((kind, name, value)))
for kw, arg in kwargs.items(): for kw, arg in kwargs.items():
@ -590,5 +590,5 @@ class Instance(Fragment):
self.named_ports[kw[3:]] = (Value.cast(arg), "io") self.named_ports[kw[3:]] = (Value.cast(arg), "io")
else: else:
raise NameError("Instance keyword argument {}={!r} does not start with one of " raise NameError("Instance keyword argument {}={!r} does not start with one of "
"\"p_\", \"i_\", \"o_\", or \"io_\"" "\"a_\", \"p_\", \"i_\", \"o_\", or \"io_\""
.format(kw, arg)) .format(kw, arg))

View file

@ -786,14 +786,14 @@ class InstanceTestCase(FHDLTestCase):
s = Signal() s = Signal()
with self.assertRaisesRegex(NameError, with self.assertRaisesRegex(NameError,
(r"^Instance argument \('', 's1', \(sig s\)\) should be a tuple " (r"^Instance argument \('', 's1', \(sig s\)\) should be a tuple "
r"\(kind, name, value\) where kind is one of \"p\", \"i\", \"o\", or \"io\"$")): r"\(kind, name, value\) where kind is one of \"a\", \"p\", \"i\", \"o\", or \"io\"$")):
Instance("foo", ("", "s1", s)) Instance("foo", ("", "s1", s))
def test_wrong_construct_kwarg(self): def test_wrong_construct_kwarg(self):
s = Signal() s = Signal()
with self.assertRaisesRegex(NameError, with self.assertRaisesRegex(NameError,
(r"^Instance keyword argument x_s1=\(sig s\) does not start with one of " (r"^Instance keyword argument x_s1=\(sig s\) does not start with one of "
r"\"p_\", \"i_\", \"o_\", or \"io_\"$")): r"\"a_\", \"p_\", \"i_\", \"o_\", or \"io_\"$")):
Instance("foo", x_s1=s) Instance("foo", x_s1=s)
def setUp_cpu(self): def setUp_cpu(self):