Editor's Note: What you'll see in today's post are items that I think
are equally important - that is, techniques that help you do your
job better. It may not be as exciting as reporting a real nastey
bug you've found, but I think these methodologies are just as helpful
to the Synopsys user. Keep sending them in!
-John
(Post 81 Item 1 ) ----------------------------------------------------------
From: markg@ichips.intel.com (Mark Gonzales)
Subject: A Better VHDL Random Number Generator
Not, strictly speaking, a bug, but the random number generator
(procedure random) in the synopsys distributions.vhd package has a cycle
length of only 8k numbers, making it rather useless. We think this is a
better one (disclaimer: use at your own risk):
procedure RANDOM (variable Seed: inout integer; variable X: out real) is
----------------------------------------------------------------------
-- Random Number generator from:
-- The Art of Computer Systems Performance Analysis, R.Jain 1991 (p443)
-- x(n) := 7^5x(n-1) mod (2^31 - 1)
-- This has period 2^31 - 2, and it works with odd or even seeds
-- This code does not overflow for 32 bit integers.
----------------------------------------------------------------------
constant a : integer := 16807; -- multiplier 7**5
constant m : integer := 2147483647;-- modulus 2**31 - 1
constant q : integer := 127773; -- m DIV a
constant r : integer := 2836; -- m MOD a
constant m_real : real := real(M);
variable seed_div_q : integer;
variable seed_mod_q : integer;
variable new_seed : integer;
begin
seed_div_q := seed / q; -- truncating integer division
seed_mod_q := seed MOD q; -- modulus
new_seed := a * seed_mod_q - r * seed_div_q;
if (new_seed > 0) then
seed := new_seed;
else
seed := new_seed + m;
end if;
X := real(seed) / m_real;
end RANDOM;
Mark Gonzales markg@ichips.intel.com
Not speaking for: Intel Corp. (503) 696 4551
(Post 81 Item 2 ) ----------------------------------------------------------
From: [Some Who Lives on the Edge of Memory]
Here's a little tip if you're finding you're running out of
memory space when you're running Synopsys. Before you read,
write or compile anything, put early on in your script:
perserve_subshells = {}
What happens is that in order to run quickly, whenever you
read a design in, Synopsys puts into your system's memory
a copy of the entire "design read" routine plus all the assorted
data structures involved with reading in designs (which can be
quite bulky) and keeps them there in case you later read in more
designs. Similar things happen when you use the design_compiler.
In effect, the writers of Synopsys have understandably chosen to
speed up the running of their code at the expense of your computer's
memory space. (Which is fine until you start finding that you need
that same memory space to hold designs!)
By going "perserve_subshells = {}", you're telling Synopsys to
free up any memory that's holding Synopsys routines & data structures
that are not *immediately* being used. (If it later finds a need
for these items, it'll go get them off the hard disk at that time,
execute the code, and, when finished with that specific routine,
flush it out of memory.)
This is not a technique that will fit 10 pounds of design into a
5 pound bag, but it can help when you're trying to fit 5.1 pounds
of design into a 5 pound bag!
|
|