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 Multiplexer (lpm_mux)

In this example, four 4-bit-wide buses (a, b, c, and d) are multiplexed. The widths of the four buses are specified with the parameter LPM_WIDTH, the number of buses being multiplexed is specified with LPM_SIZE, and the number of select lines is specified with LPM_WIDTHS. You can change any of these parameters to suit the needs of your design. The ports of the LPM function are defined in a Function Prototype Statement (shown in blue text). 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:

mux.tdf


FUNCTION lpm_mux (data[LPM_SIZE-1..0][LPM_WIDTH-1..0],
   sel[LPM_WIDTHS-1..0]) 
      WITH (LPM_WIDTH, LPM_SIZE, LPM_WIDTHS, CASCADE_CHAIN)
      RETURNS (result[LPM_WIDTH-1..0]);

SUBDESIGN mux 
(
   a[3..0], b[3..0], c[3..0], d[3..0]  : INPUT;
   select[1..0]                        : INPUT;

   result[3..0]                        : OUTPUT;
)

BEGIN

result[3..0] = lpm_mux (a[3..0], b[3..0], c[3..0], d[3..0],
   select[1..0])
      WITH (LPM_WIDTH=4, LPM_SIZE=4, LPM_WIDTHS=2);

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