imageNamaste FPGA
image
Python RTL Verification1 min read

Async vs Sync in COCOTB/Python

On this page · 1 section

Sync & Async Function in COCOTB

Verification environments demand precise control over test execution. Python's async and sync functions become your conductors, ensuring tasks play their parts in perfect harmony.

  1. async function: Imagine setting up your test. You need to generate reset and clock signals simultaneously. Here,async functions shine. They empower multiple tasks to run concurrently.
  2. sync function: Now, consider testing a multiplier chip. The scoreboard must capture the chip's output before you compare it to pre-defined results (golden data). Here,sync functions take center stage. They enforce a sequential execution, guaranteeing tasks happen in a specific order.

Choosing the Right Instrument:

A) Use async functions for independent tasks that don't rely on each other's results, like generating signals simultaneously.

B) Use sync functions for tasks with dependencies, like comparing chip output to golden data (scoreboard capture first, then model comparison).

image
image
5035 views