I need to calculate the average time to complete a write/read activity. Lets say there is a bus signal,hwrite. hwrite high->Write, hwrite Low->Read. Certain write/read operation can take 3 cycle,other takes 2,other maybe 10 and so on. I would like to calculate what’s the average latency of a write/read cycle.
So I need to calculate the time between hwrite-high and the next hwrite low, add to a queue or some other array and repeat the same for all the write/read .
At the end of all the cycle,I’ll calculate the time taken by all the writes/read divided by number of write/read. Can someone please suggest me a way to achieve it. I am not able to capture the time correctly. Any suggestion would be great.
Of course, you can use queues to push the values of the counts, and and end of test pop and add, then divide by the queue depth as you suggested.
Ben systemverilog.us