Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Scaling data

Reply
Thread Tools

Scaling data

 
 
FPGA
Guest
Posts: n/a
 
      02-03-2008
Hello All,

I am using the UNIFORM procedure in VHDL to generate random numbers.
UNIFORM generates random numbers in the range 0.1 to 0.99999. I wish
to generate random signed and unsigned numbers of variable
widths(integer range). I would like to get some ideas on how I should
scale this data? Right now, when i convert the real output from real
to integer to signed, it just gives me an output of wither 0 or 1 .
Your comments would be appreciated

Thank you
 
Reply With Quote
 
 
 
 
Chris Maryan
Guest
Posts: n/a
 
      02-03-2008
On Feb 3, 8:43 am, FPGA <(E-Mail Removed)> wrote:
> Hello All,
>
> I am using the UNIFORM procedure in VHDL to generate random numbers.
> UNIFORM generates random numbers in the range 0.1 to 0.99999. I wish
> to generate random signed and unsigned numbers of variable
> widths(integer range). I would like to get some ideas on how I should
> scale this data? Right now, when i convert the real output from real
> to integer to signed, it just gives me an output of wither 0 or 1 .
> Your comments would be appreciated
>
> Thank you


Try multiplying it by a scaling factor before you convert it to
integer.
 
Reply With Quote
 
 
 
 
sudhi
Guest
Posts: n/a
 
      02-03-2008
On Feb 3, 8:11*am, Chris Maryan <(E-Mail Removed)> wrote:
> On Feb 3, 8:43 am, FPGA <(E-Mail Removed)> wrote:
>
> > Hello All,

>
> > I am using the UNIFORM procedure in VHDL to generate random numbers.
> > UNIFORM generates random numbers in the range 0.1 to 0.99999. I wish
> > to generate random signed and unsigned numbers of variable
> > widths(integer range). I would like to get some ideas on how I should
> > scale this data? Right now, when i convert the real output from real
> > to integer to signed, it just gives me an output of wither 0 or 1 .
> > Your comments would be appreciated

>
> > Thank you

>
> Try multiplying it by a scaling factor before you convert it to
> integer.


Let the real random number you generated be "my_random_number". Let
the random integer (my_random_integer) you want to generate be in the
range "my_range_low" to "my_range_high". Then after using UNIFORM on
"my_random_number", you would do

my_random_integer <= my_range_low + my_random_number*(my_range_high -
my_range_low)

- Sudheendra Kadri
 
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
Scaling numerical data to fit within a boundary. CBlair1986 Ruby 0 04-23-2006 09:01 AM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
Page & Control Scaling? =?Utf-8?B?REVXcmlnaHRfQ0E=?= ASP .Net 1 05-26-2005 05:57 AM
Control Scaling??? =?Utf-8?B?REVXcmlnaHRfQ0E=?= ASP .Net 3 04-28-2005 07:54 AM
Control Scaling??? =?Utf-8?B?REVXcmlnaHRfQ0E=?= ASP .Net 1 04-27-2005 03:19 AM



Advertisments