1 Lecture 15: Recap Today’s topics:  Recap for mid-term.

Slides:



Advertisements
Similar presentations
Lecture 13: Sequential Circuits
Advertisements

1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Lecture 5: MIPS Instruction Set
The University of Adelaide, School of Computer Science
Lecture 9: MIPS Instruction Set
The MIPS 32 1)Project 1 Discussion? 1)HW 2 Discussion? 2)We want to get some feel for programming in an assembly language - MIPS 32 We want to fully understand.
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
Lecture 6: MIPS Instruction Set Today’s topic –Control instructions –Procedure call/return 1.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
The University of Adelaide, School of Computer Science
Computer Architecture CSCE 350
1 Nested Procedures Procedures that don't call others are called leaf procedures, procedures that call others are called nested procedures. Problems may.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
The University of Adelaide, School of Computer Science
Apr. 12, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 6: Branching and Procedures in MIPS* Jeremy R. Johnson Wed. Apr. 12, 2000.
Procedure call frame: Hold values passed to a procedure as arguments
1 Lecture 9: Floating Point Today’s topics:  Division  IEEE 754 representations  FP arithmetic Reminder: assignment 4 will be posted later today.
ENEE350 Spring07 1 Ankur Srivastava University of Maryland, College Park Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005.”
Intro to Computer Architecture
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
1 Lecture 15: Recap Today’s topics:  Recap for mid-term Reminders:  no class Thursday  office hours on Monday (10am-4pm)  mid-term Tuesday (arrive.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
1 Lecture 26: Recap Announcements:  Assgn 9 (and earlier assignments) will be ready for pick-up from the CS front office later this week  Office hours:
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
1 Lecture 14: FSM and Basic CPU Design Today’s topics:  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/24  will cover Chapters.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
1 Lecture 10: FP, Performance Metrics Today’s topics:  IEEE 754 representations  FP arithmetic  Evaluating a system Reminder: assignment 4 due in a.
Lecture 7: MIPS Instruction Set Today’s topic –Procedure call/return –Large constants Reminders –Homework #2 posted, due 9/17/
MIPS function continued. Recursive functions So far, we have seen how to write – A simple function – A simple function that have to use the stack to save.
Lecture 9: Floating Point
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 7: MIPS Instructions III
Lecture 19: 11/7/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
COSC 2021: Computer Organization Instructor: Dr. Amir Asif Department of Computer Science York University Handout # 3: MIPS Instruction Set I Topics: 1.
Procedure (Method) Calls Ellen Spertus MCS 111 September 25, 2003.
Lecture 4: MIPS Instruction Set
Computer Architecture CSE 3322 Lecture 4 crystal.uta.edu/~jpatters/cse3322 Assignments due 9/15: 3.7, 3.9, 3.11.
CSCI 6307 Foundation of Systems Review: Midterm Exam Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
1 Lecture 10: Floating Point, Digital Design Today’s topics:  FP arithmetic  Intro to Boolean functions.
Ellen Spertus MCS 111 October 16, 2001 Review. 2 What you will learn this semester Given devices that implement simple boolean functions… Understand how.
Computer Architecture CSE 3322 Lecture 4 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/10/09
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
COMPUTER ORGANIZATION LECTURE 3: ISA YASSER MOHAMMAD.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 12 Procedure Calling.
1 Lecture 13: Sequential Circuits, FSM Today’s topics:  Sequential circuits  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/20.
Lecture 5: Procedure Calls
Lecture 6: Assembly Programs
Lecture 7: MARS, Computer Arithmetic
Lecture 9: Floating Point
Lecture 14: Recap Today’s topics: Recap for mid-term
Lecture 4: MIPS Instruction Set
Procedures (Functions)
Procedures (Functions)
Lecture 8: Binary Multiplication & Division
Lecture 10: Floating Point, Digital Design
Assembly Programming using MIPS R3000 CPU
Lecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division
Lecture 13: Sequential Circuits, FSM
Lecture 4: MIPS Instruction Set
Lecture 13: Sequential Circuits, FSM
ECE232: Hardware Organization and Design
The University of Adelaide, School of Computer Science
Lecture 5: Procedure Calls
Review.
Chapter 2 Instructions: Language of the Computer part 2
Lecture 6: Assembly Programs
Assembly Programming using MIPS R3000 CPU
Computer Architecture
MIPS function continued
Presentation transcript:

1 Lecture 15: Recap Today’s topics:  Recap for mid-term

2 Modern Trends Historical contributions to performance:  Better processes (faster devices) ~20%  Better circuits/pipelines ~15%  Better organization/architecture ~15% Today, annual improvement is closer to 20%; this is primarily because of slowly increasing transistor count and more cores. Need multi-thread parallelism to boost performance every year.

3 Performance Measures Performance = 1 / execution time Speedup = ratio of performance Performance improvement = speedup -1 Execution time = clock cycle time x CPI x number of instrs Program takes 100 seconds on ProcA and 150 seconds on ProcB Speedup of A over B = 150/100 = 1.5 Performance improvement of A over B = 1.5 – 1 = 0.5 = 50% Speedup of B over A = 100/150 = 0.66 (speedup less than 1 means performance went down) Performance improvement of B over A = 0.66 – 1 = = -33% or Performance degradation of B, relative to A = 33% If multiple programs are executed, the execution times are combined into a single number using AM, weighted AM, or GM

4 Performance Equations CPU execution time = CPU clock cycles x Clock cycle time CPU clock cycles = number of instrs x avg clock cycles per instruction (CPI) Substituting in previous equation, Execution time = clock cycle time x number of instrs x avg CPI If a 2 GHz processor graduates an instruction every third cycle, how many instructions are there in a program that runs for 10 seconds?

5 Power Consumption Dyn power  activity x capacitance x voltage 2 x frequency Capacitance per transistor and voltage are decreasing, but number of transistors and frequency are increasing at a faster rate Leakage power is also rising and will soon match dynamic power Power consumption is already around 100W in some high-performance processors today

6 Basic MIPS Instructions lw $t1, 16($t2) add $t3, $t1, $t2 addi $t3, $t3, 16 sw $t3, 16($t2) beq $t1, $t2, 16 blt is implemented as slt and bne j 64 jr $t1 sll $t1, $t1, 2 Convert to assembly: while (save[i] == k) i += 1; i and k are in $s3 and $s5 and base of array save[] is in $s6 Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit:

7 Registers The 32 MIPS registers are partitioned as follows:  Register 0 : $zero always stores the constant 0  Regs 2-3 : $v0, $v1 return values of a procedure  Regs 4-7 : $a0-$a3 input arguments to a procedure  Regs 8-15 : $t0-$t7 temporaries  Regs 16-23: $s0-$s7 variables  Regs 24-25: $t8-$t9 more temporaries  Reg 28 : $gp global pointer  Reg 29 : $sp stack pointer  Reg 30 : $fp frame pointer  Reg 31 : $ra return address

8 Memory Organization Stack Dynamic data (heap) Static data (globals) Text (instructions) Proc A’s values Proc B’s values Proc C’s values … High address Low address Stack grows this way $fp $sp $gp

9 Procedure Calls/Returns procA { int j; j = …; call procB(j); … = j; } procB (int j) { int k; … = j; k = …; return k; } procA: $s0 = … # value of j $t0 = … # some tempval $a0 = $s0 # the argument … jal procB … … = $v0 procB: $t0 = … # some tempval … = $a0 # using the argument $s0 = … # value of k $v0 = $s0; jr $ra

10 Saves and Restores Caller saves:  $ra, $a0, $t0, $fp Callee saves:  $s0 procA: $s0 = … # value of j $t0 = … # some tempval $a0 = $s0 # the argument … jal procB … … = $v0 procB: $t0 = … # some tempval … = $a0 # using the argument $s0 = … # value of k $v0 = $s0; jr $ra As every element is saved on stack, the stack pointer is decremented

11 Example 2 int fact (int n) { if (n < 1) return (1); else return (n * fact(n-1)); } fact: addi $sp, $sp, -8 sw $ra, 4($sp) sw $a0, 0($sp) slti $t0, $a0, 1 beq $t0, $zero, L1 addi $v0, $zero, 1 addi $sp, $sp, 8 jr $ra L1: addi $a0, $a0, -1 jal fact lw $a0, 0($sp) lw $ra, 4($sp) addi $sp, $sp, 8 mul $v0, $a0, $v0 jr $ra Notes: The caller saves $a0 and $ra in its stack space. Temps are never saved.

12 Recap – Numeric Representations Decimal = 3 x x 10 0 Binary = 1 x x x 2 0 Hexadecimal (compact representation) 0x 23 or 23 hex = 2 x x (decimal)  0-9, a-f (hex) Dec Binary Hex Dec Binary Hex Dec Binary Hex a b Dec Binary Hex c d e f

13 2’s Complement two = 0 ten two = 1 ten … two = two = two = -(2 31 – 1) two = -(2 31 – 2) … two = two = -1 Note that the sum of a number x and its inverted representation x’ always equals a string of 1s (-1). x + x’ = -1 x’ + 1 = -x … hence, can compute the negative of a number by -x = x’ + 1 inverting all bits and adding 1 This format can directly undergo addition without any conversions! Each number represents the quantity x x x … + x x 0 2 0

14 Multiplication Example Multiplicand 1000 ten Multiplier x 1001 ten Product ten In every step multiplicand is shifted next bit of multiplier is examined (also a shifting step) if this bit is 1, shifted multiplicand is added to the product

15 Division 1001 ten Quotient Divisor 1000 ten | ten Dividend ten Remainder At every step, shift divisor right and compare it with current dividend if divisor is larger, shift 0 as the next bit of the quotient if divisor is smaller, subtract to get new dividend and shift 1 as the next bit of the quotient

16 Division 1001 ten Quotient Divisor 1000 ten | ten Dividend    Quo: At every step, shift divisor right and compare it with current dividend if divisor is larger, shift 0 as the next bit of the quotient if divisor is smaller, subtract to get new dividend and shift 1 as the next bit of the quotient

17 Divide Example Divide 7 ten ( two ) by 2 ten (0010 two ) IterStepQuotDivisorRemainder 0Initial values Rem = Rem – Div Rem < 0  +Div, shift 0 into Q Shift Div right Same steps as Same steps as Rem = Rem – Div Rem >= 0  shift 1 into Q Shift Div right Same steps as

18 Binary FP Numbers decimal = ? Binary 20 decimal = binary 0.45 x 2 = 0.9 (not greater than 1, first bit after binary point is 0) 0.90 x 2 = 1.8 (greater than 1, second bit is 1, subtract 1 from 1.8) 0.80 x 2 = 1.6 (greater than 1, third bit is 1, subtract 1 from 1.6) 0.60 x 2 = 1.2 (greater than 1, fourth bit is 1, subtract 1 from 1.2) 0.20 x 2 = 0.4 (less than 1, fifth bit is 0) 0.40 x 2 = 0.8 (less than 1, sixth bit is 0) 0.80 x 2 = 1.6 (greater than 1, seventh bit is 1, subtract 1 from 1.6) … and the pattern repeats … Normalized form = … x 2 4

19 IEEE 754 Format Final representation: (-1) S x (1 + Fraction) x 2 (Exponent – Bias) Represent ten in single and double-precision formats Single: ( ) …000 Double: ( ) …000 What decimal number is represented by the following single-precision number? …

20 FP Addition Consider the following decimal example (can maintain only 4 decimal digits and 2 exponent digits) x x Convert to the larger exponent: x x 10 1 Add x 10 1 Normalize x 10 2 Check for overflow/underflow Round x 10 2 Re-normalize

21 Boolean Algebra A B C E (A. B. C) + (A. C. B) + (C. B. A) Can also use “product of sums” Any equation can be implemented with an array of ANDs, followed by an array of ORs A + B = A. B A. B = A + B Any truth table can be expressed as a sum of products

22 Adder Implementations Ripple-Carry adder – each 1-bit adder feeds its carry-out to next stage – simple design, but we must wait for the carry to propagate thru all bits Carry-Lookahead adder – each bit can be represented by an equation that only involves input bits (a i, b i ) and initial carry-in (c 0 ) -- this is a complex equation, so it’s broken into sub-parts For bits a i, b i,, and c i, a carry is generated if a i.b i = 1 and a carry is propagated if a i + b i = 1 C i+1 = g i + p i. C i Similarly, compute these values for a block of 4 bits, then for a block of 16 bits, then for a block of 64 bits….Finally, the carry-out for the 64 th bit is represented by an equation such as this: C 4 = G 3 + G 2.P 3 + G 1.P 2.P 3 + G 0.P 1.P 2.P 3 + C 0.P 0.P 1.P 2.P 3 Each of the sub-terms is also a similar expression

23 32-bit ALU Source: H&P textbook

24 Control Lines What are the values of the control lines and what operations do they correspond to? Ai Bn Op AND OR Add Sub SLT NOR Source: H&P textbook

25 State Transition Table Problem description: A traffic light with only green and red; either the North-South road has green or the East-West road has green (both can’t be red); there are detectors on the roads to indicate if a car is on the road; the lights are updated every 30 seconds; a light must change only if a car is waiting on the other road State Transition Table: CurrState InputEW InputNS NextState=Output N 0 0 N N 0 1 N N 1 0 E N 1 1 E E 0 0 E E 0 1 N E 1 0 E E 1 1 N

26 Title Bullet