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
  

Implementing a Comparison Function Using EABs

This example uses two FLEX 10K EABs to implement a comparison function. The top-level file is named eab_comp.gdf. Two lower-level files named eabcomp.tdf, which were created in the Altera Hardware Description Language (AHDL), perform a comparison on two 5-bit buses. A third lower-level file named final_comp.tdf performs the final comparison. The outputs are 00 if a equals b, 01 if a is greater than b, and 10 is a is less than b.

You must assign a logic option to the two eabcomp.tdf files in order to implement them in the EAB. To implement the assignment:

  1. Select both eabcomp symbols in the Graphic Editor and choose Logic Options (Assign menu). The Logic Options dialog box will appear.
  2. Choose the Individual Logic Options button.
  3. In the Individual Logic Options dialog box, turn on Implement in EAB.
  4. Choose OK twice.

Download the Graphic Editor file used in this example:


eab_comp.gdf

eab_comp.gdf


eabcomp.tdf

constant AeqB  = b"00";
constant AgreB = b"01";
constant BgreA = b"10";


SUBDESIGN eabcomp
(
	a[4..0], b[4..0], clock	: INPUT;
	comp[1..0] : OUTPUT;
)

VARIABLE
a_ff[4..0], b_ff[4..0] : dff;  -- Flipflops used for registering 
                               -- inputs and outputs

BEGIN
a_ff[].clk = clock;
b_ff[].clk = clock;
a_ff[].d = a[];
b_ff[].d = b[];

	If a_ff[].q == b_ff[].q then
	comp[] = AeqB;
	elsif a_ff[].q > b_ff[].q then
	comp[] = AgreB;
	elsif a_ff[].q < b_ff[].q then
	comp[] = BgreA;
	END IF;
END;


final_comp.tdf

constant AeqB  = b"00";

SUBDESIGN final_comp
(
	msbits[1..0], lsbits[1..0], clock	: INPUT;
	comp[1..0] : OUTPUT;
)

VARIABLE
 comp[1..0]  : dff;

BEGIN
comp[].clk = clock;
	If msbits[] == AeqB then
	comp[].d = lsbits[];
	else 
	comp[].d = msbits[];
	END IF;
END;


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


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