mail4idle2
Full Member level 4
Please explain VERILOG local variable static and automatic storage using a example
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function reg [31:0] count_ones(input reg [31:0] value);
integer i;
reg [5:0] total1 = 0;
begin
for ( i=0; i<32; i=i+1) total1 = total + value[i];
count_ones = total1;
end
endfunction
function automatic reg [31:0] count_ones(input reg [31:0] value);
integer i;
reg [5:0] total1 = 0;
begin
for ( i=0; i<32; i=i+1) total1 = total + value[i];
count_ones = total1;
end
endfunction
function automatic int factorial(int n);
if (n==0)
return 1;
else
return factorial(n-1) *n;
endfunction