IS CS-2021W-02

题目来源Problem 2 日期:2024-07-24 题目主题:CS-数字电路-逻辑门设计与加法器

解题思路

这些题目涉及数字电路设计,使用基本的逻辑门(NAND、NOR、NOT)和组合逻辑模块(如全加器和触发器)来构建复杂的电路。

Solution

Question 1: Design and depict a circuit equivalent to XOR (exclusive OR) gate by using at most five 2-input NAND gates

The XOR gate can be constructed using NAND gates as follows:

  1. Let and be the two inputs.
  2. Create the expressions for and using NAND gates.
  3. Combine these intermediate results to achieve the XOR function.

Steps:

  • which is
  • which is
  • which is
  • which is
  • which is

The circuit can be depicted as:

A -----|N1|----\
                \
                |N4|--\
                /      \
B -----|N2|----/        \
                        |N5|-------XOR
A -------------\        /
				\      /
			    |N3|--/
	            /
B -------------/

Question 2: Design and depict a 1-bit full-adder by using only two 2-input XOR gates and three 2-input NAND gates

A 1-bit full-adder has three inputs: , , and , and two outputs: (sum) and (carry out).

Using XOR and NAND gates:

  • which is
  • which is
  • which is
  • which is
  • which is

Question 3: Design and depict a 4-bit adder circuit by using four 1-bit full-adders

A 4-bit adder can be created by chaining four 1-bit full-adders. The carry-out from each adder becomes the carry-in for the next adder.

For each 1-bit full-adder:

  • Inputs: , ,
  • Outputs: ,

The critical path is the longest delay path through the adders, which goes through all carry-out to carry-in connections.

Question 4: Design and depict a 4-bit clock-synchronous up-down binary counter circuit

让我们定义以下符号:

  • : 第 n 个 D 触发器存储的值(对应于
  • : 控制输入(1 表示加法,0 表示减法)
  • , : 第 i 个全加器的两个输入
  • : 第 i 个全加器的和输出
  • : 第 i 个全加器的进位输入
  • : 第 i 个全加器的进位输出

现在,我们可以用表达式来表示这些元件之间的关系:

  1. D 触发器:

这表示在下一个时钟周期,D 触发器将存储当前全加器的输出。

  1. 全加器输入:

第一个输入来自当前的 D 触发器值,第二个输入是控制信号 X。

  1. 全加器输出:

这是标准的全加器逻辑表达式。

  1. 进位连接:

最低位的进位输入来自最高位的进位输出,其他位的进位输入来自前一位的进位输出。

  1. 减法操作: 当 时,我们需要执行减法。这可以通过将 取反并设置 来实现:
  1. 输出:

输出直接来自 D 触发器的存储值。

综合起来,我们可以得到每一位的完整表达式:

其中, 由前一级的 决定,除了最低位:

知识点

逻辑电路布尔代数加法器D触发器

解题技巧和信息

  • 使用 NAND 门实现基本逻辑功能
  • 将全加器串联实现多位加法器
  • 设计同步计数器时注意正负边缘触发逻辑

重点词汇

exclusive OR 异或

full-adder 全加器

counter 计数器

clock-synchronous 时钟同步

up-down binary counter 二进制上下计数器

参考资料

  1. Digital Design and Computer Architecture by David Harris and Sarah Harris - Chap. 3, 5
  2. Fundamentals of Digital Logic with VHDL Design by Stephen Brown and Zvonko Vranesic - Chap. 4