数字逻辑课程设计电子钟
(1) 模8计数器
library ieee;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity mo8 is
port(
clk,clr:in std_logic;
ql:out std_logic_vector(2 downto 0);
co:out std_logic);
end mo8;
architecture rtl of mo8 is
signal qcl :std_logic_vector(2 downto 0);
begin
process(clk)
begin
if(clr='0') then
qcl<="000";
elsif(clk'event and clk='1') then
if(qcl="111") then
qcl<="000";co<='1';
else
qcl<=qcl+'1';co<='0';
end if;
end if;
ql<=qcl;
end process;
end rtl;
(2) 模24计数器
library ieee;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity mo24 is
port(
clk,clr:in std_logic;
en:in std_logic;
ql,qh:out std_logic_vector(3 downto 0);
co:out std_logic);
end mo24;
architecture rtl of mo24 is
signal qcl:std_logic_vector(3 downto 0);
signal qch:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if(clr='0')then
qcl<="0000";qch<="0000";
elsif(clk'event and clk='1')then
co<='0';
if(en='1' and qch="0010"andqcl="0011")then
qcl<="0000";qch<="0000";co<='1';
else
if(en='1' andqcl<"1001")then
qcl<=qcl+'1';
elsif(en='1' andqcl="1001")then
qch<=qch+'1';qcl<="0000";
end if;
end if;
end if;
qh<=qch;ql<=qcl;
end process;
end rtl;
(3) 模60计数器
library ieee;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity mo60 is
port(
clk,clr:in std_logic;
en:in std_logic;
ql,qh:out std_logic_vector(3 downto 0);
co:out std_logic);
end mo60;
architecture rtl of mo60 is
signal qcl:std_logic_vector(3 downto 0);
signal qch:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if(clr='0')then
qcl<="0000";qch<="0000";
elsif(clk'event and clk='1')then
co<='0';
if(en='1' and qch="0101"andqcl="1001")then
qcl<="0000";qch<="0000";co<='1';
else
if(en='1' andqcl<"1001")then
qcl<=qcl+'1';
elsif(en='1' andqcl="1001")then
qch<=qch+'1';qcl<="0000";
end if;
end if;
end if;
qh<=qch;ql<=qcl;
end process;
end rtl;
(4) 分频器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
entity fenpin is
port(
clk:in std_logic;
clk1024,clk512,clk4,clk1:out std_logic);
end fenpin;
architecture rtl of fenpin is
signal ql:std_logic_vector(9downto 0);
begin
process(clk)
begin
if(clk'event and clk='1')then
if(ql="1111111111")then
ql<="0000000000";
else
ql<=ql+1;
end if;
end if;
end process;
clk1024<=clk;
clk512<=ql(0);
clk4<=ql(8);
clk1<=ql(9);
end rtl;
(5) 闹钟
library ieee;
use ieee.std_logic_1164.all;
entity naozhong is
port(
cp1,cp512,cp1024,en:in std_logic;
hourh,hourl,sethourh,sethourl:in std_logic_vector(3 downto 0);
minh,minl,setminh,setminl:in std_logic_vector(3 downto 0);
sech,secl:in std_logic_vector(3 downto 0);
r:out std_logic);
end naozhong;
architecture rtl of naozhongis
begin
process(en,hourh,hourl,sethourh,sethourl,minh,minl,setminh,setminl,cp1,cp512,cp1024)
begin
if(en='1')then
if(hourh=sethourh and hourl=sethourl andminh=setminh and minl=setminl)then
if(cp1='1')then
r<=cp512;
else
r<=cp1024;
end if;
end if;
end if;
end process;
end rtl;
(6) 整点报时
library ieee;
use ieee.std_logic_1164.all;
entity baoshi is
port(
cp1,cp512,cp1024,en:in std_logic;
hourh,hourl,minh,minl,sech,secl:in std_logic_vector(3 downto 0);
r:out std_logic);
end baoshi;
architecture rtl of baoshi is
begin
process(cp1,cp512,cp1024,en,hourh,hourl,minh,minl,sech,secl)
begin
if(en='1')then
if(minh="0101" andminl="1001" and sech="0101")then
if(secl="0001" orsecl="0011" or secl="0101" or secl="0111")then
r<=cp512;
elsif(secl="1001")then
r<=cp1024;
else
r<='0';
end if;
end if;
end if;
end process;
end rtl;
(7) 定闹钟
Hour:
library ieee;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity hour is
port(
clk:in std_logic;
set:in std_logic;
ql,qh:out std_logic_vector(3 downto 0));
end hour;
architecture rtl of hour is
signal qcl:std_logic_vector(3downto 0);
signal qch:std_logic_vector(3downto 0);
begin
process(clk)
begin
if(set='1')then
if(clk'event and clk='1')then
if(qch="0101" andqcl="1001")then
qch<="0000";qcl<="0000";
else
if(qcl="1001")then
qch<=qch+'1';qcl<="0000";
elsif(qcl<"1001")then
qcl<=qcl+'1';
end if;
end if;
end if;
end if;
qh<=qch;ql<=qcl;
end process;
end rtl;
Minutes:
library ieee;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity minute is
port(
clk:in std_logic;
set:in std_logic;
ql,qh:out std_logic_vector(3 downto 0));
end minute;
architecture rtl of minute is
signal qcl:std_logic_vector(3downto 0);
signal qch:std_logic_vector(3downto 0);
begin
process(clk)
begin
if(set='1')then
if(clk'event and clk='1')then
if(qch="0101" andqcl="1001")then
qch<="0000";qcl<="0000";
else
if(qcl="1001")then
qch<=qch+'1';qcl<="0000";
elsif(qcl<"1001")then
qcl<=qcl+'1';
end if;
end if;
end if;
end if;
ql<=qcl;qh<=qch;
end process;
end rtl;
(8) 二选一
A:
library ieee;
use ieee.std_logic_1164.all;
entity xuanze2 is
port(
a,b:in std_logic;
set:in std_logic;
y: out std_logic);
end xuanze2;
architecture rtl of xuanze2 is
begin
process(a,b,set)
begin
if(set='1')then
y<=a;
else
y<=b;
end if;
end process;
end rtl;
B:
library ieee;
use ieee.std_logic_1164.all;
entity xuanze is
port(
y1:in std_logic_vector(3 downto 0);
y2:in std_logic_vector(3 downto 0);
set:in std_logic;
d:out std_logic_vector(3 downto 0));
end xuanze;
architecture rtl of xuanze is
begin
process(y1,y2,set)
begin
if(set='1')then
d<=y1;
else
d<=y2;
end if;
end process;
end rtl;
(9) 七段译码器
library ieee;
use ieee.std_logic_1164.all;
entity duan7 is
port(
d :in std_logic_vector(3 downto 0);
p:out std_logic_vector(6 downto 0));
end duan7;
architecture rtl of duan7 is
begin
process(d)
begin
case d is
when"0000"=>p<="1111110";
when"0001"=>p<="0110000";
when"0010"=>p<="1101101";
when"0011"=>p<="1111001";
when "0100"=>p<="0110011";
when"0101"=>p<="1011011";
when"0110"=>p<="1011111";
when"0111"=>p<="1110000";
when"1000"=>p<="1111111";
when"1001"=>p<="1111011";
when others =>p<="0000001";
end case;
end process;
end rtl;
(10) 八选一选择器
library ieee;
use ieee.std_logic_1164.all;
entity choice8 is
port(
d0,d1,d2,d3,d4,d5,d6,d7:in std_logic_vector(3 downto 0);
sel:in std_logic_vector(2 downto 0);
y:out std_logic_vector(3 downto 0));
end choice8;
architecture rtl of choice8 is
begin
process(sel)
begin
case sel is
when "000"=>y<=d0;
when "001"=>y<=d1;
when "010"=>y<=d2;
when "011"=>y<=d3;
when "100"=>y<=d4;
when "101"=>y<=d5;
when "110"=>y<=d6;
when "111"=>y<=d7;
when others =>y<="0000";
end case;
end process;
end rtl;
数字逻辑课程设计电子钟相关推荐
- 电路与数字逻辑课程设计-电子钟功能
以下内容为我电路与数字逻辑实验的实验报告内容. 实验部分采用的是logisim实现 本实验因时间问题做的比较仓促,有许多不足之处,还请谅解. 想要完整代码的可以在我的博客资源进行下载 电路与数字逻辑课 ...
- 数字逻辑课程设计-数字时钟时分秒的设计
数字逻辑课程设计-数字时钟 ------------- 课程设计的三个简单要求 1.设计一个能显示日期.小时.分钟.秒的数字电子钟,并具有整点报时的功能. 2.由晶振电路产生1HZ标准的信号.分.秒为 ...
- 数字逻辑课程设计,简单的8位模型计算机verilog设计
简单8位模型计算机 0.摘要 1.绪论 1.1 模型计算机简介 1.2 设计主要内容 1.2.1 设计指标 1.2.2 设计思路 2.系统设计 2.1模型计算机原理 2.2 模型计算机组成 2.3 模 ...
- 数字逻辑 课程设计 多功能电子钟 Quartus II
设计方案 1.系统功能描述 (1) 系统输入:系统状态及校时.定时转换的控制信号为k.set:时钟信号clk,采用1024Hz:系统复位信号为reset.输入信号由按键产生. (2) ...
- 数字逻辑课程设计-加法器设计(三位十进制+八位二进制)
首页 寒假期间做的数字逻辑课设,现在整理出来分享给大家. 本文内容参照WUST2019届课程设计报告要求. 课设题目 三位十进制加法器,需要用三位数码管显示 八位二进制加法器,也需要用三位数码管显示 ...
- 数字逻辑课程设计拔河游戏机
<数字逻辑> 课 程 设 计 报 告 题目:拔河游戏机 专业:计算机科学与技术 班级:14计科2班 组长:张钦颖(1414080901218) 成员:无 ...
- 数字电子钟设计制作——数字逻辑课程设计 Verilog HDL CPLD
目的: 1.进一步掌握数字电子技术的理论知识,培养工程设计能力和综合分析问题.解决问题的能力: 2.基本掌握常用电子电路的一般设计方法,提高电子电路的设计和实验能力: 3.掌握复杂可编程逻辑器件CPL ...
- 数字逻辑课程设计#Quartus II
一.设计任务及要求: 设计任务:用Verilog HDL对CPLD芯片EPM240T100C5进行编程,并增加适当的电子元件,设计一个数字电子时钟电路 要求: 1.具有"时"&qu ...
- 数字逻辑课程设计——自动售货机
选题:自动售货机 一.设计任务 1.允许向售货机投入1元的硬币,有4种商品可以选择(商品号从1到4号).首先,用一个键选择商品,在数码管上显示商品号和单价:然后投币,投币时,按一次键模仿投入1元硬币. ...
最新文章
- 2022-2028年中国塑料导爆管行业市场调查研究及前瞻分析报告
- AutowireCapableBeanFactory,实现不必配置xml文件,动态加载bean
- 【控制】《自动控制原理》胡寿松老师-第1章-自动控制的一般概念
- 5827. 检查操作是否合法
- python浮点型数据怎么显示为图片_python数字图像处理(4):图像数据类型及颜色空间转换...
- atitit 知识压缩的总结 学习方法总结v2 t55.docx 目录 1.1. 压缩目的	1 1.2. 压缩分类 无损压缩 有损压缩	1 2. 功能指标	2 2.1. 压缩比:有损压缩一般1
- laravel连接mysql连接数过多_php – Laravel 4和MySQL的连接太多了
- Java实现18位身份证号码的校验码计算校验
- 学习FLASH CS4(一)
- 主机电源供电端口-24PIN ,20PIN ,20+4pin区别
- 自主招生认可的英语竞赛有哪些
- Pytorch——Conv2d、conv2d
- 用TEXT函数解决日期用连接字符日期变成数字格式的问题
- 解决remote: You are not allowed to upload code.fatal: unable to access.The requested URL error:403
- Springcloud config 出现Error occured cloning to base directory.
- uni-app项目开发-----初级入门教程(从0到1制作打包自己的app)
- 哪些软装装饰让你认为是家里装修的点睛之笔?
- 如何搭建 Jenkins 自动化测试平台?
- wps如何自己制作流程图_流程图怎么做_wps流程图怎么制作
- 如何使用ADC测量我们设备的锂电池电压
热门文章
- openlayer加载天地图 并设置地图颜色为科技蓝
- hwd分别是长宽高_DS-2CD7A47HWD-XZS 海康威视400万人脸比对摄像机 DS-2CD7A47HWD-XZS/JM
- 基于FPGA的VGA/LCD显示控制器设计(中)
- WPF 使用 Composition API 做高性能渲染
- 机器视觉技术助力工业物联网发展,起到核心作用。
- java两个时间相差分钟_Java计算两个日期时间相差几天,几小时,几分钟等
- 杭电多校3-Hdu6797 Tokitsukaze and Rescue
- Windows Embedded CE 6.0 and R2 下载地址
- 赛门铁克:中国挤掉美国成僵尸电脑超级大国
- 集成电路开发及应用-设计部分专栏目录