mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
Merge pull request #163 from hgomersall/master
Small fix to enable self.name be used in exceptions in _verifySubs in _Block
This commit is contained in:
commit
b951c3425b
@ -35,7 +35,7 @@ from myhdl._Signal import _Signal, _isListOfSigs
|
||||
|
||||
class _error:
|
||||
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"
|
||||
|
||||
|
||||
@ -107,11 +107,12 @@ class _Block(object):
|
||||
self.symdict = None
|
||||
self.sigdict = {}
|
||||
self.memdict = {}
|
||||
self.name = self.__name__ = func.__name__ + '_' + str(calls - 1)
|
||||
|
||||
# flatten, but keep BlockInstance objects
|
||||
self.subs = _flatten(func(*args, **kwargs))
|
||||
self._verifySubs()
|
||||
self._updateNamespaces()
|
||||
self.name = self.__name__ = func.__name__ + '_' + str(calls - 1)
|
||||
self.verilog_code = self.vhdl_code = None
|
||||
self.sim = None
|
||||
if hasattr(deco, 'verilog_code'):
|
||||
@ -125,7 +126,7 @@ class _Block(object):
|
||||
def _verifySubs(self):
|
||||
for inst in self.subs:
|
||||
if not isinstance(inst, (_Block, _Instantiator, Cosimulation)):
|
||||
raise BlockError(_error.ArgType)
|
||||
raise BlockError(_error.ArgType % (self.name,))
|
||||
if isinstance(inst, (_Block, _Instantiator)):
|
||||
if not inst.modctxt:
|
||||
raise BlockError(_error.InstanceError % (self.name, inst.callername))
|
||||
|
Loading…
x
Reference in New Issue
Block a user