计算机组成与体系结构2010年试卷B
计算机组成与体系结构2010年试卷B
看完这一章去写点东西,之后复习一下离散,大方向如此。
选择题
1. Which one of the following about one-address instruction is true?
选项:
A. One-address instruction has only one operand
B. One-address instruction may have one operand or two operands
C. One-address instruction has two operands, and the other operand is
provided implicitly
D. One-address instruction may have three operands, and the other two
operands are provided implicitly
答案:
C. One-address instruction has two operands, and the other
operand is provided implicitly
解释:
一地址指令(one-address
instruction)通常具有两个操作数,其中一个操作数由指令显式指定,另一个操作数通常是隐式的,例如累加器(Accumulator)。这是因为一地址指令通常要求操作数之一是固定的(如累加器)。因此,选项
C 是正确的。
2. CPU responses to the interrupt request______
选项:
A. after it completes its fetch cycle
B. after it completes its execution cycle
C. when the interrupt source issues the interrupt request
D. when the bus is not busy
答案:
B. after it completes its execution cycle
解释:
CPU 在响应中断请求之前会完成当前指令的执行周期。当中断请求被触发时,CPU
会首先完成当前指令的执行周期,然后保存现场并跳转到中断处理程序。所以选项
B 是正确的。
3. The advantage of carry-lookahead adder is______
选项:
A. Optimize the structure of the adder
B. Save hardware parts
C. Accelerate the generation of the carries
D. Augment the structure of the adder
答案:
C. Accelerate the generation of the carries
解释:
进位前瞻加法器(carry-lookahead
adder)最大的优点是能够加速进位的生成,它通过提前计算进位信号,减少了传统加法器在每一级进位传递时的延迟。因此,选项
C 是正确的。
4. In microprogram-controlled machines, the relationship between the machine instruction and the microinstruction is______
选项:
A. a machine instruction is executed by a microinstruction
B. a microinstruction is composed of several machine instructions
C. a machine instruction is interpreted by a microroutine composed of
microinstructions
D. a microroutine is executed by a machine instruction
答案:
C. a machine instruction is interpreted by a microroutine
composed of microinstructions
解释:
在微程序控制的计算机中,每条机器指令会通过微程序(microroutine)来解释,微程序由一系列微指令(microinstructions)组成。微程序控制的计算机通过执行一系列微指令来实现机器指令的操作。因此,选项
C 是正确的。
5. Once the DMA controller obtains access to the system bus, it transfers one byte of data and then returns the control of the system to the processor. This DMA transfer mode is_____.
选项:
A. Burst Mode
B. Block Mode
C. Cycle Stealing Mode
D. Transparent Mode
答案:
C. Cycle Stealing Mode
解释:
Cycle Stealing Mode 是指 DMA
控制器在每个处理器时钟周期中获取一次总线控制,并传输一字节数据,然后把总线控制权归还给处理器。每次传输一个字节,这就是所谓的“周期偷取”。所以选项
C 是正确的。
6. Assume that the capacity of a kind of SRAM chip is 16K×32, so the sum of address lines and data lines of this chip is______.
选项:
A. 48
B. 46
C. 36
D. 32
答案:
B. 46
解释:
SRAM 芯片的容量是 16K×32。
- 地址线数量:16K 表示 16384 的地址,需要 $ _2(16384) = 14 $
位地址线。
- 数据线数量:32 位数据,所以需要 32 根数据线。
因此,总的地址线和数据线数量为 14(地址线)+ 32(数据线)= 46 根线。所以,选项 A 是正确的。
7. Assume that the multiplicand is 110011 and the multiplier is 101110. If multiply them using the Booth algorithm, then the Booth recoding multiplier is______.
选项:
A. – 1 – 1 0 0 – 1 0
B. + 1 – 1 0 0 + 1 0
C. – 1 + 1 0 0 – 1 0
D. 1 + 1 0 0 – 1 0
答案:
C. – 1 + 1 0 0 – 1 0
8. The microroutines for all instructions in the instruction set of a computer are stored in the______
选项:
A. memory controller
B. main memory
C. control store
D. cache
答案:
C. control store
解释:
控制存储器(control store)
存储的是微程序,它包含了计算机指令集的所有微指令。微程序是由微指令组成的,用于实现每条机器指令的操作。微指令的执行是计算机实现机器指令操作的关键,因此微程序存储在控制存储器中。选项
C 是正确的。
9. ______ is the process by which the next device to become the bus master is selected and bus mastership is transferred to it.
选项:
A. Bus protocol
B. Bus timing
C. Bus arbitration
D. Bus transceiver
答案:
C. Bus arbitration
解释:
总线仲裁(Bus arbitration)
是指选择下一个设备作为总线主控设备的过程,确保在多个设备请求总线时,能够顺利地决定哪一个设备获取总线控制权。总线仲裁负责在多个设备之间协调总线访问的顺序,因此选项
C 是正确的。
10. _____ has/have external fragmentation problem.
选项:
A. Paging
B. Segmentation with paging
C. Segmentation
D. Segmentation and segmentation with paging
答案:
C. Segmentation
解释:
分段(Segmentation)
存在外部碎片问题,因为它将程序分成不同的段,而这些段的大小可能不相同。随着时间的推移,系统可能无法有效地分配内存块,因为这些块之间可能存在碎片。而
分页(Paging) 和 分页分段(Segmentation with
paging)
都不容易出现外部碎片问题,因为它们将内存分成固定大小的页或块。因此,选项
C 是正确的。
11. The range and accuracy of floating-point numbers depend on______ respectively.
选项:
A. The size of exponent and the representation of mantissa
B. The size of exponent and the size of mantissa
C. The size of mantissa and the representation of exponent
D. The size of mantissa and the size of exponent
答案:
B. The size of exponent and the size of mantissa
解释:
浮点数的范围和精度分别依赖于 指数的大小 和
尾数的大小。
- 指数的大小
决定了浮点数的范围,可以表示更大或更小的数。
- 尾数的大小
决定了浮点数的精度,表示数值的小数部分的精度。
因此,选项 B 是正确的。
12. In a synchronous bus, controlling of data transfer on the bus is based on ______.
选项:
A. a common clock signal only
B. a handshake signal only
C. both clock signal and handshake signal
D. either clock signal or handshake signal
答案:
A. a common clock signal only
解释:
同步总线(Synchronous bus)
中,数据传输的控制是基于一个公共时钟信号的。所有的设备都根据时钟信号的节奏进行数据传输,而不需要额外的握手信号。因此,选项
A 是正确的。
13. Which one of the following is not used to prevent data hazards? _______
选项:
A. Bypassing
B. Forwarding
C. Stall
D. Freeze or Flush
答案:
D. Freeze or Flush
解释:
数据危害(Data hazards)
是指由于指令执行的顺序问题,导致数据依赖性问题。为了避免数据危害,通常采用以下策略:
- Bypassing(旁路) 和
Forwarding(转发)
是常用的技术,它们通过直接将数据从一个流水线阶段传递到下一个阶段来减少数据依赖的影响,从而避免数据危害。
- Stall(暂停) 是通过暂停流水线中的某个阶段,等待数据准备好,从而避免数据危害。
然而,Freeze 或 Flush 通常用于处理控制危害(例如分支指令带来的问题),而不是用来解决数据危害。因此,选项 D 是正确的答案。
简答题
1. What is the difference between DRAM and SRAM, in terms of characteristics such as speed, size, cost and application?
答案:
DRAM (Dynamic RAM) 与 SRAM (Static RAM)
的区别主要体现在以下几个方面:
- 速度 (Speed):
- DRAM 的访问速度较慢,因为它需要周期性地刷新数据来维持存储的内容。
- SRAM 的访问速度较快,不需要刷新,因此能提供更快的读取和写入速度。
- 大小 (Size):
- DRAM 的密度较高,可以在较小的物理空间内存储更多的数据。每个存储单元仅需一个电容和一个晶体管,因此单个 DRAM 单元的大小较小。
- SRAM 的密度较低,每个存储单元需要多个晶体管,因此 SRAM 占用更多的空间来存储相同的数据量。
- 成本 (Cost):
- DRAM 成本较低,因为它使用的电路较简单,制造成本较低。
- SRAM 成本较高,因为每个存储单元需要多个晶体管,且制造过程更加复杂。
- 应用 (Application):
- DRAM 常用于主内存(如计算机内存),因为它具有较大的存储容量且成本较低。
- SRAM 常用于高速缓存(如 CPU 的 L1, L2 缓存),因为它具有较高的速度,适合需要快速存取的应用场景。
总结:
- DRAM:速度较慢,存储密度高,成本低,广泛用于主内存。
- SRAM:速度较快,存储密度低,成本高,广泛用于高速缓存。
2. In what circumstance will arithmetic overflow occur when two integers represented by 2's complement form are added? And write out the logic expression to detect overflow.
答案:
算术溢出(Arithmetic Overflow)
是指在执行加法时,由于结果超出了计算机能够表示的范围,导致结果失真或错误。
2 的补码表示下的溢出条件:
- 加法溢出 发生在两种情况:
- 两个正数相加 得到一个负数(即结果超出了正数的最大表示范围)。
- 两个负数相加 得到一个正数(即结果超出了负数的最大表示范围)。
逻辑表达式:
要检测加法操作中的溢出,可以通过以下逻辑表达式来判断:
- 溢出条件:
(A[n-1] == B[n-1]) && (S[n-1] != A[n-1])
- 其中
A[n-1]
和B[n-1]
分别是操作数 A 和 B 的符号位,S[n-1]
是结果 S 的符号位。 - 如果操作数 A 和 B 的符号位相同,而结果的符号位不同,就表示发生了溢出。
- 其中
解释:
- 如果 A 和 B 都是正数,且 S 是负数,则说明加法结果溢出。
- 如果 A 和 B 都是负数,且 S 是正数,则说明加法结果溢出。
- 所以,溢出发生的条件是,两个操作数的符号位相同,而结果的符号位与它们不同。
总结:
- 溢出发生在加法中,当两个操作数符号相同,而结果符号不同。
- 检测溢出的逻辑表达式为
(A[n-1] == B[n-1]) && (S[n-1] != A[n-1])
。
总结:
- DRAM 和 SRAM 的区别:
- DRAM:速度较慢,存储密度高,成本低,适用于主内存。
- SRAM:速度较快,存储密度低,成本高,适用于高速缓存。
- 加法溢出发生的条件:
- 在 2
的补码加法中,溢出发生在两个正数相加结果为负,或者两个负数相加结果为正。
- 溢出检测表达式为
(A[n-1] == B[n-1]) && (S[n-1] != A[n-1])
。
- 在 2
的补码加法中,溢出发生在两个正数相加结果为负,或者两个负数相加结果为正。
3. Describe the process of interrupt processing.
答案:
中断处理的过程通常包括以下几个步骤:
中断请求(Interrupt Request):
当外部设备或内部事件需要处理时,会向CPU发送中断请求信号。中断请求可能来自硬件(如I/O设备完成任务或定时器超时)或软件(如系统调用或异常)。中断响应(Interrupt Acknowledgement):
CPU检测到中断请求后,首先确认是否响应中断。如果响应,CPU会向中断源发送中断确认信号(interrupt acknowledge),表示它准备处理中断。保存现场(Context Saving):
CPU将当前执行的程序状态保存到堆栈或专门的寄存器中。这通常包括程序计数器(PC)、状态寄存器、一般寄存器的内容等,以便中断处理完后能够恢复到中断前的状态,继续执行被中断的任务。中断向量查找(Interrupt Vector Lookup):
CPU根据中断类型查找中断向量表(interrupt vector table),该表存储了与不同中断类型对应的中断服务程序的地址。通过查找中断向量表,CPU获得相应的中断服务程序(ISR)的地址。执行中断服务程序(ISR Execution):
CPU跳转到相应的中断服务程序(ISR),开始执行针对当前中断的处理逻辑。ISR的任务通常是处理特定的硬件或软件事件(如读取数据、处理错误、响应用户输入等)。恢复现场(Context Restoration):
中断服务程序执行完后,CPU会从堆栈或保存的寄存器中恢复之前保存的程序状态。这包括恢复程序计数器、状态寄存器和其他寄存器的值,确保程序能够从中断发生之前的地方继续执行。中断返回(Return from Interrupt):
最后,CPU通过执行“中断返回”指令(如IRET
或RTI
)退出中断服务程序,恢复到正常的执行流程。
总结: 中断处理的基本过程包括:中断请求、响应、保存当前状态、查找中断服务程序、执行中断服务程序、恢复执行状态以及返回中断前的程序执行。通过这些步骤,CPU能够高效地处理各种外部和内部事件,而不会影响正在运行的其他任务。