Menu
Coddy logo textTech

Recap - Build A Module

Teil des Abschnitts Grundlagen der Verilog-Journey von Coddy. Lektion 36 von 90.

challenge icon

Aufgabe

Diese Herausforderung vereint alles, was du in diesem Kapitel gelernt hast. Du wirst ein module von Grund auf erstellen und es instanziieren.

Was zu tun ist:

Part 1: Ein module namens <strong>flipflop</strong> erstellen mit:

  • 1-Bit-input namens clk
  • 1-Bit-input namens d
  • 1-Bit-input namens reset
  • 1-Bit-output namens q (verwende reg, zugewiesen in einem always block)

Das module sollte folgendermaßen funktionieren:

  • Wenn reset 1 ist, wird q zu 0
  • Andernfalls wird q bei jeder Taktflanke zu d

Part 2: Das <strong>flipflop</strong>-module im <strong>top</strong>-module mithilfe von port mapping nach Namen instanziieren

Verbinde die ports mit den folgenden Signalen:

  • Port clk → Signal clock
  • Port d → Signal data
  • Port reset → Signal reset_signal
  • Port q → Signal out

Probier es selbst

// Teil 1: Erstelle das flipflop-Modul

  // TODO: Ports hinzufügen

  // TODO: always-Block mit posedge clk und posedge reset hinzufügen
  
  // Wenn reset 1 ist, q <= 0
  
  // Sonst q <= d


// Teil 2: Top-Modul mit Instanziierung
module top (
  input clock,
  input data,
  input reset_signal,
  output out
);

  // TODO: Instantiiere flipflop mit Instanzname ff1
  
  // Verwende Port-Mapping nach Namen: .clk(clock), .d(data), .reset(reset_signal), .q(out)

endmodule

Alle Lektionen in Grundlagen

Übe selbstständig: Online-Verilog-Compiler