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:
- Select both
eabcompsymbols in the Graphic Editor and choose Logic Options (Assign menu). The Logic Options dialog box will appear. - Choose the Individual Logic Options button.
- In the Individual Logic Options dialog box, turn on Implement in EAB.
- Choose OK twice.
Download the Graphic Editor file used in this example:
The use of this design is governed by, and subject to, the terms and conditions of the Altera Hardware Reference Design License Agreement.
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:
- How to Use Graphic Editor Examples
- How to Use AHDL Examples
- MAX+PLUS II Help
Design Examples Disclaimer
These design examples may only be used within Altera Corporation devices and remain the property of Altera. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.
