Skip to content

Intrinsic Functions

These functions are built into the compiler.

FunctionReturnsContextPurpose
width(expr)intcomp/sim/formalReturns the exact bit-width of any expression, wire, or register
is_signed(expr)boolcomp/sim/formalReturns true if the signal is a signed type
is_comptime(expr)boolcomp/sim/formalReturns true if the compiler knows the literal integer value of the expression

These functions are used to control the hardware from sim blocks.

FunctionReturnsContextPurpose
assert(cond, msg)voidsim/formal/compProve condition always holds
assume(cond, msg)voidsim/formal/compAssume condition holds (Precondition)
concat(expr, …)inferredsim/formal/compConcatenate multiple signals
cover(cond, msg)voidsim/formalCheck if condition is reachable
cycle()voidsim/formalAdvance 1 clock cycle
cycle(n)voidsim/formalAdvance N clock cycles
reset()voidsimHold reset for 1 cycle
reset(n)voidsimHold reset for N cycles
poke(signal, value)voidsimMutates the state of a simulator input from the testbench
print(msg, …)voidsimDebug output

In Simulation: assert checks at runtime and fails the test if false. assume acts like an assert. In Formal: assert is a proof obligation. assume constrains the solver’s inputs. In Components: assert documents invariants that should always be true.