I’m getting the error “functions can’t enable tasks”. Why am I getting this error when I’m not using tasks (as far as I know) ?
I’m trying to improve the readability of my code by splitting it up into functions - and I will want to add other code in the always_ff block.
The compiler doesn’t like this:
function void HandleRxIdle;
endfunction
function void HandleReceiveStates;
unique case( rxState )
RX_IDLE : HandleRxIdle();
endcase
endfunction
always_ff @( posedge clk )
begin
HandleReceiveStates();
end
But it doesn’t complain if I do this:
function void HandleRxIdle;
endfunction
always_ff @( posedge clk )
begin
unique case( rxState )
RX_IDLE : HandleRxIdle();
endcase
end
What is the problem here?
What happens if you change
HandleReceiveStates;
to
HandleReceiveStates();
?
In reply to sbellock:
Same thing I’m afraid. I even tried putting empty brackets on the function definition itself but that made no difference either.
function void Oranges();
endfunction
function void Apples();
Oranges();
endfunction
Same deal above. I added these to remove any dependency on my always_ff() block.
In reply to SparkyNZ:
It would help if you learn how to post a minimal reproducible example. Maybe the problem is somewhere else. This code below ran on 4 different tools:
module top;
bit clk,rxState;
localparam RX_IDLE = 0;
function void HandleRxIdle;
endfunction
function void HandleReceiveStates;
unique case( rxState )
RX_IDLE : HandleRxIdle();
endcase
endfunction
always_ff @( posedge clk )
begin
HandleReceiveStates();
end
initial begin
#5 clk =1;
#5 $finish;
end
endmodule
In reply to dave_59:
In reply to SparkyNZ:
It would help if you learn how to post a minimal reproducible example. Maybe the problem is somewhere else. This code below ran on 4 different tools:
Apologies for not providing a complete module file. If your example module works on 4 different tools then I guess it is a problem/feature specific to Quartus II.
As you can see below, we get the same problem:
In reply to SparkyNZ:
Yes, this is a tool bug. I’m guessing it doesn’t like functions calling void functions.