1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

Added additional helpful info from the .name attribute about which block is failing to return a valid block.

This commit is contained in:
Henry Gomersall 2016-04-14 12:28:23 +01:00
parent 9fd45e74dd
commit c66482e966
No known key found for this signature in database
GPG Key ID: 67F4313D73CED5A6

View File

@ -35,7 +35,7 @@ from myhdl._Signal import _Signal, _isListOfSigs
class _error: class _error:
pass pass
_error.ArgType = "A block should return block or instantiator objects" _error.ArgType = "%s: A block should return block or instantiator objects"
_error.InstanceError = "%s: subblock %s should be encapsulated in a block decorator" _error.InstanceError = "%s: subblock %s should be encapsulated in a block decorator"
@ -126,7 +126,7 @@ class _Block(object):
def _verifySubs(self): def _verifySubs(self):
for inst in self.subs: for inst in self.subs:
if not isinstance(inst, (_Block, _Instantiator, Cosimulation)): if not isinstance(inst, (_Block, _Instantiator, Cosimulation)):
raise BlockError(_error.ArgType) raise BlockError(_error.ArgType % (self.name,))
if isinstance(inst, (_Block, _Instantiator)): if isinstance(inst, (_Block, _Instantiator)):
if not inst.modctxt: if not inst.modctxt:
raise BlockError(_error.InstanceError % (self.name, inst.callername)) raise BlockError(_error.InstanceError % (self.name, inst.callername))