三峡大学_cpld与电子cad报告及模版

上传人:j****9 文档编号:45978065 上传时间:2018-06-20 格式:DOC 页数:21 大小:1.89MB
返回 下载 相关 举报
三峡大学_cpld与电子cad报告及模版_第1页
第1页 / 共21页
三峡大学_cpld与电子cad报告及模版_第2页
第2页 / 共21页
三峡大学_cpld与电子cad报告及模版_第3页
第3页 / 共21页
三峡大学_cpld与电子cad报告及模版_第4页
第4页 / 共21页
三峡大学_cpld与电子cad报告及模版_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《三峡大学_cpld与电子cad报告及模版》由会员分享,可在线阅读,更多相关《三峡大学_cpld与电子cad报告及模版(21页珍藏版)》请在金锄头文库上搜索。

1、 EDAEDAEDAEDA 实验室实验室实验室实验室1 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering ; 6. .进程举例进程举例 这里看一下 24 进制计数器的进程。 Library ieee; USE ieee.std_logic_1164.all; USE ieee.std_logi

2、c_unsigned.all; ENTITY jsq24_60 is port(clk: in std_logic; clr: in std_logic;EDAEDAEDAEDA 实验室实验室实验室实验室4 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering c,d: out std_logic

3、_vector(3 downto 0); carry: out std_logic); end; Architecture one of jsq24_60 is signal m,n:std_logic_vector(3 downto 0); begin Process(clk,clr,en,m,n) begin if clr=1 then m=“0000“;n=“0000“;elsif clkevent and clk=1then if en=0thenif m=3 and n=2 then n=“0000“;m=“0000“;carry=1; elsif m=3 then m=“0000“

4、;n=n+1; else m=m+1;carry=0;end if; end if; end if; end process; d=m; c=n; end;通过这个 24 进制计数器我了解到了 VHDL 语言编写 cpld 的整体结构以及通过 这个例子了解到编写程序必须注意什么。比如:结尾符号,有开头,有结束, 大区间里的小区间也要有开始与结束等等,EDAEDAEDAEDA 实验室实验室实验室实验室5 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLabora

5、toryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering 这是这是 with_select_then 语句语句,该语句的作用 是当 s 分别为“00” “01” “10”时,对应把 a,b,c 赋值给 x,否则把 d 赋值给 x。 2.2.顺序语句顺序语句1.每一条语句的执行顺序与其书写顺序一致。 2.顺序语句只能出现在进程、函数和过程中。 3.顺序语句包括:赋值语句、流程控制语句、等待语句、子程序调用语句、 返回语句、空操作语句。 4. .顺序语句举例:程序如下业截图顺序语句举例:程序如下

6、业截图程序调试步骤程序调试步骤:选择 file-new,然后选择 waveform Editor file,再从下拉列表 中选择.扩展名,并按 ok,即可创建一个新的无标题的文件,保存并修改名称。 选择 file ,在出现的对话框中输入,按,则设 置了结束时间;选择 ,输入 ,按;选择 菜单项选中框中和项,选择 ,选择按钮,按根据需要编辑波形。首先我们看一下下面首先我们看一下下面 24 进制计数器的程序(实验截图)进制计数器的程序(实验截图)EDAEDAEDAEDA 实验室实验室实验室实验室6 ElectronicElectronicElectronic DesignDesignDesign

7、AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering end loop; 该语句的作用是当 i=4,5,6,7 时,执行顺序语句 shift_var(i):= shift_var(i-4)。 .双向口双向口 双向口申明的格式为: 双向口标号:INOUT 数据类型; .双向口既可以作为输入也可以作为输出。双向端口在完成输入功能时, 必须使原来成输出模式的端口成高阻态,否则,待输入的外部数据势必会与

8、端 口处原有电平发生“线与” ,导致无法将外部数据正确的读入,从而实现“双向” 的功能。 双向口程序截图如下:EDAEDAEDAEDA 实验室实验室实验室实验室8 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering USE ieee.std_logic_1164.all; USE ieee.st

9、d_logic_unsigned.all; ENTITY jsq60_60 is port(clk: in std_logic;clr: in std_logic;en: in std_logic;c,d: out std_logic_vector(3 downto 0);carry: out std_logic);end; Architecture one of jsq60_60 is signal m,n:std_logic_vector(3 downto 0); begin Process(clk,clr,en,m,n) begin if clr=1 then m=“0000“;n=“0

10、000“;elsif clkevent and clk=1then if en=0thenif m=9 and n=5 thenEDAEDAEDAEDA 实验室实验室实验室实验室12 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering m=“0000“;carry=1; elsif m=9 th

11、en m=“0000“;n=n+1; else m=m+1;carry=0;end if; end if; end if; end process; d=m; c=n; end; 60 禁止计数器仿真波形图为波形图的得到在上述有说明,这里不做详细说明了,望老师理解哈!EDAEDAEDAEDA 实验室实验室实验室实验室13 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElect

12、rical EngineeringEngineeringEngineering USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; ENTITY jsq24_60 is port(clk: in std_logic;clr: in std_logic;en: in std_logic;c,d: out std_logic_vector(3 downto 0);carry: out std_logic);end; Architecture one of jsq24_60 is signal m,n:std_logic_vec

13、tor(3 downto 0); begin Process(clk,clr,en,m,n) begin if clr=1 then m=“0000“;n=“0000“;elsif clkevent and clk=1then if en=0thenif m=3 and n=2 then n=“0000“;m=“0000“;carry=1;EDAEDAEDAEDA 实验室实验室实验室实验室14 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratory

14、Laboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering n=n+1; else m=m+1;carry=0;end if; end if; end if; end process; d=m; c=n; end;7.7.比较器程序截图:比较器程序截图:源程序为 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity bjq_60 is port(dss,dsg,dfs,dfg,ss,sg,f

15、s,fg:in std_logic_vector(3 downto 0);q :out std_logic); end; architecture one of bjq_60 is begin process(dss,dsg,dfs,dfg,ss,sg,fs,fg) begin if dss=ss and dsg=sg and dfs=fs and dfg=fg thenEDAEDAEDAEDA 实验室实验室实验室实验室15 ElectronicElectronicElectronic DesignDesignDesign AutomationAutomationAutomation LaboratoryLaboratoryLaboratory, ElectricalElectricalElectrical EngineeringEngineeringEngineering else q=0; end if; end process; end;8.8.报时器截图如下:报时器截图如下:对应程序为:对应程序为: librarylibrar

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号