Fabrication industrielle
Internet des objets industriel | Matériaux industriels | Entretien et réparation d'équipement | Programmation industrielle |
home  MfgRobots >> Fabrication industrielle >  >> Industrial programming >> Verilog

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

  1. Recharger, réinitialiser, et reconfigurer votre stratégie IT pour un succès estival
  2. Convergence IT/OT : un reset culturel pour une transformation digitale durable
  3. Maîtriser Verilog : Tutoriel complet pour la conception de circuits numériques
  4. Compteur 4 bits : Comptage Binaire Efficace de 0 à 15
  5. Conception d'un Compteur Mod-N en Verilog : Module Paramétré et Testbench
  6. Module Compteur Gray en Verilog – Générateur de Code Gray 4 bits
  7. Prévenir le windup de réinitialisation PID : stratégies pour un contrôle de processus fiable
  8. Le 74LS74 Double Bascule D : Référence Complète et Brochage
  9. Comprendre le bouton Reset sur panneau opérateur CNC : Fonction et utilisation