当前位置:网站首页>[Digital IC hand tearing code] Verilog edge detection circuit (rising edge, falling edge, double edge) | topic | principle | design | simulation
[Digital IC hand tearing code] Verilog edge detection circuit (rising edge, falling edge, double edge) | topic | principle | design | simulation
2022-07-05 01:41:00 【myhhhhhhhh】
Preface
This series aims to provide 100% Accurate numbers IC Design / Verify the title of the hand tearing code link , principle ,RTL Design ,Testbench And reference simulation waveform , The content of each article is checked by simulation . The quick navigation links are as follows :
Odd frequency division
Even frequency division
Semi integer batch
decimal / Fractional frequency division
Sequence detector
Mode three detector
Beverage machine
Asynchronous reset , Simultaneous release
Edge detection ( Rising edge , Falling edge , On both sides )
Full adder , Half adder
Gray code to binary
single bit Cross clock domain ( Two beats , Edge synchronization , Pulse synchronization )
Sync FIFO
Ought to say , The hand tearing code link is in the interview process Both important and simple A part of , Compared with software jobs , Numbers IC Hand tear code Fixed topic , Limited number , It belongs to a link that must be scored in the whole interview , Outside this series , I also recommend numbers IC Job seekers use “HdlBits” Code Training
Links are as follows
HDLBits — Verilog Practice
Edge detection circuit problem
1. Use Verilog Language , Design the rising edge detection circuit .
2. Use Verilog Language , Design the falling edge detection circuit .
3. Use Verilog Language , Design double edge detection circuit .
Principle of edge detection circuit
Here is to explain the principle , We need to analyze the characteristics of the edge circuit
For a rising edge circuit , If used clk Signals and registers are sampled , The previous shot was picked 0, The input result of the last beat is 1, Then through the operation of combinatorial logic , For the previous shot A Express , For the next shot B Express ,“!A & B” It is the rising edge detection we need .
Empathy , For the falling edge , The previous shot was taken 1, The input result of the last beat is 0,A&!B, It is the falling edge detection circuit we need .
For bilateral edges , The output is ** “!A & B + A&!B” **, namely A^B Exclusive or operation
The specific sequence diagram is as follows
RTL Design
module edge_detect(clk,rst_n,signal,up_edge,down_edge,both_edge);
input clk;
input signal;
input rst_n;
output up_edge;
output down_edge;
output both_edge;
reg signal_r;
[email protected](posedge clk or negedge rst_n)
begin
if(!rst_n)
signal_r <= 1'b0;
else
signal_r <= signal;
end
assign up_edge = !signal_r & signal;
assign down_edge = signal_r & !signal;
assign both_edge = signal_r ^ signal;
endmodule
Testbench Design
`timescale 1ns / 1ps
module edge_detect_tb () ;
reg clk;
reg rst_n;
reg signal;
wire up_edge;
wire down_edge;
wire both_edge;
edge_detect u1(.clk(clk),
.rst_n(rst_n),
.signal(signal),
.up_edge(up_edge),
.down_edge(down_edge),
.both_edge(both_edge));
always #5 clk = !clk;
initial
begin
clk = 0;
rst_n = 1;
signal = 0;
#10
rst_n = 0;
#23
rst_n = 1;
#16
signal = 1;
#50
signal = 0;
#40
$stop;
end
endmodule
Result analysis
As shown in the figure, the rising and falling edges , Electric circuit output Edge arrival detected , Displayed in three wire type output On , The circuit design meets the expectation .
边栏推荐
- What is the length of SHA512 hash string- What is the length of a hashed string with SHA512?
- Exploration and practice of integration of streaming and wholesale in jd.com
- One plus six brushes into Kali nethunter
- 当产业互联网时代真正发展完善之后,将会在每一个场景见证巨头的诞生
- 85.4% mIOU! NVIDIA: using multi-scale attention for semantic segmentation, the code is open source!
- A simple SSO unified login design
- Are you still writing the TS type code
- [Chongqing Guangdong education] National Open University spring 2019 1042 international economic law reference questions
- Basic operation of database and table ----- phased test II
- One click generation and conversion of markdown directory to word format
猜你喜欢
Win: use PowerShell to check the strength of wireless signal
Wechat applet: independent background with distribution function, Yuelao office blind box for making friends
Basic operation of database and table ----- phased test II
【CTF】AWDP总结(Web)
线上故障突突突?如何紧急诊断、排查与恢复
Codeforces Global Round 19 ABC
小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
phpstrom设置函数注释说明
Win:使用 PowerShell 检查无线信号的强弱
Incremental backup? db full
随机推荐
What is the current situation and Prospect of the software testing industry in 2022?
Actual combat simulation │ JWT login authentication
I use these six code comparison tools
流批一體在京東的探索與實踐
Database postragesq peer authentication
One plus six brushes into Kali nethunter
Hedhat firewall
R语言用logistic逻辑回归和AFRIMA、ARIMA时间序列模型预测世界人口
Nebula Importer 数据导入实践
MATLB|多微电网及分布式能源交易
PHP 基础篇 - PHP 中 DES 加解密详解
力扣剑指offer——二叉树篇
Interesting practice of robot programming 15- autoavoidobstacles
Global and Chinese market of portable CNC cutting machines 2022-2028: Research Report on technology, participants, trends, market size and share
Wechat applet: Xingxiu UI v1.5 WordPress system information resources blog download applet wechat QQ dual end source code support WordPress secondary classification loading animation optimization
es使用collapseBuilder去重和只返回某个字段
pytorch fine-tuning (funtune) : 镂空设计or 偷梁换柱
Package What is the function of JSON file? What do the inside ^ angle brackets and ~ tilde mean?
C basic knowledge review (Part 3 of 4)
Introduction to the gtid mode of MySQL master-slave replication