提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
前言
在前面的练习中,我们使用了简单的逻辑门和几个逻辑门的组合。这些电路是组合电路的例子。组合意味着电路的输出是其输入的函数(在数学意义上)。这意味着对于任何给定的输入值,只有一个可能的输出值。因此,描述组合函数行为的一种方法是显式列出输入的每个可能值的输出。这是真值表。

对于一个有N个输入的布尔函数,有2^N
种可能的输入组合。真值表的每一行列出一个输入组合,所以总有(2^N)行。输出列显示了每个输入值的输出。上面的真值表适用于三输入一输出的函数。对于8种可能的输入组合,每一种都有8行,还有一个输出列。有四种输入组合,其中输出为1,还有四种输出为0。
一、Basic Gates
1.wire
Practice:Implement the following circuit:
翻译:实现如图的电路

Solution(不唯一,仅供参考):
module top_module (
input in,
output out);
assign out = in;
endmodule
2.GND
Practice:Implement the following circuit:
翻译:实现以下电路

Solution(不唯一,仅供参考):
module top_module (
output out);
assign out = 1'b0;
endmodule
3.NOR
Practice:Implement the following circuit:
翻译:实现以下电路

Solution(不唯一,仅供参考):
module top_module (
input in1,
input in2,
output out);
assign out = ~(in1 | in2);
endmodule
4.Another gate
Practice:Implement the following circuit:
翻译:实现以下电路

Solution(不唯一,仅供参考):
module top_module (
input in1,
input in2,
output out);
assign out = in1&(~in2);
endmodule
5.Two gates
Practice:Implement the following circuit:
翻译:实现以下电路

Solution(不唯一,仅供参考):
module top_module (
input in1,
input in2,
input in3,
output out);
assign out =(~(in1^in2))^in3;
endmodule
6.More logic gates
Practice:building several logic gates at the same time. Build a combinational circuit with two inputs, a and b.
翻译:构建几个逻辑门

Solution(不唯一,仅供参考):
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
Timing Diagram

7.7420 chip
Practice:Create a module with the same functionality as the 7420 chip. It has 8 inputs and 2 outputs.
翻译:创建一个功能与7420芯片相同的模块。它有8个输入2个输出,如下图。

Solution(不唯一,仅供参考):
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
Timing Diagram

8.Truth tables
Practice:Create a combinational circuit that implements the above truth table.
翻译:创建一个实现上述真值表的组合电路。

Solution(不唯一,仅供参考):
使用generate语句(具体使用看总结)
module top_module(
input x3,
input x2,
input x1, // three inputs
output f // one output
);
always @(*)begin
case(

本文详细介绍了基本逻辑门(如NOR、AND、XOR等)的实现,真值表的应用,以及如何通过电路设计解决实际问题,如7420芯片功能模拟、电路组合和特定功能电路如计数器和逻辑判断。通过实例演示和逻辑关系理解,提升组合逻辑设计能力。
最低0.47元/天 解锁文章
250

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



