Altera Home Page
Literature Licensing
Buy On-Line Download

  Home   |   Products   |   Support   |   End Markets   |   Technology Center   |   Education & Events   |   Corporate   |   Buy On-Line  
  Knowledge Database   |   Devices   |   Design Software   |   Intellectual Property   |   Design Examples   |   mySupport   |   Reference Designs  

 Products
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 Functionality
      Arithmetic
      Memory
      Bus & I/O
      Logic
      Interfaces & Peripherals
      DSP
      Communications
      PLL & Clocking
  
 Design Entry
      Quartus II Project
      Tcl
      VHDL
      Verilog HDL
      C Code Examples
      DSP Builder
      TimeQuest
   On-Chip Debugging
  
 Simulation Tools
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 Legacy Examples
      Graphic Editor
      AHDL
  

AHDL: Parameterized Multiplier (lpm_mult)

This example uses the lpm_mult function and a constant to implement a parameterized multiplier that multiplies two 4-bit values. You can adjust the size of the multiplier by changing the value of the constant WIDTH. This example uses an Include Statement (shown in blue text) to import the contents of the Include File containing the Function Prototype for the lpm_mult function. An Instance Declaration (shown in red text) implements an instance of the function.

For more information on using this example in your project, go to:

tmul3t.tdf

CONSTANT WIDTH = 4;

INCLUDE "lpm_mult.inc";

SUBDESIGN tmul3t
(
    a[WIDTH-1..0]      : INPUT;
    b[WIDTH-1..0]      : INPUT;
    out[2*WIDTH-1..0]  : OUTPUT;
)

VARIABLE

    mult : lpm_mult WITH (LPM_REPRESENTATION="SIGNED",
                 LPM_WIDTHA=WIDTH,LPM_WIDTHB=WIDTH,
                 LPM_WIDTHS=WIDTH,LPM_WIDTHP=WIDTH*2);

BEGIN
    mult.dataa[] = a[];
    mult.datab[] = b[];
    out[] = mult.result[];
END;

Feedback

Did this information help you?

If not, please log onto mySupport to file a technical request or enhancement.


Altera does not warrant that this solution will work for the customer's intended purpose and disclaims all liability for use of or reliance on the solution.

  Please Give Us Feedback