This is an old revision of the document!
Debugging Support
When ACT programs get long, it may be difficult to track down why a particular circuit is not being constructed properly. To help debug this, there are two basic debugging constructs provided.
Assertions
Sometimes it is useful to be able to check that a parameter (or an expression of parameters) has a reasonable
value. To express this, ACT supports explicit assertions. We use Hoare's syntax for assertions, so the assertion that
x
must be 8
would be written
{x=8};
If a more meaningful message is required, the following syntax is also supported:
{x=8 : "This assertion failed"};
which also reports the message specified when the assertion failed.
During circuit development/debugging, it may be helpful to assert that two signals are connected to each
other or in fact disconnected from each other at a particular point during circuit construction. To assert that a
is connected to b
, use:
bool a; bool b; { a !== b : "a and b are connected connected!" }; // this will pass a = b; { a === b : "a and b are not connected!" }; // this will pass { a !== b : "a and b are connected connected!" }; // this will fail
The operators ===
and !==
are used to check that the two signals are connected or disconnected at the point the assertion was encountered during circuit construction.