richa.verma
Newbie level 6
I have designed the function to calculate log base 2 and then calling it in module, but it is giving error "External Function 'logb2' may not be used in a constant expression"
The code is:
Help me out to solve this problem!
The code is:
Code:
function integer logb2;
// inputs
input integer n;
begin
n = n-1;
for(logb2=0; n>0; logb2=logb2 + 1)
n = n>>1;
end
endfunction
module fifo(wfull, rempty, data_out, wck, rck, arst_n, wdata_en, rdata_en, data_in);
// Parameters
parameter P_DATA_WIDTH = 32;
parameter P_ADDR_WIDTH = 32;
parameter P_FIFO_DEPTH = 32;
parameter gc_bit = logb2(P_FIFO_DEPTH); [I][B] <<<< The error is for this line[/B][/I]
...
...
...
endmodule
Help me out to solve this problem!
Last edited by a moderator: