question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VHPI: Re-evaluate callbacks for ReadWrite/ReadOnly triggers

See original GitHub issue

Currently, the callbacks being used for ReadWrite and ReadOnly triggers through VHPI (VHDL) are as follows:

ReadWrite : vhpiCbRepEndOfProcesses ReadOnly : vhpiCbRepLastKnownDeltaCycle

I think that there are better callbacks that match the behavior of the VPI interface.

The vhpiCbRepLastKnownDeltaCycle callback more closely matches the VPI ReadWrite behavior, as it occurs after execution of all simulator events for the simulation time. The vhpiCbRepEndOfProcesses is called at the end of every delta cycle during the current time. It also still allows for setting signal/driver values and scheduling Timer events. If any signals are updated, an additional delta cycle will occur.

The vhpiCbRepEndOfTimeStep callback more closely matches the VPI ReadOnly callback in that it occurs at the end of the last delta cycle of the current time but does not allow changing signals/drivers or scheduling Timer events.

The current callback for ReadWrite can cause subtle problems in cocotb tests. If the scheduler yields on a ReadWrite trigger before all delta cycles have finished, it’s possible to set a signal value “early” before events have propagated through the simulation model.

References: IEEE Std 1076-2008 VHDL Language Ref Manual Section 14.7.5 and 21.3.6.1 IEEE Std 1364-2001 Verilog Hardware Description Language Section 27.33.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
marlonjamescommented, Jun 15, 2020

Callback support:

Simulator vhpiCbRepLastKnownDeltaCycle support vhpiCbRepEndOfTimeStep support
Aldec Active-HDL 10.1+ ✔️ ✔️
Aldec Riviera 2016.06+ ✔️ ✔️
GHDL Uses VPI Uses VPI
Cadence Incisive ✔️ ✔️
Modelsim/Questa Uses FLI Uses FLI
NVC No longer supported No longer supported
Cadence Xcelium ✔️ ✔️

Edit: For what it’s worth, I discovered that internally GHDL bridges from the VPI interface back to the VHPI model and uses my suggested callbacks already.

1reaction
ktbarrettcommented, Jun 13, 2020

Testing with IUS and Xcelium was done by @themperek and there is no regression. That should complete your table, meaning #1498 can come in.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Active-HDL] VHPI callback issue in some versions prevents ...
Simplified, the issue is as follows: The VHPI callback used for cocotb's ReadWrite trigger is not called on delta cycles of a time...
Read more >
Wait for events using callbacks and Eventarc triggers
Eventarc route the events to the callback-event-listener workflow and triggers its execution. This workflow retrieves the appropriate callback endpoint URLs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found