system perl cannot handle 2 uses of SP_TEMPLATE
|Assignee:||Wilson Snyder||% Done:|
Example scenario: I have a module that is instantiated multiple times. Some signals are common between instantiations (e.g. clk); some are unique to each (e.g. data0, data1, ...). I want to use system perl to correctly wire these:
// signals common to each instance are prefixed with common_foo in the module port list // naming scheme meant to disambiguate re matching SP_CELL( foo_instance0, foo ); SP_TEMPLATE( "foo_instance(\d+)", "foo_(.+)", "foo_$2$1" ); SP_TEMPLATE( "foo_instance(\d+)", "common_foo_(.+)", "foo_$2" );
I can get either one of these two SP_TEMPLATEs to work by itself, but not both at the same time.
#2 Updated by Wilson Snyder about 2 years ago
- Status changed from New to Assigned
- Assignee set to Wilson Snyder
I think what you're saying is that the first SP_TEMPLATE makes it not see the second, but this should be supported as the code does look across all SP_TEMPLATEs - the first complete match is what is used, so put the common line first. Alternatively use --debug to see the "SP_TEMPLATE replaced" comments to see what's going on, if there's an issue I'll fix it (see Netlist/Cell.pm)
#3 Updated by John Stevenson about 2 years ago
According to docs, the re's are anchored, i.e., "foo_(.+)" and "common_foo_(.+)" should not match to the same things. In any case, I did try putting the re w/ "common" as the first template, but again, no success. I will try with --debug and report if there is any further progress.
Thanks for the note!
#4 Updated by John Stevenson about 2 years ago
I tried with --debug, but didn't find anything too illuminating. In addition to this, I have now tried the following, but with no success:
SP_TEMPLATE( "foo_instance", "foo\[(\d+)\]", "foo$1" );
However, replacing the template with the following does work:
SP_PIN( foo_instance, foo, foo0 ); SP_PIN( foo_instance, foo, foo1 ); (etc.)
The arrayed wires go to system-c code and the foo0, foo1 (etc) wires go to some RTL that is passed through verilator.
#5 Updated by John Stevenson about 2 years ago
Not sure if there has been any action on this. I would really appreciate the ability to use these features: 1. SP_TEMPLATE 2. SP_CELL_DECL 3. SP_CELL_FORM
I have been trying to make this work with arrayed instantiations of cells, but no luck. The documentation hints that this should be possible, but does not provide any examples. Please help. Happy to chat via e-mail. Thank you :)
#7 Updated by John Stevenson about 2 years ago
Two follow up questions: 1. can I use system perl to instantiate arrays of cells (if yes how? the doc/manpage hints at this but doesn't provide a good example) 2. additional to (1), can I use system perl to connect arrayed inputs to the cell arrays?