组合逻辑电路-basic gates

wire:

Implement the following circuit:

                                          

module top_module (
    input in,
    output out);
assign out=in;
endmodule

gnd:

Implement the following circuit:

.                                                    

module top_module (
    output out);
    assign out=1'b0;
endmodule

NOR:

Implement the following circuit:

                                               

module top_module (
    input in1,
    input in2,
    output out);
    assign out=~(in1|in2);
endmodule

another gate:

Implement the following circuit


                                                  

module top_module (
    input in1,
    input in2,
    output out);
    assign out=in1&(~in2);
endmodule

two gates:

Implement the following circuit:

module top_module (
    input in1,
    input in2,
    input in3,
    output out);
wire t;
    assign t=~(in1^in2);
    assign out=t^in3;
endmodule

more logic gates:

let's try building several logic gates at the same time. Build a combinational circuit with two inputs, a and b.

There are 7 outputs, each with a logic gate driving it:

  • out_and: a and b
  • out_or: a or b
  • out_xor: a xor b
  • out_nand: a nand b
  • out_nor: a nor b
  • out_xnor: a xnor b
  • out_anotb: a and-not b
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_and=a&b; 
    assign out_or=a|b; 
    assign out_xor=a^b; 
    assign out_nand=~(a&b); 
    ass
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值