一、组合逻辑电路
-
基本门
-
电线wire
实现以下电路:

module top_module (
input in,
output out);
assign out = in;
endmodule //PASS!!!
-
GND
实现以下电路:

module top_module (
output out);
assign out = 1'b0;
endmodule
-
NOR或非门
实现以下电路:

module top_module (
input in1,
input in2,
output out);
assign out = ~(in1|in2);
endmodule
-
Another gate
实现以下电路:

module top_module (
input in1,
input in2,
output out);
assign out = in1&(~in2);
endmodule
-
两个逻辑门级联
实现以下电路:

module top_module (
input in1,
input in2,
input in3,
output out);
assign out = in3^(~(in1^in2));
endmodule //PASS!!!
-
More logic gates
好吧,我们试着同时建造几个逻辑门。构建具有两个输入的组合电路,a和b.
有7个输出,每个输出都有一个逻辑门驱动:
out_and: a和b
out_or: a还是b
out_xor: a xor b
out_nand: a nand b
out_nor: a或非b
out_xnor: a xnor b
out_anotb: a和-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);
assign out_nor = ~(a|b);
assign out_xnor =~(a^b);
assign out_anotb = a&(~b);
endmodule //PASS!!!
-
7420芯片
7400系列集成电路是一系列数字芯片,每个芯片都有几个门。7420是一个带有两个4输入与非门的芯片。
创建一个功能与7420芯片相同的模块。它有8个输入和2个输出。
提示:您需要用一个值驱动两个信号 ( 和 )。
p1y
p2y

module top_module (
input p1a, p1b, p1c, p1d,
output p1y,
input p2a, p2b, p2c, p2d,
output p2y );
assign p1y = ~(p1a&p1b&p1c&p1d);
assign p2y = ~(p2a&p2b&p2c&p2d);
endmodule //pass!!!
-
真值表1
在前面的练习中,我们使用了简单的逻辑门和几个逻辑门的组合。这些电路是组合的电路。组合意味着电路的输出仅仅是其输入的函数(在数学意义上)。这意味着对于任何给定的输入值,只有一个可能的输出值。因此,描述一个组合函数的行为的一种方式是明确地列出对于每个可能的输入值,输出应该是什么。这是一个真值表。
对于N输入的布尔函数,有2N可能的输入组合。真值表的每一行都列出了一个输入组合,所以总是有2个N行。输出列显示了每个输入值的输出。
排 |
输入 |
输出 |
||
数字 |
x3 |
x2 |
x1 |
f |
0 |
0 |
0 |
0 |