Conception d'une bascule D avec réinitialisation asynchrone active basse
Une bascule D est un élément séquentiel qui suit l'entrée d au front donné d'une horloge.
Conception #1 : Avec réinitialisation asynchrone active basse
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
Schéma matériel
Testbench
module tb_dff;
reg clk;
reg d;
reg rstn;
reg [2:0] delay;
dff dff0 (
.d(d),
.rsnt (rstn),
.clk (clk),
.q (q)
);
// Génération d'horloge
always #10 clk = ~clk;
// Scénario de test
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
Conception #2 : Avec réinitialisation synchrone active basse
module dff (
input d,
input rstn,
input clk,
output reg q
);
always @ (posedge clk)
if (!rstn) q <= 0;
else q <= d;
endmodule
Schéma matériel
Testbench
module tb_dff;
reg clk;
reg d;
reg rstn;
reg [2:0] delay;
dff dff0 (
.d(d),
.rsnt (rstn),
.clk (clk),
.q (q)
);
// Génération d'horloge
always #10 clk = ~clk;
// Scénario de test
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
- Recharger, réinitialiser, et reconfigurer votre stratégie IT pour un succès estival
- Convergence IT/OT : un reset culturel pour une transformation digitale durable
- Maîtriser Verilog : Tutoriel complet pour la conception de circuits numériques
- Compteur 4 bits : Comptage Binaire Efficace de 0 à 15
- Conception d'un Compteur Mod-N en Verilog : Module Paramétré et Testbench
- Module Compteur Gray en Verilog – Générateur de Code Gray 4 bits
- Prévenir le windup de réinitialisation PID : stratégies pour un contrôle de processus fiable
- Le 74LS74 Double Bascule D : Référence Complète et Brochage
- Comprendre le bouton Reset sur panneau opérateur CNC : Fonction et utilisation