[Feature Request] Instancing primitives as modules
See original GitHub issueConvenience feature request.
Right now FIRRTL primitives require a different syntax than instancing Module. Would it be possible to add support for instancing and wiring up primitives like a Module?
Reasoning: our language infrastructure treats primitives like user-defined modules, thus emitting FIRRTL either requires special casing primitive modules or defining wrapped version of primitives as modules.
Are there any downsides to this approach? Presumably one could write a pass that replaces instances of primitive modules using the function-call-style syntax. Or the other way around (the special primitive syntax would then be considered sugar on top of normal module instantiation). Could this affect any FIRRTL passes?
Example:
circuit Example :
module my_module :
input a : UInt
input b : UInt
output c : UInt
inst my_adder of add
my_adder.in0 <= a
my_adder.in1 <= b
c <= my_adder.out
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Support primitive instantiations · Issue #468 · verilator ... - GitHub
BTW, the problem with the code above is that verilator can not parse anonymous primitive instantiation. If instance name is added, then at...
Read more >Storing Custom Data in Materials Per-Primitive
An overview of the Unreal Engine Custom Primitive Data workflow for storing custom data per primitive that's accessible through Blueprint.
Read more >GPU instancing - Unity - Manual
GPU instancing is a draw call optimization method that renders multiple copies of a meshThe main graphics primitive of Unity. Meshes make up...
Read more >Packed primitives questions - OTOY Forums • View topic
Hi, All the packed primitives are rendered by the plugin, but not this feature is not going to instance the geometry while working...
Read more >The Verilog Language - Electrical and Computer Engineering
Each module has an interface. Module may contain structure: instances of primitives and other modules module mux(f, a, b, sel); output f; input...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@azidar thanks, that reasoning makes sense.
I agree with @edwardcwang that probably the best way to do it is to emit a module with an inline annotation or to special case it in the Magma/Coreir backends.
The problem with simply added the inst syntax is that FIRRTL primops are polymorphic in their input/output types. Thus, at declaration of
inst my_adder of add
, we don’t know the input or output types of my_adder.