Re: [sv-bc] RE: clog2 problem

From: Steven Sharp <sharp_at_.....>
Date: Wed Jan 23 2008 - 14:33:00 PST
>From: "Arturo Salz" <Arturo.Salz@synopsys.com>

>No. I meant "N | 1" (the bitwise or operator). I didn't use + because
>addition could cause a wrap-around to 0 and distort the result.
>
>Using "N | 1" works for all positive numbers, even 0.

It fails for N=1.

If overflow is a concern, you could write it as

$clog2({1'b0,N}+1)


Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jan 23 14:33:24 2008

This archive was generated by hypermail 2.1.8 : Wed Jan 23 2008 - 14:33:33 PST