Cuando quiero simular el siguiente código, obtengo estos errores:
"Unresolved reference to 'countmode1'" "Unresolved reference to 'countmode2'" "Unresolved reference to 'countmode3'"
module a8bitCounter(inp[7:0], ocrn, counter[7:0]);
input [7:0] inp;
input ocrn;
output [7:0] counter;
reg [1:0] countmode;
reg [1:0] clksource;
reg done, clk, reset, oc;
reg round = 0;
'include "countmode_1.v" // task functions included here
initial
begin
countmode = {inp[3], inp[6]};
clksource = inp[2:0];
end
parameter S0=3'b001 , S1=3'b010 , S2=3'b011 , S3=3'b100 , S4=3'b101, S5=3'b110 , S6=3'b111 , S7=3'b000 ;
always @ (posedge clk, reset) begin
if (inp[2:0] == 0) begin
end else if(clk)
begin
case (clksource)
S0:begin
if (countmode == 2'b00) begin
countmode1(reset, counter, clksource, ocrn, oc, round, S0, S7);
end
else if (countmode == 2'b01) begin
countmode2(reset, counter, clksource, ocrn, oc, round, S0, S7);
end
else if (countmode == 2'b10) begin
countmode3(reset, counter, clksource, ocrn, oc, round, S0, S7);
end
end
S1:begin
if (countmode == 2'b00) begin
countmode1(reset, counter, clksource, ocrn, oc, round, S1, S7);
end
else if (countmode == 2'b01) begin
countmode2(reset, counter, clksource, ocrn, oc, round, S1, S7);
end
else if (countmode == 2'b10) begin
countmode3(reset, counter, clksource, ocrn, oc, round, S1, S7);
end
end
S2:begin
if(countmode == 2'b00) begin
countmode1(reset, counter, clksource, ocrn, oc, round, S2, S7);
end
else if(countmode == 2'b01) begin
countmode2(reset, counter, clksource, ocrn, oc, round, S2, S7);
end
else if(countmode == 2'b10) begin
countmode3(reset, counter, clksource, ocrn, oc, round, S2, S7);
end
end
endcase
end
end
endmodule
Esto es parte de un contador de ocho bits. Usé las siguientes funciones de tareas para escribirlo:
module countmode();
reg reset , oc , round=0;
reg ocrn;
reg [2:0] S0,S1,S2,S3,S4,S5,S6,S7;
reg [7:0] counter;
reg [1:0] clksource;
task countmode1;
if(reset) begin
counter = 8'b0;
clksource = S0;
end
else if(counter == ocrn) begin
oc = 1;
clksource = S7;
end else if(round == 5) begin
round = 0;
clksource = S7;
end else if(counter == 8'b1) begin
counter = 8'b0;
round = round + 1;
clksource = S0;
end else begin
counter = counter + 1;
clksource = S0;
end
endtask
task countmode2;
if(reset) begin
counter = 8'b0;
clksource = S0;
end else if(counter == ocrn) begin
oc = 1;
clksource = S7;
end else if(round == 5) begin
round = 0;
clksource = S7;
end else if(counter == 8'b1) begin
counter = counter - 1;
round = round + 1;
clksource = S0;
end else begin
counter = counter + 1;
clksource = S0;
end
endtask
task countmode3;
if(reset) begin
counter = 8'b0;
clksource = S0;
end else if(counter == ocrn) begin
counter = 8'b0;
oc = 1;
clksource = S7;
end else if(round == 5) begin
round = 0;
clksource = S7;
end else begin
counter = counter + 1;
round = round + 1;
clksource = S0;
end
endtask
endmodule
Por favor, dime cómo solucionar este error de simulación. No puedo eliminar "siempre" debido a las funciones "if-else".
EDIT: editado y agregue la primera parte del código fuente.