Skip to content

Hardware functions

An __fpga function is a hardware module. It returns void; its parameters are its ports.

full_adder.flux
__fpga void fullAdder(bits<1> a, bits<1> b, bits<1> cin,
bits<1>& sum, bits<1>& cout) {
sum = a ^ b ^ cin;
cout = (a & b) | ((a ^ b) & cin);
}
Parameter Port
bits<N> name Input
bits<N>& name Output
clock name Clock

When a file holds more than one top-level module, choose one with --top.

flux --emit=hardware --top=fullAdder full_adder.flux