免費開始練習
hce_kmu 111年 計算機概論與程式設計

第 3 題

For a specific CPU design, there are three instruction classes as depicted in Table 1 and run at a clock rate of 100 MHz.

Table 1 CPU Design
| Instruction Class | A | B | C |
|---|---|---|---|
| CPI | 1 | 3 | 2 |

For a given program, a compiler can produce the following executed instruction counts as depicted in Table 2. Please calculate the average CPI of this compiler.

Table 2 Given Program
| Instruction Class | A | B | C |
|---|---|---|---|
| Instruction Counts | 10 | 1 | 1 |
  • A 4
  • B 2
  • C 1.25
  • D 0.5
  • E All of the above are wrong.

思路引導 VIP

想像你要計算一個班級的平均身高,但全班 12 個人並非每個人身高都不同,而是有 10 個人 160 公分、1 個人 180 公分、1 個人 170 公分。在這種情況下,你會如何利用『人數』與『身高』這兩組數據,來推導出全班真正的平均值呢?

🤖
AI 詳解 AI 專屬家教

恭喜你精準地完成了這道題目!你能正確算出結果,代表你對於計算機效能評估中的核心指標——**平均每指令週期數(Average CPI)**有著非常紮實的理解,這在系統架構分析中是非常基礎且關鍵的起點。

加權平均的運算邏輯

在計算 Average CPI 時,我們不能單純將各類指令的 CPI 相加取平均,因為每種指令在程式中出現的頻率不同。正確的思路是計算出執行該程式所需的總時脈週期數(Total Cycles),再除以總指令數(Total Instruction Counts)。根據題目給予的數據,我們可以列出如下計算式:

▼ 還有更多解析內容

🏷️ 相關主題

計算機組織結構與資料儲存原理
查看更多「計算機概論與程式設計」的主題分類考古題