Computer Organization Chapter 4. Prof. Qi Tian Fall 2013

Size: px
Start display at page:

Download "Computer Organization Chapter 4. Prof. Qi Tian Fall 2013"

Transcription

1 Computer Organization Chapter 4 Prof. Qi Tian Fall

2 Topics Dec. 6 (Friday) Final Exam Review Record Check Dec. 4 (Wednesday) 5 variable Karnaugh Map Quiz 5 Dec. 2 (Monday) 3, 4 variables Karnaugh Map Reminder: Assignment 6 is due (extended) on Wednesday Dec 4. Last quiz on Wednesday Dec 4 Final exam review on Friday. Course evaluation on ASAP by Dec 2. 2

3 Topics Nov. 27 (Wednesday) Minimum sum-of-product solution 2 variable Karnaugh map Nov. 25 (Monday) Truth Table Minterm and Maxterm Nov. 22 (Friday) Practice Problems 4.2 Digital Logic Design Function Complete 3

4 Topics Nov. 20 (Wednesday) Midterm Exam Two Practice Problems 4.1 Nov. 18 (Monday) Guest Lecture by Prof. Dakai Zhu Nov. 13 (Wednesday) Y86 Instruction Set Slides

5 Section 4.1 The Y86 Instruction Set Architecture We will look at an assembly language set Y86 Simpler than IA32 but similar to it Compared to IA32, Y86 has fewer data types, instructions, and addressing modes. Y86 is inspired by IA32 instruction set, which is colloquially referred to as x86 Understand how it is encoded, and how you would build hardware to implement it. 5

6 Section Programmer-Visible State RF: Program Registers %eax %esi %ecx %edi %edx %esp %ebx %ebp CC: Condition codes ZF SF OF PC Stat: Program status DMEM: Memory The Y bit registers with the same names as the IA32 32-bit registers 3 condition codes: ZF, SF, OF (not carry flag interpret integers as signed) A program counter (PC) A program status byte: AOK, HLT, ADR, INS Memory: up to 4 GB to hold program and data The Y86 does not have A carry flag Floating point registers 6

7 Section Programmer-Visible State RF: Program Registers %eax %esi %ecx %edi %edx %esp %ebx %ebp CC: Condition codes ZF SF OF PC Stat: Program status DMEM: Memory Register %esp is used as stack pointer by the push, pop, call and return instructions. Other registers do not have fixed meanings or values. Single-bit condition codes: ZF, SF, OF, storing information about the effect of the most recent arithmetic or logical instructions. The program counter (PC) holds the address of the instruction currently being executed. Memory is conceptually a large array of bytes, holding both program and data. Status code: Stat, indicating the overall state of program execution. It will indicate either normal operation, or that some sort of exception has occurred. 7

8 Section Y86 instruction Y86 instruction set Instruction encodings range between 1 and 6 bytes An instruction consists of an 1-byte instruction specifier Possibly a 1-byte register specifier Possibly a 4-byte constant word Field fn specifies a particular integer operation (OP1), data movement condition (cmovxx), or branch condition (jxx). A numeric values are shown in hexadecimal. 8

9 Section Instruction Encoding ra or rb represent one of the registers, encoded as follows: Number Register Name 0 %eax 1 %ecx 2 %edx 3 %ebx 4 %esp 5 %ebp 6 %esi 7 %edi F No register Different opcodes for 4 types of moves: o (rr) Register to register o (ir) immediate to register o (rm) register to memory o (mr) memory to register 9

10 Section Instruction Encoding The only memory addressing mode is base register + displacement No second register and scaling factor Memory operations always move 4 bytes (no byte or 2 bytes word memory operations Source or destination of memory move must be a register. The operations supported (OP1) are: fn operation 0 addl 1 subl 2 andl 3 xorl Only 32-bit operations and no or and no not. These only take registers as operands and only work on 32bits. 10

11 Section Instruction Encoding 7 jumps instructions: fn jump 0 jmp 1 jle 2 jl 3 je 4 jne 5 jge 6 jg 6 conditional move instructions with encodings similar to the conditional jump instructions. Similar to the IA32 Note that rrmovl is a special case. You can tell the type of instruction and how many bytes it has by looking at the first byte of the instruction. 11

12 Figure 4.3. Function codes for Y86 instruction set Operations Branches Moves addl 6 0 jmp 7 0 jne 7 4 rrmovl 2 0 cmovne 2 4 subl 6 1 jle 7 1 jge 7 5 cmovle 2 1 cmovge 2 5 andl 6 2 jl 7 2 jg 7 6 cmovl 2 2 cmovg 2 6 xorl 6 3 je 7 3 cmove 2 3 The code specifies a particular integer operation, branch condition, or data transfer condition. These instructions are shown as OP1, jxx, and cmovxx in Figure

13 Summary of Section : Y86 instruction set Number Register Name 0 %eax 1 %ecx 2 %edx 3 %ebx 4 %esp 5 %ebp 6 %esi 7 %edi F No register Program register identifiers fn jump 0 jmp 1 jle 2 jl 3 je 4 jne 5 jge 6 jg 7 jump functions fn operation 0 addl 1 subl 2 andl 3 xorl Operations supported Operations Branches Moves addl 6 0 jmp jne rrmovl 2 0 cmovne 2 4 subl 6 1 jle jge cmovle 2 1 cmovge 2 5 andl 6 2 jl jg cmovl 2 2 cmovg 2 6 xorl 6 3 je cmove 2 3

14 Section Y86 instruction Y86 is largely a subset of the IA32 instruction set. Include only 4-byte integer operations, has fewer addressing modes, and includes a smaller set of operations. Since we only use 4-byte data, we can refer to these as words without ambiguity. 14

15 Instruction Encoding Examples 1. rrmovl %eax, %ecx The encodings are: 2001 This would be stored in 2 bytes of memory, the first containing 0x20 and the second containing 0x rmmovl %ecx, 24(%ebp) The encodings are: The first two bytes are 4015 and the displacement is 0x24. On a little endian machine the next byte would be 0x24 followed by 3 bytes of 0. 15

16 Practice Problem 4.1 Determine the byte encoding of the Y86 instruction sequences that follows. The line.pos 0x100 indicates that the starting address of the object code should be 0x100..pos 0x100 # start code at address 0x100 irmovl $15, %ebx # load 15 into %ebx rrmovl %ebx, %ecx # copy 15 to %ecx loop: # loop rmmovl %ecx, -3(%ebx) # save %ecx at address 15-3=12 addl %ebx, %ecx # increment %ecx by 15 jmp loop # Goto loop 16

17 Practice Problem Solution Determine the byte encoding of the Y86 instruction sequences that follows. The line.pos 0x100 indicates that the starting address of the object code should be 0x100..pos 0x100 # start code at address 0x100 irmovl $15, %ebx # load 15 into %ebx 0x100: 30f30f rrmovl %ebx, %ecx # copy 15 to %ecx 0x106: 2031 loop: # loop 0x108: rmmovl %ecx, -3(%ebx) # save %ecx at address 15-3=12 0x108: 4013fdffffff addl %ebx, %ecx # increment %ecx by 15 0x10e: 6031 jmp loop # Goto loop 0x110:

18 Practice Problem 4.2 For each byte sequence listed, determine the Y86 instruction sequences it encodes. If there is some invalid byte in the sequence, show the instruction sequence up to that point and indicate where the invalid value occurs. For each sequence, we show that the starting address, then a colon, and then the byte sequence. A. 0x100: 30f3fcffffff B. 0x200: a06f f30a

19 Practice Problem Solution For each byte sequence listed, determine the Y86 instruction sequences it encodes. If there is some invalid byte in the sequence, show the instruction sequence up to that point and indicate where the invalid value occurs. For each sequence, we show that the starting address, then a colon, and then the byte sequence. A. 0x100: 30f3fcffffff x100: irmovl $-4, %ebx 0x106: rmmovl %esi, 0x800(%ebx) Note: -4 = fffffffc 0x10c: halt B. 0x200: a06f f30a x200: pushl %esi 0x202: call proc 0x207: halt 0x208: proc 0x208: irmovl $10, %ebx 0x20e: ret 19

20 Y86 vs IA32 Encodings of the Y86 are simpler than the IA32, but not as compact. IA 32 is sometimes labeled as CISC and is deemed to be the opposite of RISC. RISC and CISC RISC = reduced instruction set computer CISC = complex instruction set computer Basic ideas of RISC Small number of instructions Most instructions have the same length Simple addressing formats Arithmetic and logical operations only work on registers Memory operations only move between register and memory No condition codes: test instructions store results in registers. Long controversy between RISC and CISC since 1980 s (Read textbook pp ) Which is better? Answer: A combination Which is Y86? It includes both RISC and CISC On the CISC side, it has conditional codes, variable-length instructions, and stack-intensive procedure linkages. On the RISC side, it uses a load-store architecture and a regular encoding. Taking IA32 and simplifying it by applying the principle of RISC. 20

21 Section Y86 Exceptions What happens when an invalid assembly instruction is found? This generates an exception. In Y86 an exception halts the machine, it stops executing. What are some possible causes of exceptions? Invalid operation Divide by 0 Sqrt of negative number Memory access error (e.g., address too large) Hardware error 21

22 Section Y86 Exceptions Value Name Meaning 1 AOK Normal operation 2 HLT Halt instruction encountered 3 ADR Invalid address encountered 4 INS Invalid instruction encountered Y86 status codes. In our design, the processor halts for any code other than AOK 22

23 Y86 Examples Example 1: IA32 addl (%ecx), %eax Y86: Cannot be finished in one instruction 2 instructions to implement: mrmovl (%ecx), %esi addl %esi, %eax Example 2: IA 32: addl $4, %ecx Y86: irmovl $4, %ebx addl %ebx, %ecx Example 3: IA 32: addl (%ebx, %edx, 4), %eax Y86: How many Y86 instructions are needed to do this? 23

24 Section 4.2 Logic Design Section Logic gates AND OR NOT Logic gate: simplest building block, 1-2 inputs and 1 output; Boolean function such as AND, OR, and NOT Hardware Description Language (HDL) Currently, circuits are designed using a HDL. Much like a C code: for example, an AND gate is represented by a && b 24

25 Section Combinational Circuits Combinational Circuits No memory vs. clocked sequential circuits, has memory Building blocks: logic gates Design an economic circuit Algebraic methods for simplication Karnaugh maps Alternative way 25

26 Section Combinational Circuits Example: bit equal 1) bool eq = (a&&b) (!a &&!b) Alternative way 26

27 Section Combinational Circuits A block diagram: We can make a multi-bit equal out of 1-bit equals Here is a block diagram 27

28 Example: 1-bit multiplexer It allows you to select one of two one-bit inputs (data selector) and is described by: bool out = (s && a) (!s && b) Here is a block diagram s = 1, out = a; s = 0, out = b; 28

29 Example: a multi-bit multiplexer We can make a multi-bit (word level) mux out of 1-bit muxes: HCL descriptions of the mux: Int Out = [ s: A; 1: B; ]; [ ] is like a select, it means if s is true, the result is A. Otherwise, we check the next case. 1 is always true, so we select B. 29

30 Example: 4-word MUX Here is a 4 word mux (4-way mux) HCL description: int Out4 = [!s1 &&!s0 : A;!s1 : B;!s0 : C; 1 : D; ]; s1s0 out 00 A 01 B 10 C 11 D Question: How many control inputs would be needed for a 7-way mux? 30

31 Other Gates and Basic Building Blocks XOR gate: Out = a^b =!a && b a &&!b 31

32 Function Complete Function complete: Any circuits can be made from and, or, and not gates can also be made just using and and not gates; or or and not gates Because: a b =! (!a &&!b); a && b =! (!a!b) The function complete sets: (and, or, not), (and, or), (or, not) Any single gates can be used as functionally complete sets? Ans: Yes, they are NAND ( ) gate and NOR ( ) gate. Questions: Prove { }, and { } are function complete. 32

33 Function Complete Proof of functional complete for NAND { } Proof of functional complete for NOR { } 33

34 Adders 1-bit Half Adder: 2 inputs (A, B) and 2 outputs (S, C) Truth Table A B C S Note = = = =2 S = A^B C = A&&B 34

35 1-bit Full Adders 1-bit Full Adder: 3 inputs (A,B,C in ) and 2 outputs (S, C out ) A B C in C out S Truth Table

36 1-bit Full Adder Assignment 6 A B A B A B 36

37 Class Notes Topics: Minterm m i Maxterm M i Standard sum-of-product Standard product-of-sum Karnaugh-Map Minimum sum-of-product Minimum product-of-sum Note: See class notes in the course web page under Resources Link. 37

38 Karnaugh Maps Design: Start from Truth table => Karnaugh Maps => Boolean expressions Kaunaugh Map Useful tool for simplifying and manipulating switching functions of three or four variables. Similar to truth tables, but in different representation. 38

39 4-bit Full Adder 4-bit full adder which takes as input two 4-bit number and a carry coming in and produce a 5 bits of output. Input: 9 bits Output: 5 bits How to design it? Using Truth table? How big is it? Not efficient for Kaunaugh-Map. 39

40 4-bit Full Adder 4-bit full adder which takes as input two 4-bit number and a carry coming in and produce a 5 bits of output. Can be designed in a cascade way! 40

41 A little more about Logic Design Propagation Delay Real gates are made from transistors, voltages are used to represent Boolean values true (1) and false (0) A voltage greater than a true-threshold is true, and a voltage less than false-threshold is false. Voltages between these two thresholds give undefined results. When you change the input from high to low, it takes some time, called the propagation delay, or gate delay, for the output voltage to reach its correct value. Propagation delay determines how fast your CPU can run. 41

42 ALU (Arithmetic Logic Unit) An ALU is a circuit that can produce one of several arithmetic (add, subtract, etc.) or logical (and, or, etc.) functions. ALU Design Block diagram of this ALU 42

43 Section Memory and Clocking So far, we have talked about combinational circuits Clocked Sequential Circuits: Has memory; clock input Flip-Flops S-R Flip-Flop, D Flip-flop, J-K Flip-Flop, T Flip-Flop, edge-triggered D Flip-Flop and the building block of a multi-bit register 43

44 Section Organizing Processing Steps into Stages SEQ: a sequential processor Processing an instruction involves a number of operations, and we organize them in a particular sequence of stages, attempting to make all instructions follow a uniform sequence. Design a processor that makes best use of the hardware. 44

45 SEQ Hardware Structure The computations required to implement all of the Y86 instructions can be organized into six basic stages: fetch, decode, execute, memory, write back, and PC update. See Figure 4.22 for a better quality. 45

46 An Informal Description Fetch Read the instruction into memory using the address in the PC. Decode If possible, read the values from the register file and set vala and valb. The registers are specified by ra and rb except for push and pop which use %esp in place of rb. Execute What it does depends on the icode. Some instructions feed values into the ALU to obtain a vale and possibly set the condition codes. e.g., OP1, rmmovl, mrmovl Some instructions will check the condition codes and change the valp. Memory May read from or write to memory Write back May write up to two values to the register file. Pop will update both the stack pointer and the register popped into. PC Update PC is set valp. 46

47 Sample Y86 instruction sequence Stage OP1 ra, rb rrmovl ra, rb irmovl V, rb Fetch icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valp PC +2 icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valp PC +2 icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valc M 4 [PC+2] valp PC +6 Decode vala R[rA] vala R[rA] valb R[rB] Execute vale valb OP vala vale 0 + vala vale 0 + valc Set CC Memory Write back R[rB] vale R[rB] vale R[rB] vale PC update PC valp PC valp PC valp Figure Computations in sequential implementation of Y86 instruction OP1, rrmovl, irmovl. OP1: integer and logical operations; rrmovl (register-to-register move) and irmovl (immediate-to-register move) 47

48 Sample Y86 instruction sequence 1. 0x000: 30f irmovl $9, %edx 2. 0x006: 30f irmovl $21, %ebx 3. 0x00c: 6123 subl %edx, %ebx 4. 0x00e: 30f irmovl $128, %esp 5. 0x014: rmmovl %esp, 100(%ebx) 6. 0x01a: a02f pushl %edx 7. 0x01c: b00f popl %eax 8. 0x01e: je done 9. 0x023: call proc 10. 0x028: done: 11. 0x028: 00 halt 12. 0x029: proc: 13. 0x029: 90 ret Questions: We will trace the processing of these instructions. 48

49 Practice Problem Fill-in the right-hand column of the following table to describe the processing of the irmovl instruction online 4 of the object code in previous slide. Stage Fetch Decode Execute Memory Write back PC update Generic irmovl V, rb icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valc M 4 [PC+2] valp PC +6 vale 0 + valc R[rB] vale PC valp Specific irmovl $128, %esp 49

50 Practice Problem - solution Fill-in the right-hand column of the following table to describe the processing of the irmovl instruction on line 4 of the object code in previous slide. Stage Fetch Generic irmovl V, rb icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valc M 4 [PC+2] valp PC +6 Specific irmovl $128, %esp icode:ifun M 1 [0x00e]=3:0 ra:rb M 1 [0x00f]=f:4 valc M 4 [PC+2]=128 valp PC +6 = 0x014 Decode Execute vale 0 + valc vale 0 + valc = =128 Memory Write back R[rB] vale R[rB] 128 PC update PC valp PC 0x14 50

51 Sample Y86 instruction sequence Stage rmmovl ra, D(rB) mrmovl D(rB), ra Fetch icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valc M 4 [PC+2] valp PC +6 icode:ifun M 1 [PC] ra:rb M 1 [PC+1] valc M 4 [PC+2] valp PC +6 Decode vala R[rA] valb R[rB] valb R[rB] Execute vale valb + valc vale valb + valc Memory M 4 [vale] vala valm M 4 [vale] Write back R[rA] valm PC update PC valp PC valp Figure Computations in sequential implementation of Y86 instruction rmmovl, mrmovl. These instructions read or write memory. 51

52 Sample Y86 instruction sequence Stage pushl ra pop1 ra Fetch icode:ifun M 1 [PC] icode:ifun M 1 [PC] ra:rb M 1 [PC+1] ra:rb M 1 [PC+1] valp PC + 2 valp PC + 2 Decode vala R[rA] vala R[%esp] valb R[%esp] valb R[%esp] Execute vale valb + (-4) vale valb + 4 Memory M 4 [vale] vala valm M 4 [vala] Write back R[%esp] vale R[%esp] vale R[rA] valm PC update PC valp PC valp Figure Computations in sequential implementation of Y86 instruction pushl, popl. These instructions push and pop the stack. 52

53 Sample Y86 instruction sequence Stage jxx Dest Call Dest ret Fetch icode:ifun M 1 [PC] Icode:ifun M 1 [PC] icode:ifun M 1 [PC] valc M 4 [PC+1] valp PC + 5 valc M 4 [PC+1] valp PC + 5 valp PC + 1 Decode vala R[%esp] valb R[%esp] valb R[%esp] Execute vale valb + (-4) vale valb + 4 Cnd Cond(CC, ifun) Memory M 4 [vale] valp valm M 4 [vala] Write back R[%esp] vale R[%esp] vale PC update PC Cnd? valc: valp PC valc PC valm Figure Computations in sequential implementation of Y86 instruction jxx, call, ret. These instructions cause control transfers. 53

CISC: Stack-intensive procedure linkage. [Early] RISC: Register-intensive procedure linkage.

CISC: Stack-intensive procedure linkage. [Early] RISC: Register-intensive procedure linkage. CISC: Stack-intensive procedure linkage. The stack is used for procedure arguments and return addresses. [Early] RISC: Register-intensive procedure linkage. Registers are used for procedure arguments and

More information

Computer Science 104:! Y86 & Single Cycle Processor Design!

Computer Science 104:! Y86 & Single Cycle Processor Design! Computer Science 104: Y86 & Single Cycle Processor Design Alvin R. Lebeck Slides based on those from Randy Bryant 1 CS:APP Administrative Homework #4 My office hours today 11:30-12:30 Reading: text 4.3

More information

Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary

Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary 1 Outline Introduction to assembly programing Introduction to Y86 Y86 instructions,

More information

Computer Science 104:! Y86 & Single Cycle Processor Design!

Computer Science 104:! Y86 & Single Cycle Processor Design! Computer Science 104:! Y86 & Single Cycle Processor Design! Alvin R. Lebeck! Slides based on those from Randy Bryant 1! CS:APP! CS:APP! Administrative! 2! CS:APP! Instruction Set Architecture! Application!

More information

Sequential Implementation

Sequential Implementation CS:APP Chapter 4 Computer Architecture Sequential Implementation Randal E. Bryant adapted by Jason Fritts http://csapp.cs.cmu.edu CS:APP2e Hardware Architecture - using Y86 ISA For learning aspects of

More information

Where Have We Been? Logic Design in HCL. Assembly Language Instruction Set Architecture (Y86) Finite State Machines

Where Have We Been? Logic Design in HCL. Assembly Language Instruction Set Architecture (Y86) Finite State Machines Where Have We Been? Assembly Language Instruction Set Architecture (Y86) Finite State Machines States and Transitions Events Where Are We Going? Tracing Instructions at the Register Level Build a CPU!

More information

CPSC 121: Models of Computation. Module 10: A Working Computer

CPSC 121: Models of Computation. Module 10: A Working Computer CPSC 121: Models of Computation Module 10: A Working Computer Module 10: A Working Computer???build a computer that is?able to 1. How can we?execute a user-defined program? We are finally able to answer

More information

CPSC 121: Models of Computation. Module 10: A Working Computer

CPSC 121: Models of Computation. Module 10: A Working Computer CPSC 121: Models of Computation The 10th online quiz is due Tuesday, March 26 th at 17:00. Assigned reading for the quiz: Epp, 4th edition: 6.1, 7.1 Epp, 3rd edition: 5.1, 6.1 Rosen, 6th edition: 2.1,

More information

Reading assignment. Chapter 3.1, 3.2 Chapter 4.1, 4.3

Reading assignment. Chapter 3.1, 3.2 Chapter 4.1, 4.3 Reading assignment Chapter 3.1, 3.2 Chapter 4.1, 4.3 1 Outline Introduc5on to assembly programing Introduc5on to Y86 Y86 instruc5ons, encoding and execu5on 2 Assembly The CPU uses machine language to perform

More information

CS:APP Chapter 4! Computer Architecture! Sequential! Implementation!

CS:APP Chapter 4! Computer Architecture! Sequential! Implementation! CS:APP Chapter 4! Computer Architecture! Sequential! Implementation! Randal E. Bryant! Carnegie Mellon University! http://csapp.cs.cmu.edu CS:APP2e! Y86 Instruction Set #1! Byte! 0 1 2 3 4 5 halt 0 0 nop

More information

CS:APP Chapter 4 Computer Architecture Sequential Implementation

CS:APP Chapter 4 Computer Architecture Sequential Implementation CS:APP Chapter 4 Computer Architecture Sequential Implementation Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Y86 Instruction Set Byte 0 1 2 3 4 5 nop 0 0 halt 1 0 rrmovl

More information

Background: Sequential processor design. Computer Architecture and Systems Programming , Herbstsemester 2013 Timothy Roscoe

Background: Sequential processor design. Computer Architecture and Systems Programming , Herbstsemester 2013 Timothy Roscoe Background: Sequential processor design Computer Architecture and Systems Programming 252 0061 00, Herbstsemester 2013 Timothy Roscoe Overview Y86 instruction set architecture Processor state Instruction

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant adapted by Jason Fritts http://csapp.cs.cmu.edu CS:APP2e Hardware Architecture - using Y86 ISA For learning aspects

More information

Giving credit where credit is due

Giving credit where credit is due CSCE 230J Computer Organization Processor Architecture III: Sequential Implementation Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due

More information

Computer Science 104:! Y86 & Single Cycle Processor Design!

Computer Science 104:! Y86 & Single Cycle Processor Design! Computer Science 104: Y86 & Single Cycle Processor Design Alvin R. Lebeck Slides based on those from Randy Bryant CS:APP Administrative HW #4 Due tomorrow tonight HW #5 up soon ing: 4.1-4.3 Today Review

More information

Processor Architecture I. Alexandre David

Processor Architecture I. Alexandre David Processor Architecture I Alexandre David Overview n Introduction: from transistors to gates. n and from gates to circuits. n 4.1 n 4.2 n Micro+macro code. 12-04-2011 CART - Aalborg University 2 Evolution

More information

Chapter 4! Processor Architecture!!

Chapter 4! Processor Architecture!! Chapter 4! Processor Architecture!! Sequential Implementation! Instructor: Dr. Hyunyoung Lee! Texas A&M University! Based on slides provided by Randal E. Bryant, CMU Topics Covered! Hardware Control Language

More information

Processor Architecture II! Sequential! Implementation!

Processor Architecture II! Sequential! Implementation! Processor Architecture II! Sequential! Implementation! Lecture 6, April 14 th 2011 Alexandre David Slides by Randal E. Bryant! Carnegie Mellon University! Y86 Instruction Set! Byte! 0 1 2 3 4 5 nop 0 0

More information

CSC 252: Computer Organization Spring 2018: Lecture 11

CSC 252: Computer Organization Spring 2018: Lecture 11 CSC 252: Computer Organization Spring 2018: Lecture 11 Instructor: Yuhao Zhu Department of Computer Science University of Rochester Action Items: Assignment 3 is due March 2, midnight Announcement Programming

More information

Computer Science 104:! Y86 & Single Cycle Processor Design!

Computer Science 104:! Y86 & Single Cycle Processor Design! Computer Science 104:! Y86 & Single Cycle Processor Design! Alvin R. Lebeck! Slides based on those from Randy Bryant CS:APP! Administrative! 2! CS:APP! Y86 Instruction Set! Byte! 0 1 2 3 4 5 nop 0 0 halt

More information

cmovxx ra, rb 2 fn ra rb irmovl V, rb rb V rmmovl ra, D(rB) 4 0 ra rb D mrmovl D(rB), ra 5 0 ra rb D OPl ra, rb 6 fn ra rb jxx Dest 7 fn Dest

cmovxx ra, rb 2 fn ra rb irmovl V, rb rb V rmmovl ra, D(rB) 4 0 ra rb D mrmovl D(rB), ra 5 0 ra rb D OPl ra, rb 6 fn ra rb jxx Dest 7 fn Dest Instruction Set Architecture Instruction Set Architecture CSci 2021: Machine Architecture and Organization Lecture #16, February 25th, 2015 Your instructor: Stephen McCamant Based on slides originally

More information

Systems I. Datapath Design II. Topics Control flow instructions Hardware for sequential machine (SEQ)

Systems I. Datapath Design II. Topics Control flow instructions Hardware for sequential machine (SEQ) Systems I Datapath Design II Topics Control flow instructions Hardware for sequential machine (SEQ) Executing Jumps jxx Dest 7 fn Dest fall thru: XX XX Not taken target: XX XX Taken Fetch Decode Read 5

More information

Chapter 4! Processor Architecture!

Chapter 4! Processor Architecture! Chapter 4! Processor Architecture!! Y86 Instruction Set Architecture! Instructor: Dr. Hyunyoung Lee! Texas A&M University! Based on slides provided by Randal E. Bryant, CMU Why Learn Processor Design?!

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Warren Hunt, Jr. and Bill Young Department of Computer Sciences University of Texas at Austin Last updated: October 1, 2014 at 12:03 CS429 Slideset 6: 1 Topics

More information

Stage Computation: Arith/Log. Ops

Stage Computation: Arith/Log. Ops Stage Computation: Arith/Log. Ops OPl ra, rb Fetch icode:ifun M 1 [PC] ra:rb M 1 [PC+1] Read instruction byte Read register byte back valp PC+2 vala R[rA] valb R[rB] vale valb OP vala Set CC R[rB] vale

More information

CISC Fall 2009

CISC Fall 2009 Michela Taufer October 20, 2009 Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and D. O'Hallaron, Prentice Hall, 2003 Y86 Instruction Set Byte 0 1 2 3 4 5 nop 0 0

More information

Y86 Processor State. Instruction Example. Encoding Registers. Lecture 7A. Computer Architecture I Instruction Set Architecture Assembly Language View

Y86 Processor State. Instruction Example. Encoding Registers. Lecture 7A. Computer Architecture I Instruction Set Architecture Assembly Language View Computer Architecture I Instruction Set Architecture Assembly Language View Processor state Registers, memory, Instructions addl, movl, andl, How instructions are encoded as bytes Layer of Abstraction

More information

CS:APP Chapter 4 Computer Architecture Sequential Implementation

CS:APP Chapter 4 Computer Architecture Sequential Implementation CS:APP Chapter 4 Computer Architecture Sequential Implementation Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Y86 Instruction Set Byte 0 1 2 3 4 5 nop 0 0 halt 1 0 rrmovl

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View Processor

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View! Processor

More information

God created the integers, all else is the work of man Leopold Kronecker

God created the integers, all else is the work of man Leopold Kronecker Sequential Hardware God created the integers, all else is the work of man Leopold Kronecker (He believed in the reduction of all mathematics to arguments involving only the integers and a finite number

More information

CPSC 313, Winter 2016 Term 1 Sample Date: October 2016; Instructor: Mike Feeley

CPSC 313, Winter 2016 Term 1 Sample Date: October 2016; Instructor: Mike Feeley CPSC 313, Winter 2016 Term 1 Sample Date: October 2016; Instructor: Mike Feeley NOTE: This sample contains all of the question from the two CPSC 313 midterms for Summer 2015. This term s midterm will be

More information

Processor Architecture

Processor Architecture Processor Architecture God created the integers, all else is the work of man Leopold Kronecker (He believed in the reduction of all mathematics to arguments involving only the integers and a finite number

More information

CISC 360 Instruction Set Architecture

CISC 360 Instruction Set Architecture CISC 360 Instruction Set Architecture Michela Taufer October 9, 2008 Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and D. O'Hallaron, Prentice Hall, 2003 Chapter

More information

Instruction Set Architecture

Instruction Set Architecture CISC 360 Instruction Set Architecture Michela Taufer October 9, 2008 Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and D. O'Hallaron, Prentice Hall, 2003 Chapter

More information

Intel x86-64 and Y86-64 Instruction Set Architecture

Intel x86-64 and Y86-64 Instruction Set Architecture CSE 2421: Systems I Low-Level Programming and Computer Organization Intel x86-64 and Y86-64 Instruction Set Architecture Presentation J Read/Study: Bryant 3.1 3.5, 4.1 Gojko Babić 03-07-2018 Intel x86

More information

Systems I. Datapath Design II. Topics Control flow instructions Hardware for sequential machine (SEQ)

Systems I. Datapath Design II. Topics Control flow instructions Hardware for sequential machine (SEQ) Systems I Datapath Design II Topics Control flow instructions Hardware for sequential machine (SEQ) Executing Jumps jxx Dest 7 fn Dest fall thru: XX XX Not taken target: XX XX Taken Read 5 bytes Increment

More information

CPSC 313, Summer 2013 Final Exam Date: June 24, 2013; Instructor: Mike Feeley

CPSC 313, Summer 2013 Final Exam Date: June 24, 2013; Instructor: Mike Feeley CPSC 313, Summer 2013 Final Exam Date: June 24, 2013; Instructor: Mike Feeley This is a closed-book exam. No outside notes. Electronic calculators are permitted. You may remove the last two pages of the

More information

cs281: Introduction to Computer Systems CPUlab Datapath Assigned: Oct. 29, Due: Nov. 3

cs281: Introduction to Computer Systems CPUlab Datapath Assigned: Oct. 29, Due: Nov. 3 cs281: Introduction to Computer Systems CPUlab Datapath Assigned: Oct. 29, Due: Nov. 3 The objective of this exercise is to familiarize you with the Datapath of the Y86 CPU and to introduce you to the

More information

cs281: Computer Systems CPUlab ALU and Datapath Assigned: Oct. 30, Due: Nov. 8 at 11:59 pm

cs281: Computer Systems CPUlab ALU and Datapath Assigned: Oct. 30, Due: Nov. 8 at 11:59 pm cs281: Computer Systems CPUlab ALU and Datapath Assigned: Oct. 30, Due: Nov. 8 at 11:59 pm The objective of this exercise is twofold to complete a combinational circuit for an ALU that we can use with

More information

CS:APP Chapter 4 Computer Architecture Sequential Implementation

CS:APP Chapter 4 Computer Architecture Sequential Implementation CS:APP Chapter 4 Computer Architecture Sequential Implementation Randal E. Bryant Carnegie Mellon University CS:APP Y86 Instruction Set Byte ra rb ra rb V rb rb V ra D rb ra rb D D rb ra ra rb D ra rb

More information

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature

CSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature CSE2421 FINAL EXAM SPRING 2013 Name KEY Instructions: This is a closed-book, closed-notes, closed-neighbor exam. Only a writing utensil is needed for this exam. No calculators allowed. If you need to go

More information

Computer Organization: A Programmer's Perspective

Computer Organization: A Programmer's Perspective A Programmer's Perspective Instruction Set Architecture Gal A. Kaminka galk@cs.biu.ac.il Outline: CPU Design Background Instruction sets Logic design Sequential Implementation A simple, but not very fast

More information

Giving credit where credit is due

Giving credit where credit is due JDEP 284H Foundations of Computer Systems Processor rchitecture III: Sequential Implementation Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are

More information

Overview. CS429: Computer Organization and Architecture. Y86 Instruction Set. Building Blocks

Overview. CS429: Computer Organization and Architecture. Y86 Instruction Set. Building Blocks Overview CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: March 15, 2018 at 10:54 How do we build a digital computer?

More information

Foundations of Computer Systems

Foundations of Computer Systems 18-600 Foundations of Computer Systems Lecture 7: Processor Architecture & Design John P. Shen & Gregory Kesden September 20, 2017 Lecture #7 Processor Architecture & Design Lecture #8 Pipelined Processor

More information

Computer Architecture I: Outline and Instruction Set Architecture. CENG331 - Computer Organization. Murat Manguoglu

Computer Architecture I: Outline and Instruction Set Architecture. CENG331 - Computer Organization. Murat Manguoglu Computer Architecture I: Outline and Instruction Set Architecture CENG331 - Computer Organization Murat Manguoglu Adapted from slides of the textbook: http://csapp.cs.cmu.edu/ Outline Background Instruction

More information

Sequential CPU Implementation.

Sequential CPU Implementation. Sequential CPU Implementation Y86 Instruction Set P259 Byte 0 1 2 3 4 5 nop 0 0 halt 1 0 rrmovl ra, rb 2 0 ra rb irmovl V, rb 3 0 8 rb V rmmovl ra, D(rB) 4 0 ra rb D mrmovl D(rB), ra 5 0 ra rb D OPl ra,

More information

CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK

CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK Question 1: Choose the most appropriate answer 1. In which of the following gates the output is 1 if and only if all the inputs

More information

Second Part of the Course

Second Part of the Course CSC 2400: Computer Systems Towards the Hardware 1 Second Part of the Course Toward the hardware High-level language (C) assembly language machine language (IA-32) 2 High-Level Language g Make programming

More information

Y86 Instruction Set. SEQ Hardware Structure. SEQ Stages. Sequential Implementation. Lecture 8 Computer Architecture III.

Y86 Instruction Set. SEQ Hardware Structure. SEQ Stages. Sequential Implementation. Lecture 8 Computer Architecture III. Building Blocks Combinational Logic Compute Boolean functions of inputs Continuously respond to input changes Operate on data and implement control Storage Elements Store bits Lecture 8 Computer rchitecture

More information

cmovxx ra, rb 2 fn ra rb irmovq V, rb 3 0 F rb V rmmovq ra, D(rB) 4 0 ra rb mrmovq D(rB), ra 5 0 ra rb OPq ra, rb 6 fn ra rb jxx Dest 7 fn Dest

cmovxx ra, rb 2 fn ra rb irmovq V, rb 3 0 F rb V rmmovq ra, D(rB) 4 0 ra rb mrmovq D(rB), ra 5 0 ra rb OPq ra, rb 6 fn ra rb jxx Dest 7 fn Dest Instruction Set Architecture Computer Architecture: Instruction Set Architecture CSci 2021: Machine Architecture and Organization Lecture #16, February 24th, 2016 Your instructor: Stephen McCamant Based

More information

CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University

CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP2e Overview Wrap-Up of PIPE Design Exceptional conditions Performance analysis Fetch

More information

CS 3843 Final Exam Fall 2012

CS 3843 Final Exam Fall 2012 CS 3843 Final Exam Fall 2012 Name (Last), (First) ID Please indicate your session: Morning Afternoon You may use a calculator and two sheets of notes on this exam, but no other materials and no computer.

More information

CS:APP Guide to Y86 Processor Simulators

CS:APP Guide to Y86 Processor Simulators CS:APP Guide to Y86 Processor Simulators Randal E. Bryant David R. O Hallaron November 4, 2004 Copyright c 2002, R. E. Bryant, D. R. O Hallaron. All rights reserved. 1 This document describes the processor

More information

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016 CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between

More information

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018 CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer

More information

CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University

CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University CS:APP Chapter 4 Computer Architecture Wrap-Up Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Overview Wrap-Up of PIPE Design Performance analysis Fetch stage design Exceptional

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr Bill Young Department of Computer Sciences University of Texas at Austin Last updated: March 15, 2018 at 10:58 CS429 Slideset 13: 1 The ISA Byte 0 1 2 3

More information

Review. Computer Science 104 Machine Organization & Programming

Review. Computer Science 104 Machine Organization & Programming Review Computer Science 104 Machine Organization & Programming Administrative 104/16 Processor Due today Final Sunday Dec 18, 2-5pm in D106 Today Ø high-level review Ø Q&A Alex will review sometime, watch

More information

administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions?

administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? exam on Wednesday today s material not on the exam 1 Assembly Assembly is programming

More information

CPSC 313, Summer 2013 Final Exam Solution Date: June 24, 2013; Instructor: Mike Feeley

CPSC 313, Summer 2013 Final Exam Solution Date: June 24, 2013; Instructor: Mike Feeley CPSC 313, Summer 2013 Final Exam Solution Date: June 24, 2013; Instructor: Mike Feeley 1 (10 marks) This question is concerned with the general principles of pipelining, dependencies and hazards. First,

More information

Process Layout and Function Calls

Process Layout and Function Calls Process Layout and Function Calls CS 6 Spring 07 / 8 Process Layout in Memory Stack grows towards decreasing addresses. is initialized at run-time. Heap grow towards increasing addresses. is initialized

More information

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)

More information

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017 CS 31: Intro to Systems ISAs and Assembly Martin Gagné Swarthmore College February 7, 2017 ANNOUNCEMENT All labs will meet in SCI 252 (the robot lab) tomorrow. Overview How to directly interact with hardware

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: October 11, 2017 at 17:42 CS429 Slideset 6: 1 Topics of this Slideset

More information

CSC 8400: Computer Systems. Machine-Level Representation of Programs

CSC 8400: Computer Systems. Machine-Level Representation of Programs CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages

More information

The ISA. Fetch Logic

The ISA. Fetch Logic The ISA CS429: Computer Organization and Architecture Dr Bill Young Department of Computer Science University of Texas at Austin Last updated: July 5, 2018 at 11:55 Byte 0 1 2 3 4 5 6 7 8 9 halt 0 0 nop

More information

CS:APP Chapter 4 Computer Architecture Pipelined Implementation

CS:APP Chapter 4 Computer Architecture Pipelined Implementation CS:APP Chapter 4 Computer Architecture Pipelined Implementation Part II Randal. Bryant Carnegie ellon University http://csapp.cs.cmu.edu CS:APP Overview ata Hazards ake the pipelined processor work! Instruction

More information

For Tuesday. Finish Chapter 4. Also, Project 2 starts today

For Tuesday. Finish Chapter 4. Also, Project 2 starts today For Tuesday Finish Chapter 4 Also, Project 2 starts today 1 Sequential Y86 Implementation 1. Fetch From icode (4 bits) & ifun (4 bits) [valc (4bytes)] Calc valp 2. Decode: get ra [rb] [%esp] 3. Execute

More information

Topics of this Slideset. CS429: Computer Organization and Architecture. Instruction Set Architecture. Why Y86? Instruction Set Architecture

Topics of this Slideset. CS429: Computer Organization and Architecture. Instruction Set Architecture. Why Y86? Instruction Set Architecture Topics of this Slideset CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Intro to Assembly language Programmer visible state Y86

More information

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

X86 Addressing Modes Chapter 3 Review: Instructions to Recognize X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src

More information

Michela Taufer CS:APP

Michela Taufer CS:APP ichela Taufer CS:APP Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and. O'Hallaron, Prentice Hall, 2003 Overview 2 CISC 360 Faʼ08 Pipeline Stages W_icode, W_val W

More information

Instruc(on Set Architecture. Computer Architecture Instruc(on Set Architecture Y86. Y86-64 Processor State. Assembly Programmer s View

Instruc(on Set Architecture. Computer Architecture Instruc(on Set Architecture Y86. Y86-64 Processor State. Assembly Programmer s View Instruc(on Set Architecture Computer Architecture Instruc(on Set Architecture Y86 CSCI 2021: Machine Architecture and Organiza(on Pen- Chung Yew Department Computer Science and Engineering University of

More information

Datorarkitektur, 2009 Tentamen

Datorarkitektur, 2009 Tentamen Namn: Personnummer: Datorarkitektur, 2009 Tentamen 2009-03-13 Instructions: Make sure that your exam is not missing any sheets, then write your full name on the front. Write your answers in the space provided

More information

SEQ part 3 / HCLRS 1

SEQ part 3 / HCLRS 1 SEQ part 3 / HCLRS 1 Changelog 1 Changes made in this version not seen in first lecture: 21 September 2017: data memory value MUX input for call is PC + 10, not PC 21 September 2017: slide 23: add input

More information

System Programming and Computer Architecture (Fall 2009)

System Programming and Computer Architecture (Fall 2009) System Programming and Computer Architecture (Fall 2009) Recitation 2 October 8 th, 2009 Zaheer Chothia Email: zchothia@student.ethz.ch Web: http://n.ethz.ch/~zchothia/ Topics for Today Classroom Exercise

More information

CS 3330: SEQ part September 2016

CS 3330: SEQ part September 2016 1 CS 3330: SEQ part 2 15 September 2016 Recall: Timing 2 compute new values between rising edges compute compute compute compute clock signal registers, memories change at rising edges next value register

More information

Systems I. Pipelining II. Topics Pipelining hardware: registers and feedback paths Difficulties with pipelines: hazards Method of mitigating hazards

Systems I. Pipelining II. Topics Pipelining hardware: registers and feedback paths Difficulties with pipelines: hazards Method of mitigating hazards Systems I Pipelining II Topics Pipelining hardware: registers and feedback paths ifficulties with pipelines: hazards Method of mitigating hazards Adding Pipeline Registers val, valm _icode, _valm rite

More information

3 (5 marks) RISC instruction sets do not allow an ALU operation (e.g., addl) to read from memory. 2a Why is the memory stage after the execute stage?

3 (5 marks) RISC instruction sets do not allow an ALU operation (e.g., addl) to read from memory. 2a Why is the memory stage after the execute stage? CPSC 313, Winter 2016 Term 1 Sample Solution Date: October 2016; Instructor: Mike Feeley 1 (5 marks) The classic RISC pipeline we are studying consists of 5 stages. Briefly explain the role of each stage

More information

Sample Exam I PAC II ANSWERS

Sample Exam I PAC II ANSWERS Sample Exam I PAC II ANSWERS Please answer questions 1 and 2 on this paper and put all other answers in the blue book. 1. True/False. Please circle the correct response. a. T In the C and assembly calling

More information

Process Layout, Function Calls, and the Heap

Process Layout, Function Calls, and the Heap Process Layout, Function Calls, and the Heap CS 6 Spring 20 Prof. Vern Paxson TAs: Devdatta Akhawe, Mobin Javed, Matthias Vallentin January 9, 20 / 5 2 / 5 Outline Process Layout Function Calls The Heap

More information

Compiler Construction D7011E

Compiler Construction D7011E Compiler Construction D7011E Lecture 8: Introduction to code generation Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 What is a Compiler? Compilers

More information

CS61 Section Solutions 3

CS61 Section Solutions 3 CS61 Section Solutions 3 (Week of 10/1-10/5) 1. Assembly Operand Specifiers 2. Condition Codes 3. Jumps 4. Control Flow Loops 5. Procedure Calls 1. Assembly Operand Specifiers Q1 Operand Value %eax 0x104

More information

Towards the Hardware"

Towards the Hardware CSC 2400: Computer Systems Towards the Hardware Chapter 2 Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 High-Level Language Make programming

More information

SOEN228, Winter Revision 1.2 Date: October 25,

SOEN228, Winter Revision 1.2 Date: October 25, SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain

More information

Assembly Language: IA-32 Instructions

Assembly Language: IA-32 Instructions Assembly Language: IA-32 Instructions 1 Goals of this Lecture Help you learn how to: Manipulate data of various sizes Leverage more sophisticated addressing modes Use condition codes and jumps to change

More information

bitwise (finish) / SEQ part 1

bitwise (finish) / SEQ part 1 bitwise (finish) / SEQ part 1 1 Changelog 1 Changes made in this version not seen in first lecture: 14 September 2017: slide 16-17: the x86 arithmetic shift instruction is sar, not sra last time 2 bitwise

More information

Giving credit where credit is due

Giving credit where credit is due CSC 230J Computer Organization Processor rchitecture V: aking the Pipelined Implementation ork r. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csc230j Giving credit where credit

More information

Assembly Language: Function Calls

Assembly Language: Function Calls Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems: Calling and returning Passing parameters Storing local variables Handling registers without interference

More information

CS241 Computer Organization Spring 2015 IA

CS241 Computer Organization Spring 2015 IA CS241 Computer Organization Spring 2015 IA-32 2-10 2015 Outline! Review HW#3 and Quiz#1! More on Assembly (IA32) move instruction (mov) memory address computation arithmetic & logic instructions (add,

More information

Machine-Level Programming II: Control and Arithmetic

Machine-Level Programming II: Control and Arithmetic Machine-Level Programming II: Control and Arithmetic CSCI 2400: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides 1 Today Complete addressing mode, address

More information

Assembly Language: Function Calls" Goals of this Lecture"

Assembly Language: Function Calls Goals of this Lecture Assembly Language: Function Calls" 1 Goals of this Lecture" Help you learn:" Function call problems:" Calling and returning" Passing parameters" Storing local variables" Handling registers without interference"

More information

Module 3 Instruction Set Architecture (ISA)

Module 3 Instruction Set Architecture (ISA) Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O

More information

What is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation

What is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation Compiler Construction SMD163 Lecture 8: Introduction to code generation Viktor Leijon & Peter Jonsson with slides by Johan Nordlander Contains material generously provided by Mark P. Jones What is a Compiler?

More information

Assembly Language: Function Calls" Goals of this Lecture"

Assembly Language: Function Calls Goals of this Lecture Assembly Language: Function Calls" 1 Goals of this Lecture" Help you learn:" Function call problems:" Calling and urning" Passing parameters" Storing local variables" Handling registers without interference"

More information

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points] Review Questions 1 The DRAM problem [5 points] Suggest a solution 2 Big versus Little Endian Addressing [5 points] Consider the 32-bit hexadecimal number 0x21d3ea7d. 1. What is the binary representation

More information

Assembly Language: Function Calls. Goals of this Lecture. Function Call Problems

Assembly Language: Function Calls. Goals of this Lecture. Function Call Problems Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems: Calling and urning Passing parameters Storing local variables Handling registers without interference Returning

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction

Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction E I P CPU isters Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Topics Assembly Programmer

More information