fpga学习-与或非门

参考正点原子资料

gate.v

module gate(
    input           A,
    input           B,
    output          Y_and,
    output          Y_or,
    output          Y_not
);

assign Y_and=A&B;
assign Y_or=A|B;
assign Y_not=~A;

endmodule

gate_tb 

`timescale  1ns/1ns  //仿真的单位和精度

module gate_tb();

reg A;
reg B;

wire          Y_and;
wire          Y_or;
wire          Y_not;

initial begin
    A=1'b0;
    B=1'b0;
    #100
    A=1'b0;
    B=1'b1;
    #100
    A=1'b1;
    B=1'b0;
    #100
    A=1'b1;
    B=1'b1;
end

gate u_gate(
 .A(A),
 .B(B),
 .Y_and  (Y_and),
 .Y_or   (Y_or),
 .Y_not  (Y_not)
 
 
);

endmodule

仿真

A0011
B0101
Y_and0001
Y_or0111
Y_not1100

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值