IS CS-2019S1-01

题目来源Problem 1 日期:2024-08-02 题目主题:CS-数字电路-加法器与乘法器设计

解题思路

这道题目涉及数字电路设计,主要考察加法器和乘法器的设计原理。我们需要从最基本的半加器和全加器开始,然后逐步构建更复杂的电路。解题过程中,我们需要注意以下几点:

  1. 理解半加器和全加器的原理及其逻辑门实现。
  2. 掌握多位加法器的设计方法,特别是如何并行处理以减少延迟。
  3. 理解乘法器的基本原理,以及如何利用加法器来构建乘法器。
  4. 注意题目对电路设计的特殊要求,如不允许加法器串联或最小化串联加法器的数量。

Solution

1. Half Adder and Full Adder Design

Half Adder

A half adder adds two single binary digits and . It has two outputs: sum () and carry ().

Logic equations:

  • (XOR)
  • (AND)

Since we can only use AND, OR, and NOT gates, we need to implement XOR using these basic gates:

Circuit design:

graph LR
    subgraph "Half Adder"
        subgraph INPUT_HA
            A_HA
            B_HA
        end
        subgraph OUTPUT_HA
            S_HA[Sum]
            C_HA[Carry]
        end
        A_HA & B_HA --> AND1[AND]
        A_HA & B_HA --> OR1[OR]
        AND1 --> NOT1[NOT]
        OR1 & NOT1 --> AND2[AND]
        AND2 --> S_HA
        AND1 --> C_HA
    end

Full Adder

A full adder adds three single binary digits , , and (previous carry). It has two outputs: sum () and carry ().

Logic equations:

Circuit design using half adders:

graph LR
    subgraph "Full Adder"
        subgraph INPUT_FA
            A_FA
            B_FA
            Cin_FA[Cin]
        end
        subgraph OUTPUT_FA
            S_FA[Sum]
            Cout_FA[Cout]
        end
        A_FA & B_FA --> HA1[Half Adder]
        HA1 --> S1[Sum] & C1[Carry]
        S1 & Cin_FA --> HA2[Half Adder]
        HA2 --> S_FA & C2[Carry]
        C1 & C2 --> OR[OR] --> Cout_FA
    end

2. Three 16-bit Integer Adder

Let’s denote the bits and FA as:

, ,

,

Design

  1. Main layer: For each bit position (0 to 15), use a 1-bit Full Adder (FA) to add , , and .

  2. Final steps:

Explanation

  1. This design uses only one layer of 1-bit full adders, which satisfies the requirement that no adders can be connected in series.
  2. For each bit position , we add , , and using a full adder. The sum output of this FA becomes , and the carry output becomes .
  3. The carry out from the most significant bit, MSB (i.e., from adding , , and ) becomes .
  4. We set and because there’s no overflow for the MSB and no carry-in for the least significant bit, LSB.

Correctness

This design correctly computes because:

  1. For each bit position, we’re adding all three input bits and producing two output bits (one for and one for ).
  2. The carry propagation is handled by using as the carry output for each FA, effectively shifting the carries one position to the left in .
  3. The most significant carry is correctly handled by setting .

This design satisfies all the problem constraints while providing an efficient solution using only 16 1-bit full adders. It doesn’t use any half adders in this case, as full adders are sufficient and more efficient for this particular problem.

3. Four 16-bit Integer Adder

Let’s denote the bits as:

, , ,

,

Design

  1. First stage: Use the solution from Problem 2 to add , , and . For each bit position (0 to 15): Set

    Now we have (16 bits) and (17 bits) such that

    Set

  2. Second stage: Add (16 bits) and (16 bits). For each bit position (0 to 15): (use ) Set

Explanation

  1. In the first stage, we use the solution from Problem 2 to add three 16-bit integers (, , ). This gives us a 17-bit integer and a 16-bit integer .
  2. In the second stage, we add the fourth 16-bit integer to the 16-bit integer . This addition can be done with a single layer of full adders, producing a 17-bit integer .
  3. We can directly use as without any further additions.

This design minimizes the maximum number of adders connected in series to just two layers.

4. 8-bit Integer Multiplier

Let’s denote the bits as:

,

Design

  1. Generate partial products: Use one-bit multipliers to compute for .

  2. Arrange partial products:

  3. Sum partial products: Use a tree of 1-bit FAs and HAs to sum these partial products. We can use a Wallace tree structure to minimize the depth of the circuit:

    • Layer 1: Group , , , and adding them with Four 16-bit Integer Adders in Problem 3. Same for , , , .
    • Layer 2: Take the four results (at most 17-bit integers) from Layer 1 and sum them using similar Four 17-bit Integer Adders in Problem 3.
  4. Final result: The two output integer from Four 17-bit Integer Adders.

This design efficiently computes the product using only the specified components (1-bit adders and multipliers) while minimizing the depth of the circuit.

知识点

数字电路加法器乘法器组合逻辑电路设计

难点思路

本题的难点主要在于如何在满足题目约束的情况下设计高效的电路。特别是在第 3 问中,需要巧妙地安排加法器以最小化串联加法器的数量,同时又要确保正确性。在第 4 问中,需要理解如何将乘法转化为加法运算,并且在设计中充分利用并行性来提高效率。

解题技巧和信息

  1. 在设计复杂电路时,先从基本构建块(如半加器和全加器)开始,然后逐步构建更复杂的电路。
  2. 利用并行设计来减少延迟和提高效率。例如,在三个 16 位整数加法器中,我们同时进行两组加法运算,而不是串行处理。
  3. 在设计多位加法器时,考虑使用树形结构来最小化加法器的串联数量。这在四个 16 位整数加法器的设计中尤为明显。
  4. 在乘法器设计中,将问题分解为部分积的生成和求和两个步骤。部分积的生成可以完全并行,而求和过程可以通过优化的加法器树来实现。
  5. 注意题目的特殊要求,如不允许加法器串联或最小化串联加法器的数量。这些要求通常会影响电路的整体架构。
  6. 在复杂的设计中,画出数据流图或框图可以帮助理清思路,确保所有的数据都被正确处理。

重点词汇

  • Half adder 半加器
  • Full adder 全加器
  • Carry 进位
  • Sum 和
  • Partial product 部分积
  • Multiplier 乘法器
  • Logic gate 逻辑门
  • AND gate 与门
  • OR gate 或门
  • NOT gate 非门
  • XOR gate 异或门
  • Combinational logic 组合逻辑
  • Parallel design 并行设计
  • Adder tree 加法器树
  • Bit-wise operation 按位操作

参考资料

  1. Digital Design by M. Morris Mano, Chapter 4: Combinational Logic
  2. Computer Organization and Design by David A. Patterson and John L. Hennessy, Chapter 3: Arithmetic for Computers
  3. Digital Integrated Circuits: A Design Perspective by Jan M. Rabaey, Chapter 7: Combinational Circuit Design
  4. CMOS VLSI Design: A Circuits and Systems Perspective by Neil H. E. Weste and David Harris, Chapter 10: Datapath Subsystems