Skip to content

Simulating a design

--simulate-build generates a C++ model of your hardware and links it with the main() in the same source.

flux --simulate-build counter_test.flux -o counter_test
./counter_test

Run the build from the Flux repository root so the src/flux/ includes resolve. The command will not overwrite an existing output file; remove it first.

Call Purpose
createClock(name, period) Make a clock with a period
instantiate(module, clocks) Create an instance, naming its clock ports
setInput(instance, port, value) Drive an input
runFor(duration) Advance time
getOutput<T>(instance, port) Read an output

Values are unsigned and at most 64 bits wide.

The model checks logical behavior. It does not check timing, placement, routing, pin wiring or anything electrical. There is no waveform output yet.