D Redefinição assíncrona de flip-flop
Um D flip-flop é um elemento sequencial que segue o pino de entrada d na borda dada de um relógio.
Design nº 1:com reset ativo-baixo assíncrono
module dff ( input d,
input rstn,
input clk,
output reg q);
always @ (posedge clk or negedge rstn)
if (!rstn)
q <= 0;
else
q <= d;
endmodule
Esquema de hardware
Banco de teste
module tb_dff;
reg clk;
reg d;
reg rstn;
reg [2:0] delay;
dff dff0 ( .d(d),
.rsnt (rstn),
.clk (clk),
.q (q));
// Generate clock
always #10 clk = ~clk;
// Testcase
initial begin
clk <= 0;
d <= 0;
rstn <= 0;
#15 d <= 1;
#10 rstn <= 1;
for (int i = 0; i < 5; i=i+1) begin
delay = $random;
#(delay) d <= i;
end
end
endmodule
Design nº 1:com sincronização ativa-baixa redefinida
module dff ( input d,
input rstn,
input clk,
output reg q);
always @ (posedge clk)
if (!rstn)
q <= 0;
else
q <= d;
endmodule
Esquema de hardware
Banco de teste
module tb_dff;
reg clk;
reg d;
reg rstn;
reg [2:0] delay;
dff dff0 ( .d(d),
.rsnt (rstn),
.clk (clk),
.q (q));
// Generate clock
always #10 clk = ~clk;
// Testcase
initial begin
clk <= 0;
d <= 0;
rstn <= 0;
#15 d <= 1;
#10 rstn <= 1;
for (int i = 0; i < 5; i=i+1) begin
delay = $random;
#(delay) d <= i;
end
end
endmodule
Verilog
- Introdução ao Verilog
- Recarregue, reinicie, reconfigure
- Convergência de TI / OT:uma oportunidade para uma redefinição cultural
- Tutorial Verilog
- contador de 4 bits
- Contador Verilog Mod-N
- Contador Verilog Cinza
- Erros PID:redefinir Windup
- 74LS74:um guia completo do flip-flop duplo
- O que é o botão RESET no painel do operador CNC