Wednesday, October 12, 2016

$clog2 in Verilog

The $clog2 function returns the ceiling of the logarithm to the base 2.

Here is a sample Verilog code that depicts $clog2 function

function integer clog2;
input integer value;
begin
value = value-1;
for (clog2=0; value>0; clog2=clog2+1)
value = value>>1;
end
endfunction

module tb;
parameter A = $clog2(325);
parameter B = $clog2(64);
endmodule

The above piece of Verilog, it generates a value 9 for A.
The above piece of Verilog, it generates a value 6 for B.

3 comments:

  1. Business users may choose the product according to their business level. Other product by the antivirus is for different categories and users across the world rely on it to secure their data.
    [url=https://we-norton.com/]www.norton.com/setup[/url]
    [url=https://supportgeektech.org/]geek squad tech support[/url]
     [url=https://trendrays.com/geek-squad-tech-support/]geek squad tech support[/url]  
     [url=https://trendrays.com/quickbooks-support/]quickbooks support[/url]  

    ReplyDelete
  2. You might be aware of using the Paypal services and it is not wrong to say that Paypal is one of the best, user-friendly payment platforms. Moreover, it facilitates payments that take place via online transfers between different parties. The PayPal credit login platform allows every individual to create an account on its platform that links the user to its account.
    Paypal login

    ReplyDelete