Issue #387
system perl cannot handle 2 uses of SP_TEMPLATE
| Status: | Assigned | Start date: | 09/06/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Wilson Snyder | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
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.
History
Updated by John Stevenson over 1 year ago
/*AUTOINST*/in the code snippet above.
Updated by Wilson Snyder over 1 year 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)
Updated by John Stevenson over 1 year 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!
Updated by John Stevenson over 1 year 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[0], foo0 ); SP_PIN( foo_instance, foo[1], 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.
Updated by John Stevenson over 1 year 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 :)
Updated by Wilson Snyder over 1 year ago
- File bug387.tgz added
Sorry, you're right to ping me again!
When I try the enclosed example ("make") I think it did exactly what you wanted. If not, please change the example or show why this isn't what you expect.
Updated by John Stevenson over 1 year 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?
Thank you!
Updated by Wilson Snyder over 1 year ago
For arrays and connections to them, see the example/ExMod.sp file in the kit, "sub" is an arrayed cell.
Also available in: Atom
![[logo]](/img/veripool_small.png)