Scaling data

Discussion in 'VHDL' started by FPGA, Feb 3, 2008.

  1. FPGA

    FPGA Guest

    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
     
    FPGA, Feb 3, 2008
    #1
    1. Advertising

  2. FPGA

    Chris Maryan Guest

    On Feb 3, 8:43 am, FPGA <> 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.
     
    Chris Maryan, Feb 3, 2008
    #2
    1. Advertising

  3. FPGA

    sudhi Guest

    On Feb 3, 8:11 am, Chris Maryan <> wrote:
    > On Feb 3, 8:43 am, FPGA <> 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
     
    sudhi, Feb 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?REVXcmlnaHRfQ0E=?=

    Control Scaling???

    =?Utf-8?B?REVXcmlnaHRfQ0E=?=, Apr 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    339
    Steven Cheng[MSFT]
    Apr 27, 2005
  2. =?Utf-8?B?REVXcmlnaHRfQ0E=?=

    Control Scaling???

    =?Utf-8?B?REVXcmlnaHRfQ0E=?=, Apr 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    412
    Steven Cheng[MSFT]
    Apr 28, 2005
  3. =?Utf-8?B?REVXcmlnaHRfQ0E=?=

    Page & Control Scaling?

    =?Utf-8?B?REVXcmlnaHRfQ0E=?=, May 25, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    373
    Steven Cheng[MSFT]
    May 26, 2005
  4. AndrewF
    Replies:
    1
    Views:
    808
    Bruce Barker
    Oct 10, 2005
  5. CBlair1986
    Replies:
    0
    Views:
    119
    CBlair1986
    Apr 23, 2006
Loading...

Share This Page