当前位置:网站首页>Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
2022-04-23 13:56:00 【Slag Ye】
Experiment 2 design of function adjustable comprehensive timer
- The experiment purpose
- master QuartusII And other experimental tools 、 comprehensive 、 Simulation 、 How to use the download
- master DE2 The functional characteristics and application methods of the developed version of the device
- master Verilog HDL The main methods and techniques of sequential logic system design
- Master and apply EDA Design method and process
- Preview requirements
- understand QuartusII Equal Discipline Distribution 、 Download method and process
- Understand the input of development board 、 The output shows the working characteristics of the resource
- Understand development board design 、 Development and testing methods and processes
- The experimental requirements
Design an adjustable integrated timer . Specific function :
- Show hours 、 branch 、 second , Provide zero setting function . Displayed in seven section pipe or LCD On the screen , You can consider 24/12 Hour mode switching function .
- Capable of measuring seconds 、 branch 、 Hours are modified separately , It can be modified as a whole with two digits or independently with each digit
- The hour report function , The whole point can show a certain form of LED To express .
- Alarm function , Set a specific time , Arrive at a specific time LED Display to display the alarm clock . Pay attention to the duration of the alarm clock , You can also refer to the lazy alarm clock mode .
The initial operation is almost similar to experiment 1 , Please refer to Experiment 1 link :Quartus Prime Hardware experimental development (DE2-115 plate ) Experiment 1 CPU Instruction arithmetic unit design _ Slag ye The blog of -CSDN Blog
It should be noted that , In Experiment 2 , need Replace the value corresponding to the pin , The specific value table is linked as follows :
The main body of code :
module shizhong(clkin,key0,hex0,hex1,hex2,hex3,hex4,hex5,hex6,hex7,KEY0,KEY1,key17,key16,key15,LEDR,LEDG,in,key14,key13,key12);
input clkin;
input key0,key17,key16,key15,key14,key13,key12;
input[6:1] in;
input KEY0,KEY1;
reg clk=0;
output reg[6:0] hex0,hex1,hex2,hex3,hex4,hex5,hex6,hex7;
output reg[7:0] LEDR,LEDG;
reg[7:0] out2,out3,out4,out5,out6,out7;
reg[7:0] second;
reg[7:0] minute;
reg[7:0] hour;
reg[7:0] second1;
reg[7:0] minute1;
reg[7:0] hour1;
integer N=25000000;
integer i=0;
reg[16:0] naozhong=0;
reg[16:0] s=0;
integer a=86400;
always@(posedge clkin) // frequency division
begin
if(i==N)
begin
i=0;
clk=~clk;
end
else i=i+1;
end
always@(posedge clk)
begin
if(key0) s=0; // Zeroing
else
// Count
begin
// It's time for the hour
if(s%3600==0)
begin
LEDR=8'b11111111;
end
else
begin
LEDR=8'b00000000;
s=(s+1)%a;
end
if(key17&&key16==0&&key15==0) // Adjust the hours
begin
if(KEY0==0)s=(s+3600)%a;
else if(KEY1==0)s=(s-3600)%a;
else s=s%a;
end
else if(key17==0&&key16&&key15==0) // Adjust the minutes
begin
if(KEY0==0)s=(s+60)%a;
else if(KEY1==0)s=(s-60)%a;
else s=s%a;
end
else if(key17==0&&key16==0&&key15) // Adjust the second
begin
if(KEY0==0)s=(s+1)%a;
else if(KEY1==0)s=(s-1)%a;
else s=s%a;
end
end
end
always@(key17,key16,key15,s)
begin
// alarm clock
if(key17==1&&key16==1&&key15==1)
begin
naozhong = 0;
if(key12)naozhong=naozhong+in;
else if(key13)naozhong=naozhong+in*60;
else if(key14)naozhong=naozhong+in*3600;
else naozhong=naozhong;
second1=naozhong%60;
minute1=naozhong/60%60;
hour1=naozhong/3600;
out7=hour1/10;
out6=hour1%10;
out5=minute1/10;
out4=minute1%10;
out3=second1/10;
out2=second1%10;
hex7=seven(out7);
hex6=seven(out6);
hex5=seven(out5);
hex4=seven(out4);
hex3=seven(out3);
hex2=seven(out2);
hex1=7'b1111111;
hex0=7'b1111111;
end
else
begin
second=s%60;minute=s/60%60;hour=s/3600;
out7=hour/10;out6=hour%10;
out5=minute/10;out4=minute%10;
out3=second/10;out2=second%10;
hex7=seven(out7);
hex6=seven(out6);
hex5=seven(out5);
hex4=seven(out4);
hex3=seven(out3);
hex2=seven(out2);
hex1=7'b1111111;
hex0=7'b1111111;
if(s==naozhong)LEDG=8'b11111111;
else LEDG=8'b00000000;
end
end
function[6:0] seven;
input [7:0] din;
case(din)
4'h0:seven=7'b1000000;
4'h1:seven=7'b1111001;
4'h2:seven=7'b0100100;
4'h3:seven=7'b0110000;
4'h4:seven=7'b0011001;
4'h5:seven=7'b0010010;
4'h6:seven=7'b0000010;
4'h7:seven=7'b1111000;
4'h8:seven=7'b0000000;
4'h9:seven=7'b0010000;
default:seven=7'b1111111;
endcase
endfunction
endmodule
Hardware testing :
Zeroing
Control time
set alarm , Time out , The green light is on
版权声明
本文为[Slag Ye]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231353463415.html
边栏推荐
- Search ideas and cases of large amount of Oracle redo log
- Quartus Prime硬件实验开发(DE2-115板)实验一CPU指令运算器设计
- 村上春树 --《当我谈跑步时,我谈些什么》句子摘录
- Kettle--控件解析
- RAC environment error reporting ora-00239: timeout waiting for control file enqueue troubleshooting
- Decentralized Collaborative Learning Framework for Next POI Recommendation
- Special window function rank, deny_ rank, row_ number
- [code analysis (5)] communication efficient learning of deep networks from decentralized data
- Question bank and answer analysis of the 2022 simulated examination of the latest eight members of Jiangxi construction (quality control)
- Oracle job scheduled task usage details
猜你喜欢
The query did not generate a result set exception resolution when the dolphin scheduler schedules the SQL task to create a table
freeCodeCamp----arithmetic_ Arranger exercise
Express②(路由)
Modify the Jupiter notebook style
聯想拯救者Y9000X 2020
SQL learning | complex query
UML统一建模语言
UML Unified Modeling Language
freeCodeCamp----time_ Calculator exercise
Express ② (routing)
随机推荐
第十五章 软件工程新技术
Oracle clear SQL cache
RAC environment error reporting ora-00239: timeout waiting for control file enqueue troubleshooting
Oracle creates tablespaces and modifies user default tablespaces
[code analysis (5)] communication efficient learning of deep networks from decentralized data
Special test 05 · double integral [Li Yanfang's whole class]
JUC interview questions about synchronized, ThreadLocal, thread pool and atomic atomic classes
Oracle generates millisecond timestamps
leetcode--977. Squares of a Sorted Array
Oracle and MySQL batch query all table names and table name comments under users
JS 力扣刷题 102. 二叉树的层序遍历
leetcode--357. 统计各位数字都不同的数字个数
Tensorflow Download
Oracle告警日志alert.log和跟踪trace文件中文乱码显示
Oracle database recovery data
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
PG library to view the distribution keys of a table in a certain mode
Jiannanchun understood the word game
Ora-600 encountered in Oracle environment [qkacon: fjswrwo]
SQL learning | complex query