+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 5
    Points: 1,100, Level: 7

    Join Date
    Jan 2016
    Posts
    83
    Helped
    0 / 0
    Points
    1,100
    Level
    7

    multiply -ve number and a fraction in verilog

    Is it possible to multiply a negative number with a fraction in verilog? Eg :- -1*0.1;
    If yes how can it be done? What is the format in which the result is stored?
    TIA

    •   AltAdvertisement

        
       

  2. #2
    Newbie level 2
    Points: 28, Level: 1

    Join Date
    Jun 2019
    Posts
    2
    Helped
    1 / 1
    Points
    28
    Level
    1

    Re: multiply -ve number and a fraction in verilog

    You can do everything in verilog! Everything! But you could check out myhdl, which should be able to do what you want. Myhdl generates a verilog file which you could use to learn how to do this in verilog. Also, check out migen.

    Johannes



    •   AltAdvertisement

        
       

  3. #3
    Super Moderator
    Points: 260,308, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,460
    Helped
    13829 / 13829
    Points
    260,308
    Level
    100

    Re: multiply -ve number and a fraction in verilog

    There's no generic format for fractional numbers in Verilog. You have to specify a suitable format according to your requirements. Binary fixed point is the usual choice. It involves a rounding error when representing decimal fixed point numbers, but it's effective and fully compatible with signed and unsigned binary integer format.



--[[ ]]--