Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to add delay at assignment? #1296

Open
developfpga opened this issue Jan 29, 2024 · 5 comments
Open

Is there any way to add delay at assignment? #1296

developfpga opened this issue Jan 29, 2024 · 5 comments

Comments

@developfpga
Copy link

Hi

Is there any way to add delay at assignment? In verilog, I can add delay like below. How can I do it in Spinal?

for combinatorial logic:

assign #(0.025*time) do = r;

for register

q <= #1 d

I need it in my simulation job. For example, I need to adjust input and output signal latency.

@Dolu1990
Copy link
Member

Hi,
Currently, the only way you could would be through a blackbox.

But overall, i guess it could be added natively.

@developfpga
Copy link
Author

Thanks, waiting for offical support.

@Dolu1990
Copy link
Member

Hmm that may take some time, i'm realy underwater.

@jijingg
Copy link
Collaborator

jijingg commented Feb 4, 2024

Adding delay "# 1" to the code is not a good idea, and some teams even explicitly prohibit it in their specifications .
If you have sampling alignment issues, you should solve them in the correct way in testbench

@andreasWallner
Copy link
Collaborator

Do you need the delay in your testbench? If yes and if you use SpinalSim then you can there is delayed: https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Simulation/threadLess.html#thread-less-api
I used this a few times to simulate sync delays, etc. on modules that did not include synchronizers but I wanted to test with the expected delay (and built it directly into the sim driver). If you'd want to use this with an existing driver that you don't want to modify then you can have a small wrapper for simulating with simPublic signals that are driven from the test.

I'm not sure I think its a good idea to add this to the generation capabilities of the core language as its not synthesizable.

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

No branches or pull requests

4 participants