Skip to content

Implement Python output flushing at SV control boundaries#45

Merged
mballance merged 1 commit intomainfrom
mballance/pytest2
Jan 3, 2026
Merged

Implement Python output flushing at SV control boundaries#45
mballance merged 1 commit intomainfrom
mballance/pytest2

Conversation

@mballance
Copy link
Member

  • Add output_flush.py utility to flush stdout/stderr
  • Flush before Python->SV calls (invoke_hdl_f, invoke_hdl_t)
  • Flush after posting response (response_py_t) to avoid deadlocks
  • Add comprehensive test with Python->SV function calls
  • Works with both ModelSim (multi-threaded) and Verilator (single-threaded)
  • No changes to generated code (DPI wrappers)

Fixes issue where Python output buffering made it difficult to correlate Python execution with SystemVerilog execution.

- Add output_flush.py utility to flush stdout/stderr
- Flush before Python->SV calls (invoke_hdl_f, invoke_hdl_t)
- Flush after posting response (response_py_t) to avoid deadlocks
- Add comprehensive test with Python->SV function calls
- Works with both ModelSim (multi-threaded) and Verilator (single-threaded)
- No changes to generated code (DPI wrappers)

Fixes issue where Python output buffering made it difficult to correlate
Python execution with SystemVerilog execution.
@mballance mballance merged commit ade88dd into main Jan 3, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant