HDLBits-Verilog-Lernaufzeichnung | Verilog Language-Basics (1)

3.Einfacher Draht

Problem: Erstellen Sie ein Modul mit einem Eingang und einem Ausgang, das sich wie ein Draht verhält.

module top_module( input in, output out );

    assign out = in;
    
endmodule

4.Vier Drähte

Problem: Erstellen Sie ein Modul mit 3 Eingängen und 4 Ausgängen, das sich wie Drähte verhält und diese Verbindungen herstellt:

a -> w
b -> x
b -> y
c -> z

module top_module( 
    input a,b,c,
    output w,x,y,z );
	assign w = a;
    assign x = b;
    assign y = b;
    assign z = c;
endmodule

5.Wechselrichter | Notgate

Problem: Erstellen Sie ein Modul, das ein NOT-Gatter implementiert.

module top_module( input in, output out );

	assign out = ~in;
	
endmodule

6. Und Tor

Problem: Erstellen Sie ein Modul, das ein UND-Gatter implementiert.

module top_module( 
    input a, 
    input b, 
    output out );
	assign out = a & b;
endmodule

7.Nor-Tor

Problem: Erstellen Sie ein Modul, das ein NOR-Gatter implementiert. Ein NOR-Gatter ist ein ODER-Gatter mit invertiertem Ausgang. Eine NOR-Funktion benötigt zwei Operatoren, wenn sie in Verilog geschrieben wird.

module top_module( 
    input a, 
    input b, 
    output out );
    assign out = ~(a | b);
endmodule

8.Xnorgate

Problem: Erstellen Sie ein Modul, das ein XNOR-Gatter implementiert.

module top_module( 
    input a, 
    input b, 
    output out );
    assign out = ~(a ^ b);
endmodule

Guess you like

Origin blog.csdn.net/qq_43374681/article/details/132431068