EDA实验与实践讲义
QD<=Q(3); QC<=Q(2); QB<=Q(1); QA<=Q(0);
PROCESS(Q,ET) BEGIN
IF Q = \ RCO <= '1'; ELSE RCO <= '0'; END IF; END PROCESS;
PROCESS(CLK) BEGIN
IF clk='1' AND clk'EVENT THEN IF(clr='0') THEN Q<=\
ELSIF(LD='0') THEN Q<=D;
ELSIF(ET='1' AND EP='1') THEN IF(Q=\ Q<=\ ELSE
Q<=Q+1; END IF; END IF; END IF;
END PROCESS; END behv;
(5)、源程序之五:基于Verilog HDL的cnt4b_5.v--------模拟74161,74160
module cnt4B_5(clock,asy_reset,load,data,count); input clock, asy_reset,load; input[3:0] data; output [3:0] count; reg [3:0] count;
always @ ( posedge clock or posedge asy_reset ) begin if ( asy_reset )
count = 4'b0000; else if(load) count=data;
else if(count==4'b1111) count = 4'b0000; else count = count + 4'b0001; end endmodule (6)、编译仿真,试比较以上三个程序各有何特点; (7)、硬件验证,:
以ALTERA公司的FLEX_EPF10K10TC144_4为下载目标。 ① 、使用信号和模块:
用模块22,23,12,使用信号如表4-2所示。 ② 、实验内容:验证源程序之三
VHDL&Verilog HDL
41
EDA实验与实践讲义
模块23的第7开关置为ON, 其余为OFF,用开关K8----K1 分别代表加法器的输入A ,B ,C---,H; OUT1~OUT3分别代表其输出;从输出指示LED观察OUT1~OUT3随输入K8----K1的改变情况,看是否满足设计要求。 输 入 芯片 芯 片 功能 输 出 芯片 芯 片 功 能 信号名 脚名 信号类别 信号名 脚名 信号类别 K1 P41 ET OUT1 P116 编码输出out0 K2 P42 EP OUT2 P114 编码输出out1 K3 P43 OUT3 P113 C 编码输出out2 K4 P44 D K5 P46 E K6 P47 F K7 P48 G K8 P49 H
2、移位寄存器设计
(1)源程序:八位串入串出移位寄存器设计shift8.vhd
library ieee;
use ieee.std_logic_1164.all;
entity shift8 is
port(a,clk:in std_logic; b:out std_logic); end shift8;
architecture rtl of shift8 is
signal dfo_0,dfo_1,dfo_2,dfo_3,dfo_4,dfo_5,dfo_6,dfo_7:std_logic; begin
process(clk) begin
if(clk'event and clk='1') then
dfo_0<=a; dfo_1<=dfo_0; dfo_2<=dfo_1; dfo_3<=dfo_2; dfo_4<=dfo_3; dfo_5<=dfo_4; dfo_6<=dfo_5; dfo_7<=dfo_6; end if;
b<=dfo_7;
end process; end rtl; (2)、编译仿真, (3)、硬件验证,:验证源程序之三、四,
以ALTERA公司的FLEX_EPF10K10TC144_4为下载目标。 ①、使用信号和模块:
用模块12,17,18,22,23使用信号如表4-2所示。 ② 、实验内容:
模块23的第7开关置为ON, 其余为OFF,用开关K6----K1 分别代表计数器的数据输入和控制输入ET,EP; OUT1~OUT4分别代表其输出QA,QB,QC,QD;从输出指示LED观察OUT1~OUT4随输入K6----K1的改变情况,看是否满足设计要求。
VHDL&Verilog HDL
42
EDA实验与实践讲义
输 入 芯片 芯 片 功能 输 出 芯片 芯 片 功 能 信号名 脚名 信号类别 信号名 脚名 信号类别 K1 P41 ET OUT1 P116 QA K2 P42 EP OUT2 P114 QB EDGE1 P22 CLR OUT3 P113 QC EDGE2 P23 LD OUT4 P112 QD K3 P43 D0 OUT5 P111 RCO K4 P44 D1 K5 P46 D2 K6 P47 D3 表4-2
实验报告要求
1、 总结计数器的设计;
2、 试比较源程序之三、四的综合结果有何区别。
VHDL&Verilog HDL
43
四、EDA实验与实践讲义
实验七 时序逻辑电路设计之三 -----Moore&Mealy状态机设计
一、实验目的
1、熟悉Moore状态机,Mealy状态机的区别及基本设计方法; 2、掌握VHDL语言的多进程语句的不同应用特点;
3、进一步学习使用EDA集成设计软件Max+plus II进行电路的模拟、综合过程; 二、实验器材
1、AEDK_EDAII实验机及其附件 一台; 2、计算机:Pentium或相应处理器以上,有一个空余的并行口 一台; 三、实验内容
1、一个简单的状态机设计------序列检测器 (1)、源程序之一:detect.vhd library ieee;
use ieee.std_logic_1164.all;
entity detect is
port(x,clk,rst:in std_logic;
z:out std_logic); end detect;
architecture detect_rt of detect is
type states is(idle,st0,st1,st2,st3,st4,st5,st6); signal current_state,next_state:states; begin
reg:process(rst,clk) begin
if(rst='0') then
current_state<=idle;
elsif(clk='1' and clk'event) then current_state<=next_state; end if; end process;
com:process(current_state,x) begin
case(current_state) is
when idle=>if(x='1') then
next_state<=st0; z<='0'; end if; when st0=>if(x='0') then
next_state<=st1; z<='0'; end if;
when st1 =>if(x='0') then
next_state<=st2; z<='0'; else
next_state<=st5; z<='0'; end if;
when st2 =>if(x='1') then
next_state<=st3; z<='0'; else
VHDL&Verilog HDL
44
EDA实验与实践讲义
next_state<=st6; z<='0'; end if;
when st3 =>if(x='0') then
next_state<=st4; z<='1'; else
next_state<=st0; z<='0'; end if; when st4=>if(x='0') then
next_state<=st2; z<='0'; else
next_state<=st0; z<='0'; end if;
when st5 =>if(x='1') then
next_state<=st0; z<='0'; else
next_state<=st1; z<='0'; end if; when st6=>if(x='1') then
next_state<=st5; z<='0'; end if;
when others=>next_state<=idle; end case; end process; end detect_rt; (2)、源程序之二:detect_1.vhd library ieee;
use ieee.std_logic_1164.all;
entity detect_1 is
port(x,clk,rst:in std_logic;
z:out std_logic); end detect_1;
architecture detect_rt of detect_1 is
type states is(idle,st0,st1,st2,st3,st4,st5,st6); signal current_state,next_state:states; begin
reg:process(rst,clk) begin
if(rst='0') then
current_state<=idle;
elsif(clk='1' and clk'event) then current_state<=next_state; end if; end process;
com:process(current_state,x) begin
case(current_state) is
when idle=>if(x='1') then
next_state<=st0;
VHDL&Verilog HDL
45
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库EDA实验指导书 - 图文(10)在线全文阅读。
相关推荐: