Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > problem with code for random number generation

Reply
Thread Tools

problem with code for random number generation

 
 
sandeep_sp7 sandeep_sp7 is offline
Junior Member
Join Date: Apr 2007
Posts: 3
 
      04-12-2007
i am having a code for random number generation whose syntax is right and wh
ich can be simulated in modelsim...but the problem is, it is not synthesising
..it is giving an error message as

FATAL_ERROR:HDLParsers:vhptype.c:172:$Id: vhptype.c,v 1.6 2001/10/12 21:32:28 weilin Exp $:200 - I
NTERNAL ERROR... while parsing E:/a/a.vhdl line 1. Contact your hot line. Process will terminate
. To resolve this error, please consult the Answers Database and other online resources at h
ttp://support.xilinx.com. If you need further assistance, please open a Webcase by clic
king on the "WebCase" link at http://support.xilinx.com

the code is:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use ieee.math_real.all; -- for UNIFORM, TRUNC
use ieee.numeric_std.all; -- for TO_UNSIGNED

-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;

entity trial is
Port ( clk:in std_logic;
sd1 : in std_logic;
sd2 : in std_logic;
y : out std_logic_vector(15 downto 0));
end trial;

architecture Behavioral of trial is

signal clk_div:std_logic;
begin
process(clk)
variable clk_vec:std_logic_vector(11 downto 0):=(others=>'0');
begin
if(clk'event and clk='1')
then clk_vec:=clk_vec+'1';
end if;
clk_div<=clk_vec(11);

end process;





process(clk_div)

-- Seed values for random generator
variable seed1, seed2: positive;
-- Random real-number value in range 0 to 1.0
variable rand: real;
-- Random integer value in range 0..4095
variable int_rand: integer;
-- Random 12-bit stimulus
variable stim: std_logic_vector(15 downto 0);


begin

-- initialise seed1, seed2 if you want -
-- otherwise they're initialised to 1 by default
--loop -- testbench stimulus loop?
UNIFORM(seed1, seed2, rand);
-- get a 12-bit random value...
-- 1. rescale to 0..(nearly)4096, find integer part
int_rand := INTEGER(TRUNC(rand*65536.0));
-- 2. convert to std_logic_vector
stim := std_logic_vector(to_unsigned(int_rand, stim'LENGTH));
y<=stim;
--end loop;
end process;

end Behavioral;

does anyone have a solution to this problem!!!!!!!!!!
plssss post the correct code.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
Random Number Generation dpi VHDL 4 03-26-2010 10:31 AM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
problem with code for random number generation sandeep_sp7 Hardware 0 04-12-2007 03:59 PM
Need Help With Random Number Generation Between Upper and Lower Bound ANM Java 2 03-07-2004 07:18 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57