A
Andrew Mazin
Guest
Hi All,
In my verification module, I am sending packets to the link. To do
this, I am using blocking tasks like this one:
task send_packet;
.....
for (i=0; i< packet_length; i=i+1)
@(posedge clk) output = data;
....
Between packets, my module must send idles, starting immediately after
packet and ending just before the new one.
I can define the register which controls idles generations:
task send_packet;
.....
disable_idles = 1;
for (i=0; i< packet_length; i=i+1)
@(posedge clk) output = data;
disable_idles = 0;
....
Then, I may use "always" construct to generate idles:
always @(posedge clk)
if (disable_idles == 0)
send_idle;
It will work, but races will occur: disable_idles is written and read
at the same simulation time.
My model must be also able to send packets back-to-back, without idles
between packets.
Is there a way to write this function race-free?
Any help will be highly appreciated
Thanks,
- Andrew
In my verification module, I am sending packets to the link. To do
this, I am using blocking tasks like this one:
task send_packet;
.....
for (i=0; i< packet_length; i=i+1)
@(posedge clk) output = data;
....
Between packets, my module must send idles, starting immediately after
packet and ending just before the new one.
I can define the register which controls idles generations:
task send_packet;
.....
disable_idles = 1;
for (i=0; i< packet_length; i=i+1)
@(posedge clk) output = data;
disable_idles = 0;
....
Then, I may use "always" construct to generate idles:
always @(posedge clk)
if (disable_idles == 0)
send_idle;
It will work, but races will occur: disable_idles is written and read
at the same simulation time.
My model must be also able to send packets back-to-back, without idles
between packets.
Is there a way to write this function race-free?
Any help will be highly appreciated
Thanks,
- Andrew