opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

Not executing clocking block wait in do-while loop

Open senelson7 opened this issue 5 years ago • 8 comments

In push_pull_host_driver.drive_push() task, it's not executing the "@(PUSH_DRIVER)" inside the do-while for the first req. While debugging, I found that it sets valid high, then sets valid low in the same time just for the first one, then it works fine for subsequent ones. I've recently seen this in a WD project too. If I add an "@(PUSH_DRIVER)" at the beginning of the drive_push() task, it works, so it's like if the task starts during a clk cycle, it seems to need to sync to the beginning of a clk cycle or it misses it. But this adds a clk so don't want to and shouldn't need to do that. I'm only running xcelium so maybe this is a Cadence issue? Couldn't view vcs waves last time I tried so haven't been able to see if vcs has this problem too. I'm pursuing it with Cadence but wanted to run it by you also to see if you have any ideas.

senelson7 avatar Mar 19 '21 20:03 senelson7

Thank Steve, do you have a specific test that we can run and check waveforms? I think all my testbenchs are using pull agent only :)

cindychip avatar Mar 19 '21 20:03 cindychip

I don't think this issue is unique to drive_push, drive_pull is pretty much the same idea. But it's good to check apples-apples. Anyways, I checked-in branch es_dv and run entropy_src_rng_test with fixed_seed 1234 (although it fails with other seeds I've tried too). It'll pass right now but looking at the wave, with Cadence at least, you should see no rng_if.valid. I'd like to know if you do with cadence and vcs. Let me know if I should do anything else or if you need any more info.

senelson7 avatar Mar 19 '21 21:03 senelson7

Hi Steve, thanks for bringing this issue up! I'll take a look at the test and seed that you provided, and will update this thread afterwards.

udinator avatar Mar 19 '21 21:03 udinator

I feel it makes sense to wait for the clock before we call try_next_item. So it created #5715, PTAL

weicaiyang avatar Mar 19 '21 21:03 weicaiyang

right now our reset finishes after active edge of clock. If an item is received right after reset, it seems like there is race condition in Xcelium and it starts the item and finishes at the same time. I feel we can update driver to avoid this situation.

weicaiyang avatar Mar 19 '21 21:03 weicaiyang

Just curious, have you determined if this is just an xcelium issue or vcs too?

senelson7 avatar Mar 19 '21 23:03 senelson7

@senelson7 @weicaiyang I just tested with Verdi , it seem to work. image

rasmus-madsen avatar Mar 22 '21 17:03 rasmus-madsen

Rasmus and I met with Cadence Xcelium developers and believe they have interpreted/implemented this correctly. In a nutshell, it has to do with how clocking block signals are scheduled/driven.

The "get and drive" task in the push_pull_host_driver is implemented with: try_next_item, if !null drive, else wait a clk This checks for a new item every clk and if I insert a clk to get by the issue, I can't do back-back transfers.

I modified it to: get_next_item This blocks/waits until a new item is sent and works for back-back.

I recommend modifying unless there's a valid reason it should be as currently implemented.

senelson7 avatar May 03 '21 15:05 senelson7