复旦大学:《计算机原理 Computer System》习题PPT课件_chapter4 Processor Architecture

Chapter 4 Processor Architecture Guobao Jiang 11210240049@fudan.edu.cn
Chapter 4 Processor Architecture Guobao Jiang 11210240049@fudan.edu.cn

Outline 4.1 The y86 Instruction Set Architecture 4.2 Logic Design and the hcl 4.3 Sequential y86 Implementations 4. 4 General Principles of pipelining 4.5 Pipelined y86 Implementations 4.6 Summary 2021/10/29
Outline • 4.1 The Y86 Instruction Set Architecture • 4.2 Logic Design and the HCL • 4.3 Sequential Y86 Implementations • 4.4 General Principles of Pipelining • 4.5 Pipelined Y86 Implementations • 4.6 Summary 2021/10/29 2

Problem 4.1(P262 Determine the byte encoding of the y86 instruction sequence that follows posO×100# start at address o×100 irmovl $15, %ebx 0x100:30830F000000 rrmovl %ebx. %ecx Ox106:2031 oop. Ox108: rmmov%ecx,-3(%eb×)o×08:4013 FD FFFFFF add%‰ebx,‰ecx0×10E:6031 Jmp 0x110:7008010000 2021/10/29
Problem 4.1 (P262) • Determine the byte encoding of the Y86 instruction sequence that follows. .pos 0x100 #start at address 0x100 irmovl $15, %ebx rrmovl %ebx, %ecx loop: rmmovl %ecx, -3(%ebx) addl %ebx, %ecx jmp loop 2021/10/29 3 0x100: 30 83 0F 00 00 00 0x106: 20 31 0x108: 0x108: 40 13 FD FF FF FF 0x10E: 60 31 0x110: 70 08 01 00 00

Problem 4.2(P263) For each byte sequence listed, determine the y86 instruction sequence it encodes A.0x100:3083 FCFFFFFF40630008000010 0x100: 3083FCFFFFFF irmovl $s-r %ebx 0×106:406300080000 rmmov%esi,0x8000%eb× Ox10C:10 halt 2021/10/29
Problem 4.2 (P263) • For each byte sequence listed, determine the Y86 instruction sequence it encodes. • A. 0x100:3083FCFFFFFF40630008000010 2021/10/29 4 0x100: 3083FCFFFFFF irmovl $-r, %ebx 0x106: 406300080000 rmmovl %esi, 0x8000(%ebx) 0x10C: 10 halt

Problem 4.2+(P263) B.0x200:A068 80080200001030830A00000090 0x200:A068 pushl %esi 0×202:8008020000 call proc 0×207:10 halt 0x208: proc. 0×208:30830A000000 armon$10,%ebx 0x20E:90 ret 2021/10/29
Problem 4.2+ (P263) • B. 0x200:A0 68 80080200001030830A00000090 2021/10/29 5 0x200: A068 pushl %esi 0x202: 80 08020000 call proc 0x207: 10 halt 0x208: 3083 0A000000 irmovl $10, %ebx 0x20E: 90 ret 0x208: proc:

Problem 4.2+(P263) E Xercise ·C.0x3005054070000000FOB018 D.0×400:6113730004000010 ·E.0x500:6362A080 2021/10/29
Problem 4.2 +(P263) • Exercise • C. 0x300:5054070000000F0B018 • D. 0x400:6113730004000010 • E. 0x500:6362A080 2021/10/29 6

Problem 4.3(P269) Write y86 code to implement a recursive sum function rSum, based on the following c code: int rSum (int aston P178 Recursive Procedures if(count <= o return o return * Start+ rSum start+1, Count-1) 2021/10/29
Problem 4.3 (P269) • Write Y86 code to implement a recursive sum function rSum, based on the following C code: int rSum(int *Start, int Count) { if (Count <= 0) return 0; return *Start + rSum(Start+1, Count-1); } 2021/10/29 7 P178 Recursive Procedures

Problem 4.3+(P269) rSum: push1 %ebp rrmovl %ebx, %eax rrmovl %esp, %ebp add%ed×,%ea irmovl 20, %eax 66 su ea×,%esp pushl yeax US %ebx call rSum mrmovl 8(%ebp), %ebx mrmovI (%ebx, %edx mrmovl 12(%ebp),%eax ‰edx.%eax add!%ea×.%ea Jmp L39 L38 irmovl $-8, %edx add %edx, %es L38:xorl%ea×,%eax irmovl $-1, %edx L39: mrmovl-24(%ebp), %ebx add %edx eax rrmovI %ebp, %esp push/ hl eax Irmove|$4,‰edx popl %ebp ret 2021/10/29
Problem 4.3+ (P269) rSum: push1 %ebp rrmovl %esp, %ebp irmovl $20, %eax subl %eax, %esp pushl %ebx mrmovl 8(%ebp), %ebx mrmovl 12(%ebp), %eax addl %eax, %eax jle L38 irmovl $-8, %edx addl %edx, %esp irmovl $-1, %edx addl %edx, %eax pushl %eax irmovel $4, %edx 2021/10/29 8 rrmovl %ebx, %eax addl %edx, %eax pushl %eax call rSum mrmovl (%ebx), %edx addl %edx, %eax jmp L39 L38: xorl %eax, %eax L39: mrmovl -24(%ebp), %ebx rrmovl %ebp, %esp popl %ebp ret

Problem 4.4(P270) int pushtesto int rval / Insert the following assembly code movl %esp, %eax #save stack pointer pushl%esp #push stack pointer popl %edx #pop it back subl edx. eax tto or 4 movl %oeax, rval set as return quay It implies that pus the original value of return rval %esp old value In our experiments, we find that the function pushtest return o W lat does this imply about the behavior of the instruction pushl %oesp under IA 32 2021/10/29
Problem 4.4 (P270) int pushtest() { int rval; /* Insert the following assembly code: movl %esp, %eax #save stack pointer pushl %esp #push stack pointer popl %edx #pop it back subl %edx, %eax # 0 or 4 movl %eax, rval # set as return value */ … return rval; } In our experiments, we find that the function pushtest return 0. What does this imply about the behavior of the instruction pushl %esp under IA32? 2021/10/29 9 It implies that push the original value of %esp (old value)

Problem 4.5(P270) int poptesto int rval / Insert the following assembly code pushl tval #t save tval on stack movl %esp, %edx #f save stack pointer popl %esp t pop to stack pointer movl %oesp, rval setI movl %edx, %esp( It implies that popl %esp set the stack pointer to the value read from memory return rval mrmovl o(%esp). loess We find this function always returns tval the value passed to it as its argument. What does this imply about the behavior of pop es other y86 ins c tion would have th behavior 2021/10/29
Problem 4.5 (P270) int poptest() { int rval; /* Insert the following assembly code: pushl tval # save tval on stack movl %esp, %edx # save stack pointer popl %esp # pop to stack pointer movl %esp, rval # set popped value as return value movl %edx, %esp # restore original stack pointer */ … return rval; } We find this function always returns tval, the value passed to it as its argument. What does this imply about the behavior of popl %esp ? What other Y86 instruction would have the exact same behavior? 2021/10/29 10 It implies that popl %esp set the stack pointer to the value read from memory. mrmovl 0(%esp), %esp
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level(2)Representation of Programs.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter2.pptx
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Linking II(• Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Dynamic Memory Allocation(• Implementation of a simple allocator • Explicit Free List • Segregated Free List).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Multilevel page tables • Different points of view • Pentium/Linux Memory System • Memory Mapping).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Virtual Space• Address translation • Accelerating translation• Different points of view).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• Cache mountain • Matrix multiplication).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• General concepts • 3 ways to organize cache memory • Issues with writes • Write cache friendly codes • Cache mountain).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Memory Hierarchy(• Random-Access Memory(RAM)• Nonvolatile Memory • Disk Storage • Locality • Memory hierarchy).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Hardware Organization.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_13 Code Optimization(• Optimizing Blockers • Understanding Modern Processor • More Code Optimization techniques • Performance Tuning).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_12b Code Optimization(• Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part II.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_09、10 Sequential CPU Implementation.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Processor Architecture.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Heterogeneous Data Structures & Alignment; Putting it Together; Floating Point.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Procedure Call and Array.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter5 Optimizing Program Performance.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter6 The Memory Hierarchy.ppt
- 复旦大学:《计算机网络与网页制作》课程教学大纲 Computer Network and Webpage Design.pdf
- 《当代教育理论与实践》论文:大学计算机基础教学实践与思考(复旦大学:肖川、张向东).pdf
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)01 计算机网络基础.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)02 两类基本网络(局域网、无线局域网).pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)03 因特网基础知识.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)04 传统的Internet服务.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)05 新型的Internet应用.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)06 Internet安全.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)07 Dreamweaver CS5入门.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)08 创建一个新站点.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)09 添加文本和图像.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)10 用CSS设定页面样式.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)11 用CSS作页面布局.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)12 页面布局高级技术.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)13 使用表格.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)14 添加动画、视频和声音.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)15 使用模块化技术加速网页制作.pptx
- 复旦大学:《计算机网络与网页制作》课程PPT教学课件(讲稿)16 构建网页表单.pptx