Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - problem with code for random number generation

 
Thread Tools Search this Thread
Old 04-12-2007, 05:02 PM   #1
Default problem with code for random number generation


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.


sandeep_sp7
sandeep_sp7 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
need code problem gaurav_kant Software 0 09-29-2007 01:31 PM
Problem in building code with Solaris 9 and g++ compiler dileepd Software 0 07-18-2007 03:05 PM
Problem in VHDL code. caylakprogramci Hardware 2 05-07-2007 07:30 PM
problem with code for random number generation sandeep_sp7 Hardware 0 04-12-2007 04:59 PM
Re: Serious Computer Problem hootnholler A+ Certification 1 11-24-2003 12:18 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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