- Documentation
- Flux C++ extension
- Hardware modules
Hardware modules
Calling an __fpga function from another one instantiates it. Each call is its own copy of the hardware.
__fpga void halfAdder(bits<1> a, bits<1> b, bits<1>& sum, bits<1>& carry) { sum = a ^ b; carry = a & b;}
__fpga void fullAdder(bits<1> a, bits<1> b, bits<1> cin, bits<1>& sum, bits<1>& cout) { bits<1> partial; bits<1> carry0; bits<1> carry1; halfAdder(a, b, partial, carry0); halfAdder(partial, cin, sum, carry1); cout = carry0 | carry1;}In Hardware IR each call appears as a named instance. The source tree also contains reusable modules under src/flux/modules/, including UART and SPI.