Created
January 19, 2020 06:24
-
-
Save jdavidberger/bdc70abdac5b9378c341d328125186a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _UserVerilogInstance(_UserVerilogCode): | |
def __str__(self): | |
args = inspect.getargspec(self.func)[0] | |
is_signal = lambda arg: arg in self.namespace and isinstance(self.namespace[arg], _Signal) | |
is_param = lambda arg: arg in self.namespace and not isinstance(self.namespace[arg], _Signal) and self.namespace[arg] is not None | |
params = ', '.join([".%s(%s)" % (a,self.namespace[a]) for a in args if is_param(a)]) | |
signals = ','.join(["\n\t.%s(%s)" % (a,self.namespace[a]._name) for a in args if is_signal(a)]) | |
s = "%s #(%s) %s(%s\n);" % (self.funcname, params, | |
self.code if isinstance(self.code, str) else self.block.name, | |
signals); | |
return s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment