【Verilog - 组合逻辑 - 基础2】3. 是非门
全则必缺,极则必反《吕氏春秋·不苟论·博志》
是是非非谓之知,非是是非谓之愚《荀子·修身》
1.0 介绍
是非的辩证是人生中不可不面临的经历,同样,是门(缓冲器)与非门的应用是在数字电路里不可不学习的基础知识!
1.1 非门
非门就如同荀子所言的:“非是,是非,谓之愚”。
入 | 出 |
---|---|
0 | 1 |
1 | 0 |
在verilog,模拟的方法有三个。
1.1.1 非门 - 行为
module fei_xw(input jia, output yi);
assign yi = ~jia;
endmodule
~
就是非的功能。
1.1.2 非门 - 门
module fei_men(input jia, output yi);
not mynot(yi, jia);
endmodule
可以用Verilog自带的not(output out, input in)
来做模拟。
1.1.3 非门 - 电路
module fei_dl(input jia, output yi);
nmos(yi, 0, jia);
pmos(yi, 1, jia);
endmodule
可以用Verilog自带的nmos(inout drain, inout source, input gate)
和pmos(inout drain, inout source, input gate)
来做模拟。
在电路模拟时,1,0就代表高低电压。
1.2 缓冲器(是门)
缓冲器(是门)就是把能好好的把是非分辩的出来。就是说,是就是是,非就是非。不怪荀子曰:“是是,非非,谓之知(智慧)”。
入 | 出 |
---|---|
0 | 0 |
1 | 1 |
在verilog,模拟的方法有三个。
1.2.1 缓冲器 - 行为
module shi_xw(input jia, output yi);
assign yi = jia;
endmodule
可见,缓冲器在行为上就是一个单纯的连接而已。
1.2.2 缓冲器 - 门
module shi_men(input jia, output yi);
buf mybuf(yi, jia);
endmodule
可以用Verilog自带的buf(output out, input in)
来做模拟。
也可以这样模