Calculating Percentages in VHDL?

Discussion in 'VHDL' started by Cory Shol, Jan 22, 2014.

  1. Cory Shol

    Cory Shol Guest

    Hello all,

    I am working on a project that needs to complete safety crosschecks on a regular basis.

    If a User sets up the equipment at a specific setting the FPGA logic will calculate a Reference Voltage (lets say a 16 bit number ). The user will also set a percentage from 10-35% (Overvoltage Threshold).

    Once the user says he wants the system to allow 15% of overvoltage.

    I want to calculate in the logic the 16 bit referance voltage * .15 .


    How does one go about calculating percentages? I am using a Xilinx Spartan 3a 700a. A link to an tutorial or algorithm would be great.

    Thanks
     
    Cory Shol, Jan 22, 2014
    #1
    1. Advertising

  2. Cory Shol

    Rob Gaddi Guest

    On Wed, 22 Jan 2014 08:52:10 -0800 (PST)
    Cory Shol <> wrote:

    > Hello all,
    >
    > I am working on a project that needs to complete safety crosschecks on a regular basis.
    >
    > If a User sets up the equipment at a specific setting the FPGA logic will calculate a Reference Voltage (lets say a 16 bit number ). The user will also set a percentage from 10-35% (Overvoltage Threshold).
    >
    > Once the user says he wants the system to allow 15% of overvoltage.
    >
    > I want to calculate in the logic the 16 bit referance voltage * .15 .
    >
    >
    > How does one go about calculating percentages? I am using a Xilinx Spartan 3a 700a. A link to an tutorial or algorithm would be great.
    >
    > Thanks
    >


    R * 0.15 = R * (0.15 * 2^17) / 2^17

    --
    Rob Gaddi, Highland Technology -- www.highlandtechnology.com
    Email address domain is currently out of order. See above to fix.
     
    Rob Gaddi, Jan 22, 2014
    #2
    1. Advertising

  3. Cory Shol

    Cory Shol Guest

    On Wednesday, January 22, 2014 11:45:33 AM UTC-6, Rob Gaddi wrote:
    > On Wed, 22 Jan 2014 08:52:10 -0800 (PST)
    >
    > Cory Shol <> wrote:
    >
    >
    >
    > > Hello all,

    >
    > >

    >
    > > I am working on a project that needs to complete safety crosschecks on a regular basis.

    >
    > >

    >
    > > If a User sets up the equipment at a specific setting the FPGA logic will calculate a Reference Voltage (lets say a 16 bit number ). The user will also set a percentage from 10-35% (Overvoltage Threshold).

    >
    > >

    >
    > > Once the user says he wants the system to allow 15% of overvoltage.

    >
    > >

    >
    > > I want to calculate in the logic the 16 bit referance voltage * .15 .

    >
    > >

    >
    > >

    >
    > > How does one go about calculating percentages? I am using a Xilinx Spartan 3a 700a. A link to an tutorial or algorithm would be great.

    >
    > >

    >
    > > Thanks

    >
    > >

    >
    >
    >
    > R * 0.15 = R * (0.15 * 2^17) / 2^17
    >
    >
    >
    > --
    >
    > Rob Gaddi, Highland Technology -- www.highlandtechnology.com
    >
    > Email address domain is currently out of order. See above to fix.


    Ahh yes , I actually just thought about something similar to that just before I read the reply. Sometimes your brain doesn't work as fast as you want it to.
     
    Cory Shol, Jan 22, 2014
    #3
  4. Cory Shol

    Andy Guest

    Try the fixed point library in VHDL. It is included in the 2008 standard, and a quick google search will get you the vhdl fixed point user guide that shows you how to use it.

    Andy
     
    Andy, Jan 22, 2014
    #4
    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. Dot net work
    Replies:
    2
    Views:
    1,605
    Dot Net Work
    May 20, 2004
  2. Nathan Sokalski
    Replies:
    2
    Views:
    490
    =?Utf-8?B?R2FyeSBL?=
    Jun 15, 2005
  3. Marc  Dugger
    Replies:
    1
    Views:
    6,921
    Marc Dugger
    Dec 10, 2004
  4. Marc  Dugger
    Replies:
    0
    Views:
    554
    Marc Dugger
    Dec 10, 2004
  5. Nathan Sokalski

    Specifying Width and Height properties as percentages

    Nathan Sokalski, Jun 13, 2005, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    136
    Gary K
    Jun 15, 2005
Loading...

Share This Page