question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Instancing primitives as modules

See original GitHub issue

Convenience 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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
leonardtcommented, Jul 28, 2017

@azidar thanks, that reasoning makes sense.

0reactions
azidarcommented, Jul 28, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found