当前位置:网站首页>[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation

[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation

2022-07-06 02:29: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

Asynchronous reset synchronous release problem

Use Verilog Code , Complete the design of asynchronous reset and synchronous release circuit

The principle of asynchronous reset and synchronous release

One with asynchronous reset end DFF workflow

If one DFF The reset value of is 0, that rst_n=0 When the signal comes , The DFF Reset , When rst_n=1 When the signal comes , The DFF Normal work .

Possible problems

When rst_n The signal returns 1 Time and clk When the signal coming from the rising edge is very close ,DFF Metastable state may be output , The reason why the signal cannot be recognized is 1 still 0

terms of settlement

Asynchronous reset : Yes 0 The reset signal of is not processed , Let it reset normally asynchronously
Simultaneous release : Yes 1 Make two beats of the reset signal , Align the edge of the clock when it is pulled up , In order to avoid metastable state

Sequence diagram of asynchronous reset and synchronous release
 Insert picture description here

RTL Design

module rst_asy(clk,rst_n,rst_out);

input clk;
input rst_n;
output reg rst_out;

reg rst_r1;

[email protected](posedge clk or negedge rst_n)
if(!rst_n)
begin
rst_out<= 1'b0;
rst_r1 <= 1'b0;
end
else
begin
rst_r1 <= rst_n;
rst_out <= rst_r1;
end

endmodule

Testbench Code

`timescale 1ns /1ps
module rst_asy_tb();
reg clk ;
reg rst_n;
wire rst_out;

rst_asy u1(.clk(clk),.rst_n(rst_n),.rst_out(rst_out));

always #5 clk = !clk;

initial
begin
clk = 0;
rst_n = 1;
#7
rst_n = 0;
#5
rst_n = 1;
#30
$stop;
end

endmodule

Simulation analysis

 Insert picture description here

rst_n After re raising ,rst_out Wait for the register to save twice before output , Metastable state is avoided , Design establishment

原网站

版权声明
本文为[myhhhhhhhh]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140019143138.html