当前位置:网站首页>FPGA first try
FPGA first try
2022-06-09 02:45:00 【Solubilization】
quartus II Fallible
To write verilog Language and compile

module The name should be the same as the file name , The name should be the same as the project name , It's not easy to make mistakes
modelsim Simulation



Add again testbench, Write your own simulation program
modelSim Repetitive simulation

Suppose you modify testBench Program file or component program , To recompile 

Select the two files to recompile , Recompile
Then open the simulation file 

Pull to the bottom work Inside testBench file , Then determine 
Then the leftmost instance Where? ,ctrl+w Add waveform , then 

restart and run Conduct simulation . Remember that the middle is the total length of time
Analog waveform output decimal

Course design source code
module xiyiji
#(
parameter set_cnt_min = 25'd10
)
(
input wire sys_clk,
input wire sys_work,
output wire [24:0] out_sec,
output wire [24:0] out_min,
output wire [0:0] is_finish
);
reg [24:0] cnt_sec=25'd20;
reg [24:0] state=25'd0;
reg [24:0] cnt_min=set_cnt_min;
always @(posedge sys_clk or negedge sys_work)
if(sys_work==1'b0)begin
// Set to initial value when not working
cnt_sec<=25'd20;
state<=25'd0;
cnt_min<=set_cnt_min;
end
else if(cnt_min==25'd0)begin
cnt_min<=cnt_min;
cnt_sec<=25'd0;
state<=25'd0;
end
else if(cnt_sec==25'd0)begin
if(state==25'd3&&cnt_min==25'd1)begin
// It's over
state<=25'd0;
cnt_min<=25'd0;
cnt_sec<=25'd0;
end
else if(state==25'd3)begin
// A reincarnation is over
state<=25'd0;
cnt_min<=cnt_min-25'd1;
end
else begin
// Jump from one intermediate state to another intermediate state
state<=state+25'd1;
end
cnt_sec<=(state==25'd1||state==25'd3)?25'd19:25'd9;
end
else begin
cnt_sec<=cnt_sec-25'd1;
end
assign out_sec=cnt_sec;
assign out_min=cnt_min;
assign is_finis=(cnt_min==25'd0)?1'b1:1'b0;
endmodule
`timescale 10ns/1ns
module tb_led();
reg sys_clk;
reg sys_work;
wire [24:0] out_sec;
wire [24:0] out_min;
wire [0:0] is_finish;
initial
begin
sys_clk=1'b1;
sys_work<=1'b0;
#20
sys_work<=1'b1;
end
always #10 sys_clk=~sys_clk;
xiyiji
#(
.set_cnt_min(25'd8)
)
xiyijiInst(
.sys_clk(sys_clk),
.sys_work(sys_work),
.out_sec(out_sec),
.out_min(out_min),
.is_finish(is_finish)
);
endmodule
边栏推荐
- Basic method of missing data filling (1) -- k-nearest neighbors (KNN) filling
- Blue Bridge Cup_ Diophantine equation
- oracle 连接PLSQL
- Ccf-csp 202104-1 gray histogram 100 points
- How does Jerry's SPI host configure the driver? [chapter]
- 贪心法/哈夫曼编码
- 杰理最后io_key 双按键如何使用?【篇】
- TypeScript 基础类型 —— 类型断言
- New textbook for self taught examination-p292
- Leetcode 1185. Day of the week
猜你喜欢

Deux facteurs importants affectant la défaillance de togglerowselection ()

toggleRowSelection()失效的2个重要影响因素

Leetcode 1074. Element sum is the number of submatrixes of the target value two-dimensional prefix sum

Ccf-csp 202006-3 markdown renderer 60

Leetcode 454. Quad add II hash

Problems and solutions in using renrenfast

Handwriting perceptron, KNN, decision tree (ID3) for binary classification of iris

Processes and threads

Ccf-csp 201909-4 recommended system 100 points
![[network protocol] | [01] network byte order big end and small end](/img/9f/c69293aa8983161f4733a84389a311.png)
[network protocol] | [01] network byte order big end and small end
随机推荐
Go to MFC from Win32
4426 divisible substring (enumeration + number theory)
Cw2015 alarm function
测试、预发布、生产环境测试时的侧重点是哪些?
qt项目添加编译报错选项
The difference between new and newinstance() for creating objects
Blue Bridge Cup_ Frog date_ Extended Euclid
创建对象之 new 和 newInstance() 的区别
C# 基础篇
Ccf-csp 201903-2 24:00
Leetcode 1371. Each vowel contains an even number of times the longest substring XOR + prefix and
杰理之SPI 从机【篇】
Leetcode 1310. Subarray XOR query prefix and + XOR
杰理之SPI主机【篇】
Two important influencing factors of togglerowselection() failure
QT project add compile error reporting option
C#中的反射原理及应用
说说你印象中比较深刻的 Bug
export相關知識
Leetcode 1155. N façons de rouler les dés