Altera_Forum
Honored Contributor
9 years agoUsing tasks with wait segments in Verilog
Hello,
I have a problem with using wait segments in my task. I am trying to test a deserializer, that has to work with a specific format. I want to give the full byte to send to the task, then it transforms it to the format the deserializer, and in the end I check whether the input corresponds to the output. My code for the task is:task send_8bit;
input reg Y8bit;
input reg C8bit;
output reg rx_in;
integer counter;
reg PIXEL_IN_Y1;
reg PIXEL_IN_Y2;
reg PIXEL_IN_C1;
reg PIXEL_IN_C2;
begin
// Data protocol:
// Y1: Y6 Y5 Y4 Y3 Y2 Y1 Y0
// Y2: 0 0 0 X X X Y7
// C1: C6 C5 C4 C3 C2 C1 C0
// C2: 0 0 0 0 0 C6 C7
PIXEL_IN_Y1=Y8bit;
PIXEL_IN_Y2=Y8bit;
PIXEL_IN_C1=C8bit;
PIXEL_IN_C2=C8bit;
PIXEL_IN_C2=C8bit;
PIXEL_IN_Y2=6'b000XXX;
PIXEL_IN_C2=5'b00000;
Y8bit_debug=Y8bit;
C8bit_debug=C8bit;
for(counter = 6; counter >=0; counter = counter - 1)
begin
# 1924 //length of 1 data period in ps
rx_in= PIXEL_IN_Y1;
rx_in= PIXEL_IN_Y2;
rx_in= PIXEL_IN_C1;
rx_in= PIXEL_IN_C2;
end
end
endtask However, the code does not work, it seems it only assigns the values once. I simply want to have the option to write send_8bit(MYBYTE1,MYBYTE2,OUTPUT);, have rx_in appear on OUTPUT at the right times and be done with it.