Hi:
How do I re-write the code shown below, using a for loop and automatic variables?
Thank You!
task class_c::clear();
begin
fork
forever begin
@(this.incoming[0]);
if (this.incoming[0] == 1) begin
#5ns;
this.incoming[0] = 0;
end
end
forever begin
@(this.incoming[1]);
if (this.incoming[1] == 1) begin
#5ns;
this.incoming[1] = 0;
end
end
forever begin
@(this.incoming[2]);
if (this.incoming[2] == 1) begin
#5ns;
this.incoming[2] = 0;
end
end
forever begin
@(this.incoming[3]);
if (this.incoming[3] == 1) begin
#5ns;
this.incoming[3] = 0;
end
end
forever begin
@(this.incoming[4]);
if (this.incoming[4] == 1) begin
#5ns;
this.incoming[4] = 0;
end
end
forever begin
@(this.incoming[5]);
if (this.incoming[5] == 1) begin
#5ns;
this.incoming[5] = 0;
end
end
forever begin
@(this.incoming[6]);
if (this.incoming[6] == 1) begin
#5ns;
this.incoming[6] = 0;
end
end
forever begin
@(this.incoming[7]);
if (this.incoming[7] == 1) begin
#5ns;
this.incoming[7] = 0;
end
end
forever begin
@(this.incoming[8]);
if (this.incoming[8] == 1) begin
#5ns;
this.incoming[8] = 0;
end
end
forever begin
@(this.incoming[9]);
if (this.incoming[9] == 1) begin
#5ns;
this.incoming[9] = 0;
end
end
forever begin
@(this.incoming[10]);
if (this.incoming[10] == 1) begin
#5ns;
this.incoming[10] = 0;
end
end
forever begin
@(this.incoming[11]);
if (this.incoming[11] == 1) begin
#5ns;
this.incoming[11] = 0;
end
end
forever begin
@(this.incoming[12]);
if (this.incoming[12] == 1) begin
#5ns;
this.incoming[12] = 0;
end
end
forever begin
@(this.incoming[13]);
if (this.incoming[13] == 1) begin
#5ns;
this.incoming[13] = 0;
end
end
forever begin
@(this.incoming[14]);
if (this.incoming[14] == 1) begin
#5ns;
this.incoming[14] = 0;
end
end
forever begin
@(this.incoming[15]);
if (this.incoming[15] == 1) begin
#5ns;
this.incoming[15] = 0;
end
end
forever begin
@(this.incoming[16]);
if (this.incoming[16] == 1) begin
#5ns;
this.incoming[16] = 0;
end
end
forever begin
@(this.incoming[17]);
if (this.incoming[17] == 1) begin
#5ns;
this.incoming[17] = 0;
end
end
join_none
end
endtask: clear