Ellen Spertus MCS 111 October 16, 2001 Review. 2 What you will learn this semester Given devices that implement simple boolean functions… Understand how.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 5: MIPS Instruction Set
The University of Adelaide, School of Computer Science
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
ECE 232 L6.Assemb.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 6 MIPS Assembly.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
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.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 4 Assembly Language Programming 2.
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.
The University of Adelaide, School of Computer Science
Informationsteknologi Saturday, September 29, 2007 Computer Architecture I - Class 41 Today’s class More assembly language programming.
ENEE350 Spring07 1 Ankur Srivastava University of Maryland, College Park Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005.”
Computer Structure - The Instruction Set (2) Goal: Implement Functions in Assembly  When executing a procedure (function in C) the program must follow.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Lecture 7: MIPS Instruction Set Today’s topic –Procedure call/return –Large constants Reminders –Homework #2 posted, due 9/17/
Arithmetic for Computers
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Computer Architecture Instruction Set Architecture Lynn Choi Korea University.
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.
1 Branches and Procedure Calls Lecture 14 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Procedure (Method) Calls Ellen Spertus MCS 111 September 25, 2003.
Lecture 4: MIPS Instruction Set
Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003.
CSCI 6307 Foundation of Systems Review: Midterm Exam Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Assembly language: arithmetic and load/store instructions Ellen Spertus MCS 111 September 17, 2002.
1 Lecture 10: Floating Point, Digital Design Today’s topics:  FP arithmetic  Intro to Boolean functions.
Boolean Algebra Binary Arithmetic August 28, 2001 Ellen Spertus MCS 111.
Logic Design / Processor and Control Units Tony Diep.
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
1 Signed Arithmetic Logical Operations Ellen Spertus MCS 111 October 1, 2002.
COMPUTER ORGANIZATION LECTURE 3: ISA YASSER MOHAMMAD.
1 Review Ellen Spertus MCS 111 December 3, Bedichek follow-up Guests –Rob Bedichek –Annie Warren Bedichek
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2003 Topic4: Procedures José Nelson Amaral.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 12 Procedure Calling.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002.
Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 3 Arithmetic For.
CSCI206 - Computer Organization & Programming
Lecture 5: Procedure Calls
Lecture 6: Assembly Programs
Computer Architecture Instruction Set Architecture
Lecture 7: MARS, Computer Arithmetic
Lecture 4: MIPS Instruction Set
ELEN 468 Advanced Logic Design
Procedures (Functions)
Procedures (Functions)
CSCI206 - Computer Organization & Programming
CSCI206 - Computer Organization & Programming
Instructions - Type and Format
MIPS Procedures.
Review.
Solutions Chapter 2.
ECE232: Hardware Organization and Design
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
MIPS Functions.
Review.
Lecture 5: Procedure Calls
Review.
Computer Instructions
Computer Architecture
Presentation transcript:

Ellen Spertus MCS 111 October 16, 2001 Review

2 What you will learn this semester Given devices that implement simple boolean functions… Understand how a computer works –Build an actual computer that you will program –Study the MIPS architecture Write assembly language programs Learn the implementation of a MIPS subset August 28 (Boolean Algebra and Binary Arithmetic)

3 Boolean algebra Two values: –0 / false / low / ground –1 / true / high / power Functions –One input: identity, not –Two input: and, or, xor nand, nor August 28 (Boolean Algebra and Binary Arithmetic)

4 Base-2 (binary) arithmetic Uses the two numbers from 0 to 1 Every column represents a power of 2 August 28 (Boolean Algebra and Binary Arithmetic)

5 Count on your fingers! How high can you count with –5 fingers? –10 fingers? August 28 (Boolean Algebra and Binary Arithmetic)

6 Homework 1 (Boolean algebra and binary numbers)

7 From switches to functions We can build switches. We can build and and not gates from switches. We can build from and and not gates. Therefore, August 30 (Digital Computing)

8 Digital computing ~1940 Boolean logic –true/false –and, or, etc. Electronic switches –electromagnetic relays –vacuum tubes Binary numbers August 30 (Digital Computing) Claude Shannon ( ) Konrad Zuse ( )

9 Big Picture Any number can be represented as 0s and 1s Functions can be represented as a table Any table of 0s and 1s can be interpreted as a truth table Any truth table can be converted into a boolean function We can implement boolean functions with switches September 4 (Karnaugh Maps)

10 Karnaugh Maps What purpose do they serve?

11 Rules for Karnaugh maps Label each axis with a gray code, i.e., only change one bit at a time. Regions can stretch horizontally or vertically. Each side of a region must be a power of 2 (e.g., 1, 2, or 4). For simplest formula, choose ________ region and make use of “don’t care”s. Regions may wrap around the edges. September 4 (Karnaugh Maps)

12 Big Picture Any number can be represented as 0s and 1s. Any table of 0s and 1s can be interpreted as a truth table. We can implement boolean functions with switches. Any truth table can be converted into a boolean function.  September 4 (Karnaugh Maps)

13 Types of logic Combinational logic –No loops –Output only depends on current inputs Sequential logic –Loops –Output depends on current inputs and past state –Can implement memory September 13, 18 (Combinational Logic)

14 R-S latch September 13, 18 (Combinational Logic)

15 RS-latch dangerous transition 1  01  0 1  01  0 0 0  0 0  September 13, 18 (Combinational Logic)

16 D-latch Prevents dangerous transition. September 13, 18 (Combinational Logic)

17 D-latch behavior September 13, 18 (Combinational Logic) When E is _____, Q = D. Otherwise, Q keeps its old value.

18 D flip-flop Passes data through on rising edge of clock. September 13, 18 (Combinational Logic)

19 Clocks Most computers have a “clock” that generates a “square wave” Clock cycle time is measured in seconds Clock frequency is measured in Hertz (cycles per second) Example –Clock cycle time:.1 s –Clock frequency: 10 Hz September 13, 18 (Combinational Logic)

20 Common prefixes giga- (G): billion (10 9 ) mega- (M): million (10 6 ) kilo- (K or k): thousand (10 3 ) milli (m): one-thousandth (10 -3 ) micro (  ): one-millionth (10 -6 ) nano (n): one-billionth (10 -9 ) September 13, 18 (Combinational Logic)

21 Converting time to frequency 210 ns = 2.1  10 2 ns (cycle time of IBM PC) = 2.1  10 2  s = 2.1  s frequency = 1/(2.1  ) Hz = 1/(2.1)  10 7 Hz .5  10 7 Hz  5  10 6 Hz  5 MHz (actually, 4.77 MHz) September 13, 18 (Combinational Logic)

22 Counter (Lab 1B) D flip-flop –Remembers current counter value –Acts as a barrier for the counter value September 13, 18 (Combinational Logic)

23 Big picture September 20 (Assembly Language)

24 Data storage and use Registers –32 locations –Each 32 bits wide –Can operate on them directly: add, sub, slt, … sll, srl beq, bne, … mul not, and, or Main memory (RAM) –Millions of locations –Each 8 bits (1 byte) wide –Cannot operate on them directly lw loads word from memory into register sw stores word from register into memory September 20 (Assembly Language)

25 Storing words in bytes Little-endian The “little end” (least significant byte) is stored first in memory. Big-endian The “big end” (most significant byte) is stored first in memory. September 20 (Assembly Language)

26 Scalars vs. arrays Scalar variable –Single item, e.g., count –Takes up one word of memory Array –Many items, e.g., a[0]…a[7] –Each element takes up one word of memory September 27 (Arrays and Loops)

27 Rules for accessing arrays The array is stored somewhere in memory. Put the address of the base (beginning) of the array into a register. Assuming each element of the array is one word (4 bytes) long, the offset (distance from base) of element n is 4*n. September 27 (Arrays and Loops)

28 Procedure calls Caller 200: add $a0, $zero, 3 204: add $a1, $zero, 6 208: jal sum 212:... Callee sum: 500: add $v0, $a0, $a1 504: jr $ra Program counter (PC): Return address ($ra): October 2 (Procedure Calls)

29 Factorial fact: # Store callee-saved values subi $sp, $sp, 8 # create space on stack for two items sw $ra, 4($sp) # store $ra (return address) on stack sw $a0, 0($sp) # store $a0 (n) on stack bne $a0, $zero, else_clause # if (n>0) goto else_clause # Base case addi $v0, $zero, 1 # prepare to return the value 1 addi $sp, $sp, 8 # return stack pointer to its original value jr $ra # return to caller else_clause: subi $a0, $a0, 1 # n = n - 1 jal fact # make recursive call lw $ra, 4($sp) # restore $ra from stack lw $a0, 0($sp) # restore $a0 from stack addi $sp, $sp, 8 # return stack pointer to its original value mult $v0, $v0, $a0 # multiply fact(n-1)*n jr $ra # return to caller Note: Save any values that you may need later onto the stack. October 2 (Procedure Calls)

30 Representations of numbers What’s the point? Homework 6 (Beyond positive integers)

31 Conversion to two’s complement To negate a number –Flip the bits –Add one Practice Homework 6 (Beyond positive integers) ±

32 Conversion from two’s complement To negate a number –Flip the bits –Add one Practice Homework 6 (Beyond positive integers) ±

33 Signed instructions Assume that memory location 50 contains the value 150 ten ( two ) lb $t0, 50($zero) lbu $t1, 50($zero) slt $t2, $t0, $t1 sltu $t3, $t0, $t1 Homework 6 (Beyond positive integers)

34 Upper-case letters Representations: –Characters A – Z –ASCII decimal 65 – 90 –ASCII binary – Homework 6 (Beyond positive integers)

35 upperCase (1) # if argument < ‘A’, return 0 slti $t0, $a0, 65# ‘A’ beq $t0, $zero, lab1 add $v0, $zero, $zero jr $ra lab1: # Return whether argument <= ‘Z’ slti $t0, $a0, 91# ‘Z’ + 1 add $v0, $t0, $zero jr $ra Homework 6 (Beyond positive integers)

36 upperCase (2) srl $t0, $a0, 5# shift right 5 li $t1, 2# load 2 beq $t0, $t1, yes# compare to 2 li $v0, 0# return false jr $ra yes: li $v0, 1# return true jr $ra Homework 6 (Beyond positive integers)

37 Floating-point numbers Representation (October 9) –Sign bit –Significand –Exponent Addition (October 11) –How to –Overflow, underflow –Limited precision

38 Summary Using nothing more than a bunch of ____________, we can perform computations on: positive and negative integers fractions characters –MIPS assembly instructions –Java programs