目录
2.1.7 Declaring wires(Wire decl)
2.2.2 Vectors in more detail(Vector1)
2.2.3 Vector part select(Vector2)
2.2.4 Bitwise operators(Vectorgates)
2.2.5 Four-input gates(Gates4)
2.2.6 Vector concatenation operator(Vector3)
2.2.7 Vector reversal 1(Vectorr)
2.2.8 Replication operation(Vector4)
2.2.9 More replication(Vector5)
1 Getting Started
1.1 Getting Started(Step one)
module top_module( output one );
// Insert your code here
assign one = 1'b1;
endmodule
1.2 Output Zero(Zero)
module top_module(
output zero
);// Module body starts after semicolon
assign zero = 1'b0;
endmodule
2 Verilog Language
2.1 Basics
2.1.1 Simple wire(wire)
module top_module( input in, output out );
assign out = in;
endmodule
2.1.2 Four wires(wire4)
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
2.1.3 Inverter(Notgate)
module top_module( input in, output out );
assign out = ~in;
endmodule
2.1.4 AND gate(Andgate)
module top_module(
input a,
input b,
output out );
assign out = a & b;
endmodule
2.1.5 NOR gate (Norgate)
module top_module(
input a,
input b,
output out );
assign out = ~(a|b);
endmodule
2.1.6 XNOR gate(Xnorgate)
module top_module(
input a,
input b,
output out );
assign out = ~(a ^ b);
endmodule