Minres / SystemC-Components

A SystemC productivity library: https://minres.github.io/SystemC-Components/
https://www.minres.com/#opensource
Apache License 2.0
86 stars 24 forks source link

r_last and r_valid for 2 cycles #52

Open mslijepc opened 10 months ago

mslijepc commented 10 months ago

We get the r_last and r_valid for 2 cycles

image

I guess that it can be fixed, instead of

https://github.com/Minres/SystemC-Components/blob/ed4a529680204b25797e35ab7c9875b1d3ada50d/src/bus_interfaces/axi/pin/ace_target.h#L420

putting it in else

if(this->r_ready.read()) { ... 
} else {
            wait(this->r_ready.posedge_event() | clk_delayed); 
}

Because in any case we wait for one cycle afterwards

https://github.com/Minres/SystemC-Components/blob/ed4a529680204b25797e35ab7c9875b1d3ada50d/src/bus_interfaces/axi/pin/ace_target.h#L428

eyck commented 10 months ago

Your proposed fix will not work. ready will be set and cleared by the rising edge of the initiator. The line you prose is being executed in the delta-cycle right after rising edge of the clock- becaus of this wait. But this is the deltacycle where the ready is cleared by the initiator (or maybe not). To me the the waveform looks like a back-to-back response of the target. Can you try to set the ready to 0 after the first response?

mslijepc commented 10 months ago

No, it's not back to back. This is the full waveform

image

For every response, we wait for have 2 cycles ready and last

You are right.. Would then maybe this be correct?

else {
                wait(clk_i.posedge_event());
            }