实验一-实用计数器的VHDL设计.docx
《实验一-实用计数器的VHDL设计.docx》由会员分享,可在线阅读,更多相关《实验一-实用计数器的VHDL设计.docx(40页珍藏版)》请在三一办公上搜索。
1、实验一实用计数器的VHDL设计一. 实验目的熟悉quartusII的VHDL文本设计流程全过程,学习计数器的设计, 仿真,进一步了解异步的概念。二. 实验原理实用的D触发器除含有时钟端CLK外,还含有异步清零端CLR和 时钟使能端ENA。这里的异步并非时序逻辑的异步,而是指独立于 时钟控制的复位控制端,在任何时候,只要CLR=1,此时D触发器 的输出端即可清零,与时钟信号无关。三. 程序LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY CNT10 ISPORT(CLK,RST,EN,L
2、OAD:IN STD_LOGIC;DATA : IN STD_LOGIC_VECTOR(3 DOWNTO 0);DOUT : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);COUT : OUT STD_LOGIC);END CNT10;ARCHITECTURE BEHAV OF CNT10 ISBEGINPROCESS(CLK,RST,EN,LOAD)VARIABLE Q : STD_LOGIC_VECTOR(3 DOWNTO 0);BEGINIF RST=0 THEN Q : = (OTHERS=0);ELSIF CLKEVENT AND CLK=1 THENIF EN=
3、1 THENIF(LOAD=0) THEN Q:= DATA; ELSEIF Q0);END IF;END IF;END IF;END IF;IF Q二1001 THEN COUT=1;ELSE COUT=0;END IF;DOUT i3 ALTSQRT3 LPM_ABS3 LPM_ADD_SUB3 LPM_COMPARE 1 LPM_C0 UNTER 密Z LPM_DIVIDEvwhich Wp已 of output file do you want to create?r AHDL汗 VHDLr Verilog HDLwhat name do you want for the output
4、 file?| E:WANGH0UYINGch6-2Fleturn to this page for another create operationBrowse.Note: To compile a project successfully in the uartus II software, your design files must be in the project directory, in the global user libraries specified in the Options dialog box (Tools menu), or a user library sp
5、ecified in the User Libraries page of the Settings dialog box (Assignments menu).Your current user library directories are:0 Match project/d&feultXXO Up onlyO Dov.i-! onlv greats ar Lipdown ipLit port to allow nie to do botiiE1 counts up; 0 counts dowrCancelFinish |Currently selected device family!X
6、sloadda.ta3.Oup down clo ckHow wide should the 1CancelFinish-Whidi type of couriter do you want ?C Plain binary() MadnluSr wth a count madulus of 12-Do you want any optional additiorial port5?0 Cl ock. En able口 CarryHn Count Enable0 arry-outResource Usac;e lut f rggCancel;西deNejF-iishIIGeneralGenera
7、lOptional Inputs J-Synthrcnaus inputs口 riearj0 Load Set Set tn all 1sO Settx? |o_-Asyndironaus inputs0 Clear匚 Load Set Set to all 1s0 Set to 0Cancel2iish(2) 生成的计数器文件LIBRARY ieee;USE ieee.std_logic_1164.all;LIBRARY lpm;USE lpm.all;ENTITY CNT4B ISPORTclock:INSTD_LOGIC ;data:INSTD_LOGIC_VECTOR (3 DOWNT
8、O 0);sload:INSTD_LOGIC ;updown: IN STD_LOGIC ;cout:OUT STD_LOGIC;q: OUT STD_LOGIC_VECTOR (3 DOWNTO 0);END CNT4B;ARCHITECTURE SYN OF cnt4b ISSIGNAL sub_wire0 : STD_LOGIC ;SIGNAL sub_wire1 : STD_LOGIC_VECTOR (3 DOWNTO 0);COMPONENT lpm_counterGENERIC (lpm_direction : STRING;lpm_modulus : NATURAL;lpm_po
9、rt_updown : STRING;lpm_type : STRING;lpm_width : NATURAL);PORT (clk_en : IN STD_LOGIC ;aclr : IN STD_LOGIC ;clock : IN STD_LOGIC ;cout : OUT STD_LOGIC ;q : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);data : IN STD_LOGIC_VECTOR (3 DOWNTO 0);updown : IN STD_LOGIC);END COMPONENT;BEGINcout = sub_wire0;q UNUSED”,l
10、pm_modulus = 12,lpm_port_updown = PORT_USED,lpm_type = LPM_COUNTER,lpm_width = 4)PORT MAP (clk_en = clk_en, aclr = aclr, clock = clock, data = data, updown = updown, cout = sub_wire0, q = sub_wire1);END SYN;四. 时序仿真Valiue1?尽ps E.5& u= 5. LZ ns T.6f us 10. El ns IE. f us 15. 3B us LT.军 m ZD. =23. 0A u
11、s Z5. &i =LT 525 de150CIZI: i_rLrLrLrLrLrLrLrLrLrLrLrLrVLrLrLrLrLrLrLrLTLrLrLrLrL匚瑚ESI1lnnI: 1i inUBli 11砂国DPTK i:5X日XTX 6B COTITL5EUUTli| | | | 五. 原理图输入设计实验三基于LPM的流水线乘法累加器设计一. 实验目的熟悉调用quartusII中的LPM计数器,掌握流程的设置以及时序仿 真。通过一个八位流水线乘法累加器的实例介绍顶层原理图工程, VHDL文本描述和宏功能块为原理图元件的输入和设计方法。二. 实验原理通过TOOLS中的MegaWizard
12、 Plug- In Manager命令分别生成LPM加法器模块,乘法模块及寄存器模块。最后有序的将他们连 接在一起构成八位乘法累加器顶层文件。三. 设计过程(1) LPM加法器模块设置调用legafizard Plug-In. Eana.ger page 1 The M&gaWisard Plug-In Manager helps create or modi以 design files that contain custom vanatiors of megafunctions.Which action doou want to perform?G Create a new custom m
13、ega function variabotjEdit an existing custom mega fund ion variation- an existing custom rmegaFunction variatianCopyright C) 1991-2009 Altera CorporationCancel TEA ALTECCJ ALTFP_ABSJ ALTFP_ADD_SUBJ ALTFP_COMPARE才 ALTFF_CONVEFiTJ ALTFP_D IVJ ALTFP_E?PJ ALTFPJNVJ ALTFP_INV_SQRTJ ALTFP_LOGALTFP_MATRIX
14、_MULTJ ALTFP_MULT土| ALTFP_SQRTJ ALTMEMMULTJ ALTMULT_ACCUM (MAC)J ALTMULT_ADDJ ALTMULT_COMPLEX, | ALTSQRTA LPM_ABSWhich type of output file do you want to create?C AHDLG VHDLC Verilog HDLWhat name do you want for the output file?Browse.| E: WAN G H U Yl N G ch6-3M U LT AD D AD D16B- Return to this pa
15、ge for another create operationNote: To compile a project successfully in the Quartus II software, your design files must be in the project directory, in the global user libraries specified in the Options dialog box (Tools menu), or a user library specified in the User Libraries page of the Settings
16、 dialog bow (Assignments menu).Your current user library directories are:LPM_ADD_SUBLPM_COMPARELPM_COUNTERLPM_DIVIDECancelFinishCurrentiy se ected device fan y:v0 Match project/defaultHow wide should the dataa and datab input buses be? IE v bits-Which operating mode do you v.ant for the adder/subtra
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 实验 实用 计数器 VHDL 设计
链接地址:https://www.31ppt.com/p-5174985.html