ISSUE 580

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 580
Notify-List
Category enhancement
Synopsis Add some system functions for use in constant expressions
State open
Class enhancement
Arrival-DateMay 05 2004
Originator sharp@cadence.com (Behavioral Task Force)
Release
Environment
Description
If enhancement/387 is approved, allowing certain system
functions to be used in constant expressions, there may
be some new system functions that would be useful with
this. The most obvious example would be to add a
ceiling-of-log-base-2 function, for use in setting address
bus widths based on memory size, or data width needed to
represent a certain maximum value.

We would need to solicit other suggestions from users.

I could suggest others that are difficult to compute
generally with the existing operators, but I don't know
if they are actually useful. Shalom seemed to think that
some of them might be, though I don't know whether he
meant in general or in constant expressions.

Possible examples might include find-first-bit-set,
though I think this could be computed fairly easily given
a log-base-2 function. A find-first-bit-clear would be
trivial to compute given a find-first-bit-set, using ~.
These would find the MSB. Shalom also mentioned that
finding the LSB set would be useful. It turns out that
this can be computed given a function that finds the MSB
set plus some additional math, though the tricks involved
may not be widely known.

Another related example might be a population count, which
counts the number of set bits in a value. There are also
some other enhancement requests that could be satisfied by
new system functions (e.g. rotates, bit-reversal), and such
functions would also be suitable for constant expressions
(though they might not be useful there).

Again, I don't think we should put any of these in unless
they would actually be useful to users.
Fix
Unknown
Audit-Trail
From: Shalom Bresticker <Shalom.Bresticker@freescale.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: enhancement/580: Add some system functions for use in constant
expressions
Date: Wed, 02 Jun 2004 09:38:54 +0300

MIN, MAX, and ABS functions would be useful.

Unformatted

Hosted by Boyd Technology