流水线的可视化表示 多条指令执行多个时钟周期 指令按程序序从上到下排列 图中展示了每一时钟周期资源的使用情况 不同指令相邻阶段之间没有干扰 Time(in cycles); CC1+CC2+CC3+CC4+CC5+CC6+CC7+CC8-+ Wr6,8(r5) MH距 HReg! ALUH: nDMA: HReg add r9 r8, r7 Regl: PSALU H: HDMH: HRegl ori r4 r3. 7 IM HIARegu ALUH DMH HReg sub r5 r2 r3 IM H HReg! ALUH DMH HRegl sWr2,10(r3) IM H: HReg! ALUH HDM 中国科学技术大学 chapter 7
流水线的可视化表示 • 多条指令执行多个时钟周期 – 指令按程序序从上到下排列 – 图中展示了每一时钟周期资源的使用情况 – 不同指令相邻阶段之间没有干扰 中国科学技术大学 chapter03.7
03 19-review 编译技术与计算机体系结构设计 有利于编译器的SA: 》规整性、正交性、完整性 帮助编译器设计者了解各种代码序列的执行效率和代价,有助于 编译器的优化 》对于在编译时就已经可确定的量,提供能够将其变为常数的指令 寄存器分配是关键问题 》寄存器数目多有利于编译器的设计与实现 》提供至少16个通用寄存器和独立的浮点寄存器 保证所有的寻址方式可用于各种数据传送指令 最小指令集 ·MIPS指令集 2021/2/11 中国科学技术大学 8
03/19-review • 编译技术与计算机体系结构设计 – 有利于编译器的ISA: » 规整性、正交性、完整性 » 帮助编译器设计者了解各种代码序列的执行效率和代价,有助于 编译器的优化 » 对于在编译时就已经可确定的量,提供能够将其变为常数的指令 – 寄存器分配是关键问题 » 寄存器数目多有利于编译器的设计与实现 » 提供至少16个通用寄存器和独立的浮点寄存器 – 保证所有的寻址方式可用于各种数据传送指令 – 最小指令集 • MIPS指令集 2021/2/11 中国科学技术大学 8
03/19-review(MIPS) Use general purpose registers with a load-store architecture: YES Provide at least 16 general purpose registers plus separate floating- point registers: 31 GPR& 32 FPR Support basic addressing modes: displacement (with an address offset size of 12 to 16 bits), immediate(size 8 to 16 bits), and register deferred; YES: 16 bits for immediate, displacement (disp=0=> register deferred All addressing modes apply to all data transfer instructions YES Use fixed instruction encoding if interested in performance and use variable instruction encoding if interested in code size Fixed Support these data sizes and types: 8-bit, 16-bit, 32-bit integers and 32-bit and 64-bit IEEE 754 floating point numbers: YES Support these simple instructions, since they will dominate the num ber of instructions executed load store add subtract. move register-register, and, shift, com pare equal, compare not equal branch with a PC-relative address at least 8-bits long), jump, call, and return: YES 16b Avim fpr a minimalist instryg19t学E Chapter 2.9
2021/2/11 中国科学技术大学 Chapter2.9 03/19-review (MIPS) • Use general purpose registers with a load-store architecture: YES • Provide at least 16 general purpose registers plus separate floatingpoint registers: 31 GPR & 32 FPR • Support basic addressing modes: displacement (with an address offset size of 12 to 16 bits), immediate (size 8 to 16 bits), and register deferred; : YES: 16 bits for immediate, displacement (disp=0 => register deferred) • All addressing modes apply to all data transfer instructions : YES • Use fixed instruction encoding if interested in performance and use variable instruction encoding if interested in code size : Fixed • Support these data sizes and types: 8-bit, 16-bit, 32-bit integers and 32-bit and 64-bit IEEE 754 floating point numbers: YES • Support these simple instructions, since they will dominate the number of instructions executed: load, store, add, subtract, move register-register, and, shift, compare equal, compare not equal, branch (with a PC-relative address at least 8-bits long), jump, call, and return: YES, 16b • Aim for a minimalist instruction set: YES
03/19- review流水线技术要点 流水线技术并不能提高单个任务的执行效率,它可以 提高整个系统的吞吐率 ·流水线中的瓶颈——最慢的那一段 多个任务同时执行,但使用不同的资源 其潜在的加速比=流水线的级数 ·流水段所需时间不均衡将降低加速比 ·流水线存在装入时间和排空时间,使得加速比降低 ·由于存在相关问题,会导致流水线停顿 中国科学技术大学 chapter3.10
中国科学技术大学 chapter3.10 03/19-review 流水线技术要点 • 流水线技术并不能提高单个任务的执行效率,它可以 提高整个系统的吞吐率 • 流水线中的瓶颈——最慢的那一段 • 多个任务同时执行,但使用不同的资源 • 其潜在的加速比=流水线的级数 • 流水段所需时间不均衡将降低加速比 • 流水线存在装入时间和排空时间,使得加速比降低 • 由于存在相关问题,会导致流水线停顿
指令流时序 时序图展示: 每个时钟周期指令所使用的流水段情况 指令流在采用5段流水线执行模式的执行情况 Up to five instructions can be in the pipeline during the same cycle ALU instructions skip Instruction Level Parallelism (ILP) the MEM stage Store instructions 7, 8(r3) IF ID EX MEM/WB skip the WB stage Wwr6,8(r5) IF ID EX MEMI WB Or4,r3,7 IF ID EX WB sub r5. r2 r3 IF EX WB swr2,10(r3) IF ID EX MEM CC1 CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 Time 中国科学技术大学 chapter 3. 11
指令流时序 • 时序图展示: – 每个时钟周期指令所使用的流水段情况 • 指令流在采用5段流水线执行模式的执行情况 中国科学技术大学 chapter03.11