Altera Home Page
文档资料 许可
在线购买 下载

  主页   |   产品   |   支持   |   最终市场   |   技术中心   |   教育与活动   |   公司介绍   |   在线购买  
  mySupport   |   器件   |   软件   |   IP   |   设计范例   |   参考设计  

 产品
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 功能
      算法
      存储器
      总线及I/O
      逻辑
      接口与外设
      DSP
      通信
      PLL & Clocking
  
 设计输入方法
      Quartus II软件工程
      Tcl
      VHDL
      Verilog HDL
      C Code 范例
      DSP Builder
      TimeQuest
   片内调试
  
 仿真工具
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 旧范例
      图形编辑器
      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.

  请填写反馈意见
  注册索取最新邮件通知