Re: [sv-ec] EXT 8 - randcase


Subject: Re: [sv-ec] EXT 8 - randcase
From: Arturo Salz (Arturo.Salz@synopsys.com)
Date: Tue Sep 02 2003 - 11:03:22 PDT


Ray,

I believe that limiting this to only 32 bits might be too restricting.
Using 32 bit numbers should be a straightforward optimization for the
compiler. As for negative numbers, I had thought that the randcase
would simply treat negative numbers as positive (as if by an explicit
cast to an equally sized unsigned number). Nevertheless, your proposal
for dealing with negative numbers is quite sensible and we should
discussed it further.

    Arturo

----- Original Message -----
From: "Ryan, Ray" <Ray_Ryan@mentorg.com>
To: "'sv-ec@server.eda.org'" <sv-ec@eda.org>
Sent: Sunday, August 31, 2003 5:28 PM
Subject: [sv-ec] EXT 8 - randcase

In the definition, I suggest that:
a) The sum of all weights be restricted to less than (2**32 - 1).
   [This should be true for most all uses and might allow
   for a more efficient implementation.] If the sum of all
   weights exceeds this value, then no branch is taked and
   a warning may be issues.

b) The action for negative weights should be defined. Suggest:
     If a branch specifies a zero (or negative) weight then that
     branch is not taken. If all randcase items specify zero
     (or negative) weights then no branch is taken and a warning may be
issued.

In the last discussion, there was some discussion about stability.
If consistent implementation is desired, here is a possible description of
the behavior:
1) The sum of all weights (SUM) is computed (negative values contribute a
zero weight).
2) If SUM is zero or exceeds (2*32-1), no branch is taken. Otherwise
3) $urandom_range(SUM,0) is used to generate a random number.
4a) If the randomn number is less than the weight of the first branch, then
    that branch is taken. Otherwise the random number is reduced by the
    branch weight.
4b) 4a is repeated for each branch of the randcase statement (following the
order
    the branches occur in the statement).

- Ray



This archive was generated by hypermail 2b28 : Tue Sep 02 2003 - 11:07:56 PDT