Re: multiple instances and (e.g.) vhdl_code
Christopher Felton <[email protected]>
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <[email protected]> |
On 6/8/2015 7:05 AM, Henry Gomersall wrote:
> Is there a template string for getting an identifier for the current
> instance when using vhdl_code?
>
> That is, I want the name of the function inside the vhdl code to be
> different for each call to the instance constructor. So the vhdl_code
> could look something like:
> FOO_BAR.vhdl_code = '''
> foo_bar_$this_id: entity work.SOME_BLOCK(MyHDL)
> ...
> '''
I don't believe there exists an automatic method for
doing this, you would need to manage it yourself. You
could have a random unique value created or use a `id`
string argument to the module (function).
You could use a function attribute and increment on
each call [1]:
def vhdl_stub(...)
vhdl_stub.id = vhdl_stub.id + 1
this_id = vhdl_stib_id
Regards,
Chris
[1] https://gist.github.com/cfelton/79012fa54868fbd2ebf7
------------------------------------------------------------------------------