rcc
rcc copied to clipboard
Allow `Wire`s to be instantiated from constants
Problem
Currently, there is no notion of constant wires in RCC traits. In AlgWire trait, we directly support operation of Wire against other constant values. This behavior is rather unintuitive and incurs additional hurdles for the circuit writer, because a constant is not a Wire.
Proposed solution:
In wire traits:
- Change the semantic of
Wireso that it can hold a constant value. - Remove operation of
Wireagainst non-Wirevalues.
In each builder:
- implement
Into<Wire>for intended constant values (u32, F, etc.) - Builders will implement a
Wireabstractly, not assuming that it consists of a single witness element. E.g.rcc-halo2likely will need to change itsWireto an enum consisting ofWitnessorConstant.
Eventually, we should support "expression" builders that builds a circuit symbolically to enable optimization passes. This change should play nicely into enabling such "expression" circuit builder.