Reference Card
coro: a coroutine; task: a running coroutine
Assign |
|
Assign immediately |
|
Assign metavalue |
dut.mysignal.value = Logic("X") dut.mysignal.value = LogicArray("01XZ") dut.mysignal.value = BinaryValue("X") (deprecated) |
Read |
val = dut.mysignal.value (
mysig = dut.mysignal creates an alias/reference) |
Bit slice |
mybit = dut.myarray[0].value mybits = dut.mysignal.value[0] |
Convert |
val = dut.mysignal.value.integer val = dut.mysignal.value.binstr |
Vector length |
|
Check |
|
Logging |
|
Wait time |
|
Generate clock |
|
Wait for signal edge |
await cocotb.triggers.RisingEdge(dut.mysignal) await cocotb.triggers.FallingEdge(dut.mysignal) await cocotb.triggers.Edge(dut.mysignal) |
Run coros concurrently |
task_0 = await cocotb.start(coro_0()) (start coro now)task_1 = cocotb.start_soon(coro) result = await task_0 |
Resume on Task 0 or 1 |
|
Resume on Task 0 and 1 |
|
Kill coro |
|
Queue write |
await cocotb.queue.Queue.put(item) cocotb.queue.Queue.put_nowait(item) |
Queue read |
item = await cocotb.queue.Queue.get() item = cocotb.queue.Queue.get_nowait() |
Queue attributes |
queue.maxsize (None == unlimited)queue.qsize() queue.empty() queue.full() |
Specialized queues |
|
Set up event |
|
Wake up waiters |
|
Wait until |
|
Reset after |
|
Timeout |
|
Force value |
|
Keep value |
|
Release Force/Freeze |
|
Normal assignment is a “deposit” ( |
|
Mark as test |
|
Normal func → coro |
|
Allow func to block |
|
Set up TestFactory |
|
Add test option |
|
Generate tests |
|