chipsalliance / chisel

Chisel: A Modern Hardware Design Language
https://www.chisel-lang.org/
Apache License 2.0
3.93k stars 590 forks source link

How to get the current simulated clock time? #4328

Closed reoLantern closed 1 month ago

reoLantern commented 1 month ago

I hope to use printf to print the simulation cycle or specific nanoseconds, but there seems to be no corresponding function in the chisel api. I don't mean timestamp, which would print the system time.

sequencer commented 1 month ago

This is out of Chisel's capability, Here are something you may need refer to:

You can acquire anything you wish with chisel DPI, and use printf to print the result out. Or wrap it with blackbox encoding a $system call.

uenoku commented 1 month ago

There has been some work on emitting the current simulation time from Chisel printf CC: @girishpai @seldridge

reoLantern commented 1 month ago

thanks