Google Answers Logo
View Question
 
Q: Verilog Multiplier ( No Answer,   2 Comments )
Question  
Subject: Verilog Multiplier
Category: Computers > Programming
Asked by: itsolutions-ga
List Price: $20.00
Posted: 29 Oct 2005 13:35 PDT
Expires: 10 Nov 2005 19:19 PST
Question ID: 586477
I need a Verilog behavioral model (verilog behavioral code) for a
floating point multiplier.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Verilog Multiplier
From: charliebabbage-ga on 29 Oct 2005 15:19 PDT
 
Have a look through this general search to see if it has what you want:

://www.google.co.uk/search?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-43,GGLG:en&q=verilog+behavioral+code+for+floating+point+multiplier

Alternatively, this might be just what you want:

http://www.eda.org/verilog-ams/htmlpages/public-docs/lrm/2.0/AMS-LRM-2-0.pdf

If this answers your question, donate the fee to the American Hurricane Appeal!
Subject: Re: Verilog Multiplier
From: sm535-ga on 10 Nov 2005 11:46 PST
 
//-------------------------------------------------------
//
// Thi module takes in two floating point numbers as
// expressed by their characteristics and mantissas
// and return the result of their multiplication in
// in the same format.
//
// For example, let us say we want to multiply x1 = 1.2
// by x2 = 3.4. In this case, x1 can be representted as
// 12*(10^-1). So we assign
// x1_characteristic = 12 and x1_mantissa = -1
// Similarly, we can represent
// x2_characteristic = 34 and x2_mantissa = -1
// The result of the multiplication is
// (x1_characteristic*x2_characteristic)*(10^(x1_mantissa+x2_mantissa))
// = (12*34) * (10^(-1-1))
// = 408*10^(-2)
// The output is calculated as
// y_characteristic = 408 and y_mantissa = -2.
//
// The module is limited by the width of its inputs. But
// you can parameterize that.
//-------------------------------------------------------

module float_mult (
     input             clk
   , input             reset

   , input wire [31:0] x1_characteristic
   , input wire [31:0] x1_mantissa
   , input wire [31:0] x2_characteristic
   , input wire [31:0] x2_mantissa

   , output reg [63:0] y_characteristic
   , output reg [32:0] y_mantissa
);

   reg [63:0] y_next_characteristic;
   reg [32:0] y_next_mantissa;

   always @(posedge clk) begin // { change it to 'negedge' if necessary
      if (reset) // active high reset, change it to ~reset if necessary
         {y_characteristic, y_mantissa} <= 0;
      else
         {y_characteristic, y_mantissa} <= {y_next_characteristic,
y_next_mantissa};
   end // }

   always @* begin // {
      y_next_characteristic = x1_characteristic * x2_characteristic;
      y_next_mantissa = x1_mantissa + x2_mantissa;
   end // }
endmodule

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy