[Group 9] Give an example of structural hazard ans 1. 假設下列指令是在只有單一記憶體的 datapath 中執行 lw $5, 100($2) add $2, $7, $4 add $4, $2, $5 sw $5, 100($2)

Similar documents
Microsoft PowerPoint - CA_04 Chapter6 v ppt

untitled

第五章 重叠、流水和现代处理器技术

4. 每 组 学 生 将 写 有 习 语 和 含 义 的 两 组 卡 片 分 别 洗 牌, 将 顺 序 打 乱, 然 后 将 两 组 卡 片 反 面 朝 上 置 于 课 桌 上 5. 学 生 依 次 从 两 组 卡 片 中 各 抽 取 一 张, 展 示 给 小 组 成 员, 并 大 声 朗 读 卡

Chapter 6

Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt

1 CPU

<4D F736F F F696E74202D20312EB9FEB6FBB1F5B9A4D2B5B4F3D1A7D5E7C1BCA3BAC3E6CFF2D1D0BEBFC9FAB8B4CAD4B5C4BDE1B9B9BBAFC3E6CAD4BFBCBACBCCBDCBF7D3EBCAB5BCF92E BBCE6C8DDC4A3CABD5D>

K301Q-D VRT中英文说明书141009

高中英文科教師甄試心得

Microsoft Word - 第四組心得.doc

Chapter 6

Microsoft Word - Final Exam Review Packet.docx

Microsoft Word - TIP006SCH Uni-edit Writing Tip - Presentperfecttenseandpasttenseinyourintroduction readytopublish

2015 Chinese FL Written examination

1505.indd

穨japhkesch.PDF

2-7.FIT)

Microsoft Word - ChineseSATII .doc

Microsoft Word - 11月電子報1130.doc

Microsoft Word - 08_科普作品選讀示例一_ doc

天 主 教 輔 仁 大 學 社 會 學 系 學 士 論 文 小 別 勝 新 婚? 久 別 要 離 婚? 影 響 遠 距 家 庭 婚 姻 感 情 因 素 之 探 討 Separate marital relations are getting better or getting worse? -Exp

從詩歌的鑒賞談生命價值的建構

國立桃園高中96學年度新生始業輔導新生手冊目錄

, (), 15,,,,, 2,,,1000 2,,, 5, ;, 5,,3,,,4 2,,, :, , , ,

Windows XP


Microsoft PowerPoint - CH 04 Techniques of Circuit Analysis

國立中山大學學位論文典藏.PDF

廣州舊城區的保護和發展

2006中國文學研究範本檔

A Community Guide to Environmental Health


Microsoft Word - 新加坡手冊封面.docx

摘要

Microsoft PowerPoint - notes3-Simple-filled12

bbc_bond_is_back_worksheet.doc

85 2

Guide to Install SATA Hard Disks

The Development of Color Constancy and Calibration System

BC04 Module_antenna__ doc

中国人民大学商学院本科学年论文

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Microsoft Word - 09吳

VASP应用运行优化

99 學年度班群總介紹 第 370 期 班群總導 陳怡靜 G45 班群總導 陳怡靜(河馬) A 家 惠如 家浩 T 格 宜蓁 小 霖 怡 家 M 璇 均 蓁 雴 家 數學領域 珈玲 國燈 英領域 Kent

<4D F736F F D203338B4C12D42A448A4E5C3C0B34EC3FE2DAB65ABE1>

Microsoft Word - SupplyIT manual 3_cn_david.doc

地質調査研究報告/Bulletin of the Geological Survey of Japan

2/80 2

Untitled-3

Microsoft Word - 1- 封面

Microsoft Word - 口試本封面.doc

IP TCP/IP PC OS µclinux MPEG4 Blackfin DSP MPEG4 IP UDP Winsock I/O DirectShow Filter DirectShow MPEG4 µclinux TCP/IP IP COM, DirectShow I

C o n t e n t s Acceptance Allow Love Apologize Archangel Metatron Archangel Michael Ask for

(2002) Gartner Group Toelle and Tersine(1989) VMI (1998) (VMI,Vender-Managed Inventory) (2003) (VMI,Vender-Managed Inventory) VMI AHP VMI - 133


南華大學數位論文

<4D F736F F D C4EAC0EDB9A4C0E04142BCB6D4C4B6C1C5D0B6CFC0FDCCE2BEABD1A15F325F2E646F63>

Microsoft Word - 104蔡孟珍.doc

区 域 活 动 进 入 中 班 我 们 区 域 的 设 置 和 活 动 材 料 都 有 所 变 化, 同 时 也 吸 引 孩 子 们 积 极 的 参 与 学 习 操 作 区 的 新 材 料 他 们 最 喜 欢, 孩 子 们 用 立 方 块 进 行 推 理 操 作 用 扑 克 牌 进 行 接 龙 游

States and capital package

國 史 館 館 刊 第 23 期 Chiang Ching-kuo s Educational Innovation in Southern Jiangxi and Its Effects ( ) Abstract Wen-yuan Chu * Chiang Ching-kuo wa


(Microsoft Word - 10\246~\253\327\262\304\244@\264\301\256\325\260T_Version4)

本科毕业设计(论文)工作细则&撰写规范

9330.doc

LSC操作说明

论成都报业群体的生存环境与体制创新

3戴文鋒-人文.indd

~ ~ ~

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

穨6街舞對抗中正紀念堂_林伯勳張金鶚_.PDF

LOVE IS OVER LOVE LOVE LOVE LOVE IS EVERYTHING LOVE LOVE LOVE LOVER'S QUEEN LYDIA MAYBE TOMORROW MEN'S TALK MY DEAR MY FRIEND MY OH MY MY SUMMER DREAM

1

東吳大學

Microsoft Word - Newsletter July 2007.doc

CANVIO_AEROCAST_CS_EN.indd

Microsoft Word - template.doc

Introduction to Hamilton-Jacobi Equations and Periodic Homogenization

星河33期.FIT)

可 愛 的 動 物 小 五 雷 雅 理 第 一 次 小 六 甲 黃 駿 朗 今 年 暑 假 發 生 了 一 件 令 人 非 常 難 忘 的 事 情, 我 第 一 次 參 加 宿 營, 離 開 父 母, 自 己 照 顧 自 己, 出 發 前, 我 的 心 情 十 分 緊 張 當 到 達 目 的 地 後

4.阿的故事地圖-林曉萍.doc


hks298cover&back

TWGHs S



els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8

ch_code_infoaccess

國立中山大學學位論文典藏.PDF

2 话 题 2014 中 国 高 教 十 大 头 条 2015 年 脚 步 渐 进, 新 的 篇 章 即 将 开 启 回 望 2014 年, 中 国 高 教 改 革 进 一 步 深 化, 高 考 改 革 信 息 公 开 师 德 建 设 等 将 被 浓 墨 重 彩, 写 入 中 国 教 育 史 册 在

投影片 1

Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies to all d

: : : : : ISBN / C53:H : 19.50

豐佳燕.PDF

附件1-1

202 The Sending Back of The Japanese People in Taiwan in The Beginning Years After the World War II Abstract Su-ying Ou* In August 1945, Japan lost th

2017 CCAFL Chinese in Context

Transcription:

Computer Architecture Fall, 2017 Week 13 2017.12.04 [Group 11] 1. 請詳述為何在 MIPS 中不會發生 WAR 與 WAW 這兩種 Hazards ANS: Use simple, fixed designs WAR: 因為 Write 是第五個 Stage,Read 是第二個 Stage, 因此 Write 永遠在 Read 後面, 故不會發生 WAR WAW: 因為 Write 是第五個 Stage, 故後面的 instruction 一定會在後面才會 Write, 故不會發生 WAW [Group 1] 2. To increase the speed of memory access in pipelining, we make use of a) Special memory locations b) Special purpose registers c) Cache d) Buffers ans:(c) Simplest scheme to handle branches is to a) Flush pipeline b) Freezing pipeline c)depth of pipeline d)both a and b ans:(d)

[Group 9] 3. 1. Give an example of structural hazard ans 1. 假設下列指令是在只有單一記憶體的 datapath 中執行 lw $5, 100($2) add $2, $7, $4 add $4, $2, $5 sw $5, 100($2) 在第 4 個 CLK 時 lw 跟 sw 同時對同一個記憶體進行存取, 此時發生 structural hazard [Group 2] 4. Q2: 在什麼情況下要用 stalling 來解決 hazard 而不能用 forwarding? A: 當一個 instruction 進入到 EX stage 準備進行 ALU 計算, 但 register 還沒辦法讀到 正確的值, 也就是前一個 instruction 尚未進行 write back 的程序, 這時要使用 stalling 的方式, 在在 IF/ID stage 中 insert NOP [Group 3] 5. 1. Forwarding 是其中一種解決 data hazard 的方式, 請試著描述 Forwarding 這 個方式判斷 data hazard 的條件 Ans: 1. Rs 或 rt 的 register number 和前兩個 instruction 的 destination 相同 EX/MEM.RegisterRd=ID/EX.RegisterRs EX/MEM.RegisterRd=ID/EX.RegisterRt MEM/WB.RegisterRd=ID/EX.RegisterRs MEM/WB.RegisterRd=ID/EX.RegisterRt 2. Two optimization

write instruction 才要 forward check if RegWrite is asserted Destination register 不為 $0 $0 永遠 =0 [Group 6] 6. Q: 在上周的課程中, 當遇到 data hazard 時, 我們插入 nop, 等待正確的資料 為何在 R-type 的 data hazard 時, 利用 forwarding, 可以不用等待 ( 不用插入 nop)? A: 在第三個 cycle 就已經有運算的結果了, 會產生 data hazard 是因為我們直到第 五個 cycle 才把結果寫回 register Forwarding 這個方法直接將運算出來的結果, 當作下一次運算的輸入, 這樣就 不需要等待了 [Group 4] 7. The following sequence of MIPS instructions include a data dependency. Can the hazard be resolved by forwarding? Why? lw $t0, 0($t1) add $t2, $t0, $t1 Ans. It cannot be resolved by forwarding. The value lw writes to its destination register is not available for

forwarding until the lw instruction reaches the end of the MEM stage. By then, the add instruction has reached the end of the EX stage, and so forwarding is no longer possible. [Group 4] 8. The following are some statements about hazards, indicate if they are True or False. Justify your answer if they are False. a. The most efficient way to solve hazards is stalling the pipeline. b. A compiler can solve all hazards without needing to insert NOPs. c. Performance is hurt a lot if hazards are solved by stalling the pipeline. d. All hazards can be solved forwarding data between stages. Ans. a. F. Stalling the pipeline is a bad solution, since it hurts performance a lot. b. F. A compiler cannot solve all hazards by inserting NOPs, since sometimes it cannot find enough independent instructions to put between dependent ones. c. T. d. Not all hazards can be solved by forwarding data. If the value hasn t been computed yet forwarding is not an option. [Group 13] 9. Consider a 5-stage pipeline like MIPS. The finish time of branch instructions can be moved early from MEM to ID. What are the costs behind that? Is it possible, to move earlier to the IF stage? Ans: 需要增加額外硬體 (XOR array) 於 ID stage 來比較兩個暫存器是否相等 不可能將 branch 完成時間移至 IF stage 因為此時尚無法擷取出暫存器內

容來進行比較 [Group 5] 10. Q2: Ans) Which instruction pairs will cause the data hazard? sub $2,$1,$3 add $12,$2,$5 or $13,$6,$2 and $14,$2,$2 sw $15,100($2) Sub instruction & add instruction Sub instruction & or instruction. [Group 7] 11. 1 參考附圖, 寫出 forwarding 時 mux 所需的值 A: B: Ans: A:10 B:00 A: 10, B:01

[Group 9] 12. 2. Identify all of the data dependencies in the following code. Show which dependencies are data hazards? add $2, $5, $4 add $4, $2, $5 sw $5, 100($2) add $3, $2, $4 ans 2. data dependency data hazard $2 (1,2) (1,3) (1,4) (1,2) (1,3) $4 (2,4) (2,4) [Group 14]

13. Q 以下 instruction 是否發生 hazards, 請解釋如何發生 並說明用何種方式處理此 hazards Str1 : lw $8 2($1) Str2 : and $4 $8 $2 Str3 : or $2 $2 $8 A load-use hazard 由於 str1 $8 要到 memory access stage 才能得到 $8, 而 str2 $8 會於 instruction decode stage read $8 所以會發在 data hazard (RAW) Waiting : Inserting Bubbles (NOP) [Group 12] 14. Which conditions below are data hazard (and we need forwarding)? (a)ex/mem.regwrite and (EX/MEM.RegRd=$0) and (EX/MEM.RegRd=ID/EX.RegRs) (b)mem/wb.regwrite and (MEM/WB.RegRd $0) and (MEM/WB.RegRt=ID/EX.RegRs) (c)ex/mem.regwrite and (EX/MEM.RegRd $0) and (EX/MEM.RegRd=ID/EX.RegRs) (d)mem/wb.regwrite and (MEM/WB.RegRd $0) and (MEM/WB.RegRd=ID/EX.RegRs) Ans: (c) (d)