..
en对应SW0 高使能
输出端口:cout[3:0]分别对应LEDG[3:0]
5) 连接硬件,下载程序。 设定输入观看LED3~0的变化
5. 注意事项:
1)用JTAG方式对CPLD编程时,需将开发板上的W1、W2开关分别拨至M1和N0处。 2)将未设定的引脚设置为三态输入。
6. 习题与思考题
..
..
实验五 设计性实验
1. 实验目的
1)掌握常用时序、组合电路的分析设计方法。
2)掌握使用VHDL语言和EDA工具进行数字电路的设计。
2. 实验任务
设计并实现一个数字时钟或彩灯控制器,通过试验箱进行显示。
3实验要求
1、 数字时钟显示分、秒,可以校准时间。 2、 8路彩灯控制器显示花样:(1)从左到右逐个亮,从右到左逐个灭;(2)从两边往中间
逐个亮,从中间往两头逐个灭;(3)亮与灭重复3次;(4)重复(1)(2)(3)。 3、 给出仿真结果,硬件验证。
4.撰写实验报告
..
..
实验一参考 library ieee;
use ieee.std_logic_1164.all; entity decoder_3_8 is port(
keyin:in std_logic_vector(2 downto 0); ledout:out std_logic_vector(0 to 7) ); end;
architecture decoder of decoder_3_8 is signal led:std_logic_vector(0 to 7); begin
process(keyin) begin
case keyin is
when \ when \ when \ when \ when \ when \ when \ when \ when others=>led<=\ end case; end process; ledout<=led; end;
实验三参考 library ieee;
use ieee.std_logic_1164.all; entity COMPARE is port(
a,b:in std_logic; c,d,e:out std_logic ); end;
architecture COMPA of COMPARE is begin
process(a,b) begin
if a>b then
c<='1';d<='0';e<='0'; elsif a
..
..
c<='0';d<='1';e<='0'; elsif a=b then
c<='0';d<='0';e<='1'; end if; end process; end;
实验四参考 library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity COUNTER is port(
clk:in std_logic; clr:in std_logic; en :in std_logic; updown :in std_logic;
count:out std_logic_vector(3 downto 0) ); end;
architecture COUNTE of COUNTER is signal clk1:std_logic;
signal count1:std_logic_vector(3 downto 0); begin
process(clk)
variable cnt:integer range 0 to 49999999; begin
if clk'event and clk='1' then if cnt=49999999 then cnt:=0; clk1<='1'; else
cnt:=cnt+1; clk1<='0'; end if; end if; end process; process(clk1) begin
if clk1'event and clk1='1' then if clr='1' or en='1' then count1<=\ elsif updown='1' then
..
..
count1<=count1+'1'; else
count1<=count1-'1'; end if; end if;
count<=count1; end process; end;
..
相关推荐: