1.wire
module top_module (
input in,
output out);
wire w;
assign w=in;
assign out=w;
endmodule
2.GND
module top_module (
output out);
assign out=1'b0;
endmodule
3.NOR
module top_module (
input in1,
input in2,
output out);
assign out=~(in1|in2);
endmodule
4.Another gate
module top_module (
input in1,
input in2,
output out);
assign out=in1&(~in2);
endmodule
5.two gates
module top_module (
input in1,
input in2,
input in3,
output out);
assign out=in3^(~(in1^in2));
endmodule
6.More logic gates
module top_module(
input a, b,
output out_and,
output out_or,
output out_xor,
output out_nand,
output out_nor,
output out_xnor,
output out_anotb
);
assign out_a

文章详细展示了使用Verilog语言编写的五个不同模块,包括基本逻辑门(如AND、OR、XOR等)、多输入门、真值表电路以及简单的布尔等价判断电路。这些代码展示了数字逻辑设计的基础元素。
最低0.47元/天 解锁文章
170

被折叠的 条评论
为什么被折叠?



