calyxir/calyx

Parameter-dependent attribute values

Opened this issue · 0 comments

I think we should add the ability to specify the value of an attribute using a parameter. The classic example of this is a multiplier with a parameter-defined latency:

primitive mult[W, L](@go @static(L) go: 1, ...) -> (@done done: 1)

This will become useful if/when we want to define memories with parameter-defined read and write latencies and other parameterized pipelined components.

The implementation challenge is exposing this nicely in the IR. Currently, we just query the underlying primitive object and read off it's attribute field. With this change, we'll also need to resolve the parameter value. However, this logic also exists for PortDefs since primitive ports can have parameter-defined bitwidths.