API reference¶
Every common operation, one line each. Details: Library reference for full signatures and semantics, Scheduling for exactly when waits resume.
Signals¶
Operation |
Syntax |
|---|---|
Read a port |
|
Write a port (queued, lands next edge) |
|
Write immediately |
|
Wide values (> 64 bits) |
|
Unpacked array element (declared bounds) |
|
Inout: drive / release the bus |
|
Read inside the hierarchy |
|
Deposit inside the hierarchy (immediate) |
|
Force / release an internal signal |
Waiting¶
Operation |
Syntax |
|---|---|
One clock edge |
|
N clock cycles |
|
Fixed time |
|
Post-evaluation settle (cocotb’s edge instant) |
|
End of timestep (sample-only) |
|
Next timestep |
|
Until a condition, sampled on a clock |
|
Concurrency¶
Operation |
Syntax |
|---|---|
Start a concurrent process |
|
Start without keeping a handle |
|
Wait for a process |
|
Cancel a process |
|
Run tasks to completion together |
|
Race triggers, learn the winner |
|
Edge wait with a deadline |
|
Task with a deadline |
|
Queues, events, locks¶
Operation |
Syntax |
|---|---|
Bounded typed FIFO |
|
Blocking transfer |
|
Non-blocking transfer |
|
Broadcast notification (latching) |
|
Mutual exclusion (FIFO handoff) |
|
Counting credits (default-constructed: 0 permits) |
|
Clocks¶
Operation |
Syntax |
|---|---|
Initialize the pin, then start |
|
Phase-shifted second clock |
|
DUT-produced clock |
never started — just |
Checks and test control¶
Operation |
Syntax |
|---|---|
Check and continue |
|
Check and stop the test |
|
Warn without failing |
|
Skip from inside the test |
|
Current simulation time |
Registering tests¶
Operation |
Syntax |
|---|---|
A test |
|
With options |
|
Parametrized case |
|
Expected failure |
|
Randomization¶
Operation |
Syntax |
|---|---|
This process’s stream |
|
Uniform integer (inclusive) |
|
Wide random value |
|
Pick / shuffle |
|
Solve a constrained transaction |
|
With an extra constraint |
Running¶
Operation |
Syntax |
|---|---|
Build, list, run |
|
One test, direct binary |
|
Set the seed |
|
Waveforms |
|
Log level |
|
Full option and key tables: cpptb command line · cpptb.toml.