跳转至

计算机组成原理 第一章作业

教材:计算机组成原理:软硬件接口 第 5 版 (mips 版) 时间:2019/09/08

Exercise 1.2

  1. a: "Assembly lines in automobile manufacturing" -> "Performance via Pipelining"
  2. b: "Suspension bridge cables" -> “Dependability via Redundancy”
  3. c: "Aircraft and marine navigation systems that incorporate wind information" -> “Performance via Prediction”
  4. d: "Express elevators in buildings" -> “Performance via Parallelism”
  5. e: "Library reserve desk" -> “Hierarchy of Memories”
  6. f: "Increasing the gate area on a CMOS transistor to decrease its switching time" -> “Make the Common Case Fast”
  7. g: "Adding electromagnetic aircraft catapults (which are electrically-powered as opposed to current steam-powered models), allowed by the increased power generation off ered by the new reactor technology" -> “Design for Moore’s Law”
  8. h: "Building self-driving cars whose control systems partially rely on existing sensor systems already installed into the base veh icle, such as lane departure systems and smart cruise control systems" -> “Use Abstraction to Simplify Design”

Exercise 1.3

以 C 语言为例:     编译     汇编      链接 $ 源代码 \Longrightarrow 汇编语言 \Longrightarrow 目标代码 \Longrightarrow 机器代码$

  • 编译:通过编译器,读取源程序(字符流),对之进行词法和语法的分析,将高级语言指令转换为功能等效的汇编代码的过程。
  • 汇编:通过汇编器将汇编语言代码翻译成目标机器指令的过程。
  • 链接:将有关的目标文件彼此相连接,也即将在一个文件中引用的符号同该符号在另外一个文件中的定义连接起来,使得所有的这些目标文件成为一个能够被操作系统装入执行的统一整体。

Exercise 1.4

a) $ frame size = 1280 \times 1024 \times 3 \times 8bit = 3.75MB $ b) $ time = \frac{ 1280 \times 1024 \times 3 \times 8bit }{100 \times 10^{6} bit} \approx 0.31s $

Exercise 1.5

1.5.1

\(I\)为指令数,\(t\)为 cpu 执行时间,\(f\)为时钟频率,则: $$ I = \frac{t \cdot f}{CPI} $$ $ I_{p1} = {1 \times 3 \over 1.5} = 2G 条$ $ I_{p2} = {1 \times 2.5 \over 1} = 2.5G 条$ $ I_{p3} = {1 \times 4 \over 2.2} \approx 1.82G 条$

1.5.2

设$ C $为时钟数,则:

$ C_{p1} = 10 \times 3 = 30G $ $ I_{p1} = {30 \over 1.5} = 20G $

$ C_{p2} = 10 \times 2.5 = 25G $ $ I_{p2} = {25 \over 1} = 25G $

$ C_{p3} = 10 \times 4 = 40G $ $ I_{p3} = {40 \over 2.2} \approx 18.2G $

1.5.3

(1) $ t = \frac{I \cdot CPI}{f} $ (2) $ (1-0.3)t = \frac{I \cdot (1+0.2)CPI}{f'} $

$ 由\frac{(1)}{(2)} \Rightarrow \frac{clock rate'}{clock rate} = {(1+0.2) \over (1-0.3)} = 1.71$

Exercise 1.6

1.6.1

令$ p_i $为一条指令占总指令的比例,则对于平均 CPI,有: $$ \overline {CPI} = \sum_{i=1}^nCPI_i \cdot p_i $$ 对于 P1:$ \overline {CPI} = 0.1\times 1 + 0.2\times 2 + 0.5\times 3 + 0.2\times 3 = 2.5 $ 对于 P2:$ \overline {CPI} = 2 $

1.6.2

对于 P1,时钟数:$ C = \frac{1.0 \times 10^6}{2.5} = 4\times 10^5 $ 对于 P2,时钟数:$ C = \frac{1.0 \times 10^6}{2} = 5\times 10^5 $

Exercise 1.7

a)

设$ T \(为时钟周期,\) t \(为程序执行时间,\) I $为指令数,则: $$ CPI = \frac{t}{I \cdot T} $$ $ \overline {CPI_A} = \frac{1.1s}{1.0 \times 10^9 \times 1 ns} = 1.1$ $ \overline {CPI_B} = \frac{1.5s}{1.2 \times 10^9 \times 1 ns} = 1.25$

b)

设$ f = \frac{1}{T} $,利用上述公式,得: $$ \frac{CPI_A}{CPI_B} = \frac{I_B \cdot T_{PB}}{I_A \cdot T_{PA}}\ \Rightarrow \frac{1.1}{1.25} = \frac{1.2 f_{PA}}{1.0 f_{PB}}\ \Rightarrow \frac{f_{PA}}{f_{PB}} = 0.733 $$ 答:处理器 A 的时钟频率为处理器 B 的 0.733 倍

c)

仍假设 cpu 时钟周期为 1ns,$ t_{new} = 6.0 \times 10^8 \times 1.1 \times 1ns = 0.66s $

对于 A: $ 加速比 = (1.1 - 0.66)/1.1 = 40\% $ 对于 B:$ 加速比 = (1.5 - 0.66)/1.5 = 29.3\% $

Exercise 1.8

1.8.1

设 P 为功耗,C 为负载电容,V 为电压,f 为开关频率,动态功耗公式: $$ P = C \cdot U^2 \cdot f $$ $ C_{Pentium 4} = \frac{90}{1.25^2 \times 3.6 \times 10^6} = 16 \mu F$ $ C_{Core i5} = \frac{40}{0.9^2 \times 3.4 \times 10^6} \approx 14.5 \mu F$

1.8.2

$ 设 p1 为静态功耗占总功耗的比例,p2 为静态功耗相对于动态功耗的比例。 $

$ Pentium 4: p1 = 10/100 = 10\%, p2 = 10/90 = 11.1\%$ $ Core i5: p1 = 30/70 = 42.9\%, p2 = 30/40 = 75\%$

1.8.3

\[ P_总 = P_动 + P_静 = C \cdot U^2 \cdot f + I \cdot U$$ $ 因为 I 不变,设变化后的电压为 U',t = \frac{U'}{U},则: $ $$ P_总' = P_动 \cdot \left( \frac{U'}{U} \right)^2 + P_静 \cdot \left( \frac{U'}{U} \right) \\ \Rightarrow P_总' = P_动 \cdot t^2 + P_静 \cdot t \]

对于 P4: $ 90 = 90t^2 + 10t \Rightarrow t \approx 0.946 $ 对于 i5: $ 63 = 40t^2 + 30t \Rightarrow t \approx 0.935$ 答:对于 P4,电压降为原来的$ 94.6\% \(,对于 i5,电压降为原来的\) 93.5\% $