How one can write drive logic for following bus interface such that data should be driven on WRITE cmd and should be able to read of previous READ cmd i.e clock cycle T4 -T5?
Does semaphore helps here OR clocking block should sample and drive ?
clk cycle T1 T2 T3 T4 T5 T6
CMD W1 W2 R1 R2 W3
WR_DATA WD1 WD2 WD3
RD_DATA RD1 RD2
CMD - RD/WR
WR_DATA - 32 bit bus
RD_DATA - 32 bit bus
task drive();
@(posedge clk);
begin
repeat(10)
begin
cmd<=1'b1;
wr_data<=$random();
#2 $display("[%0t] cmd=%d wr_data=%h rd_data=%h",$time,cmd,wr_data,rd_data);
//end
//begin
cmd<=1'b0;
@(posedge clk);
begin
rd_data<=$random();
#2;
end
$display("[%0t] cmd=%d wr_data=%h rd_data=%h",$time,cmd,wr_data,rd_data);
end
end
endtask