Wednesday, February 19, 2014
|
|
- Delphia Allen
- 5 years ago
- Views:
Transcription
1 Wednesda, Februar 19, 2014 Topics for toda Solutions to HW #2 Topics for Eam #1 Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack Stack-relative addressing (,s) SP manipulation Stack as scratch space Global variables and local variables Parameter passing and return values Solutions to Homework #2 1. (a) 360 * 10 * 180 * 10 = Need 23 bits 2 23 = (b) ( 23 * 2 12 * 24 ) / 8 = btes/da.. So, 1 megabte? 2. (a) Smbol Code A ** B ** C *** D *** F *** WU **** I **** (b) (i) 2.57 * 20,000 = 51,400 (ii) 3 * 20,000 = 60,000 Comp 162 Notes Page 1 of 9 Februar 19, 2014
2 3. Machine Code Instruction (he) E C Opcode (binar) Uses register? If so, which Includes addressing mode? If so, which 1110 Yes, X 001 = direct No 000 = immediate Yes, A No F1F2F3 06FC Yes, A 001 = direct No 0 = immediate btes for program (from chapter 4) = btes available for instructions X * X * 3 = X = Largest X is No. Onl if the base is even. Possible topics for Eam #1 include: Simple C programming arras, loops Logical and arithmetic operations Headecimal and octal representation Encoding (including Huffman codes) Number conversion Pep/8 instructions Comp 162 Notes Page 2 of 9 Februar 19, 2014
3 The Pep/8 run-time stack (Section 6.1) The Pep/8 run-time stack is at the high end of the memor allocated to the user (see e.g., Fig. 4.39). This is to minimize the possibilit that the stack runs into the user program as it grows. The stack pointer register (SP) holds the address of the top item of the stack. Stacks in general The stack data structure is sometimes referred to as a Last-in First-out queue (or First-In, Lastout) meaning that the last item put into the stack is the first one to be removed. Think of a stack of books or a stack of plates. The push operation adds an item to the stack (at the top) and the pop operation removes the top item Push 3 Push 7 Pop Push 4 Push 9 Pop Stack in Pep/8 The Pep/8 stack plas a large part in non-trivial assembl code programs - those with function/subroutine calls. The Pep/8 stack is used for: - storing local variables - remembering a return address when a function is called - passing parameters into functions - returning values from functions - scratch space We do not (usuall) need to know the actual memor address of an item in the stack because we can access them using stack-relative addressing. So far, we have seen two of Pep/8 s eight addressing modes: Comp 162 Notes Page 3 of 9 Februar 19, 2014
4 Direct addressing: E.g. lda 3,d ; load contents of address 3 (and 4) into register A Immediate addressing: E.g. lda 3,i ; load the number 3 into register A In section 6.1, Warford introduces the third addressing mode (stack-relative addressing) and shows how the stack is used in providing space for local variables (he uses the eample of the main program function). Stack-relative addressing E.g. lda 3,s loads into register A the word that begins at memor[ SP + 3] that is, loads the word that starts three btes down from the top of the stack If the stack contents are A7 SP E 4C then after the load instruction, register A contains 7E4C. Similarl, loads 1355 into Register X. ld 1,s The number before,s can be negative allowing us to access locations above the stack pointer. There are various reasons wh we might want to do that. Note that the Pep/8 stack grows upwards towards address zero so items that are in the middle of the stack have larger addresses than the item at the top of the stack. You ma have encountered the stack Abstract Data Tpe (ADT) in a data structures class. In the case of the stack ADT we are onl permitted to access the top of the stack using POP and PUSH Comp 162 Notes Page 4 of 9 Februar 19, 2014
5 operations to remove or add items respectivel. At the assembl language level we ma need to be able to quickl access items stored within the stack and stack relative addressing lets us do that. Changing the size of the stack Some instructions (see later) change the size of the stack as a side effect of their actions (think pop and push). In addition, there are two instructions that let us directl manipulate the SP register. Using these two instructions is how we allocate and deallocate space on the stack. ADDSP - add to SP, i.e. move SP awa from zero so make the stack smaller SUBSP - subtract from SP, i.e. move the SP towards zero so make the stack bigger. [Note that Pep/8 does not reall need two instructions. For eample, ] SUBSP 6,i ADDSP -6,i Stack trace question. What does the stack look like after. subsp 5,i lda 09876,i ld 01234,i sta 2,s st 3,s adda 1,i addsp 4,i stbtea -4,s Answer 77?? Preview of stack operations During the course of Chapter 6 we will look at the various was in which the stack is used but here is a preview of some of them don t worr about the details. Comp 162 Notes Page 5 of 9 Februar 19, 2014
6 Stack as scratch space We can use the stack as temporar space without changing SP. In the following code we input three numbers then output them in the reverse order deci -2,s deci -4,s deci -6,s deco -6,s deco -4,s deco -2,s Technicall we are not using the stack but the area above it. This is usuall a prett safe thing to do. Local variables In the following eample C program there are global variables (a,b and c) that can be accessed anwhere variables local to test (p,q and r) that can accessed onl from inside test variables local to main (, and z) that can be accessed onl from inside main. #include <stdio.h> int a,b,c; test() { Int p,q,r; // these are globals // p, q and r are local to test } main () { int,,z; test(); //, and z are local to main // calling test } When a function is called, we have to allocate btes on the stack for its local variables (if an) and adopt some convention about which location corresponds to which variable. For eample, here is how the stack might look as the program runs. On entr to a function (main or test) we allocate space for the local variables. When we eit from the call of a function we deallocate this space. In addition, we have the space for the return address (RA) that lets us return to the correct location in main when we have finished the call of test. Comp 162 Notes Page 6 of 9 Februar 19, 2014
7 z RA z r q p RA z Initiall Main starts Main calls test Test running Test finishes Main resumes End RA z z Consider the following C program #include <stdio.h> int A,B; int main() { int C,D,E; } A = C+D; Ignoring for the moment the fact that main is a function, this might be translated into Pep/8 assembl code as br main A:.block 2 B:.block 2 main: subsp 6,i ; allocate stack spacee for C, D and E lda 4,s ; C adda 2,s ; D sta A,d addsp 6,i stop.end ; end of main so finished with C, D and E At the end of the "main" function it does not reall matter if we deallocate the stack space allocated at the beginning of main because the program is about to terminate. However, in the case of all other functions it is normall criticall important that we tid up the stack before eiting - more later. Here is a summar of the differences between local variables and global variables. Comp 162 Notes Page 7 of 9 Februar 19, 2014
8 Globals Locals Declaration using.block,.word,.bte allocated space on the stack dnamicall Accessibilit anwhere in the program. In theor, onl while appropriate function is active (space goes awa on eit from the function) Referenced b identifier stack-relative addressing Parameter passing and returning values Suppose we have the Pep/8 equivalent of the following C function int functionname (int B, int C) { int D, E; } *** and it is being called as follows W = functionname(p,q) then during the eecution of function A (e.g. at the point marked ***) the topmost locations on the stack can be depicted Space for local variable D Space for local variable E Address to return to when function terminates Value of parameter P Value of parameter Q Space for the value returned b functionname Comp 162 Notes Page 8 of 9 Februar 19, 2014
9 (P and Q could be the other wa round; D and E could be the other wa round). We will look later at man eamples of translations of C functions into Pep/8 (including recursive ones!). The stack is a shared memor location that lets information (parameter values) be passed from main program to subprogram and information (returned value) be passed from subprogram to main program Reading. Section 6.1. We will begin looking at functions (C) and subroutines (Pep/8) net week but Section 6.3 is trick so read slowl. Comp 162 Notes Page 9 of 9 Februar 19, 2014
Monday, September 28, 2015
Monda, September 28, 2015 Topics for toda Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global variables
More informationWednesday, September 27, 2017
Wednesday, September 27, 2017 Topics for today Chapter 6: Mapping High-level to assembly-level The Pep/9 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global
More informationWednesday, February 28, 2018
Wednesday, February 28, 2018 Topics for today C functions and Pep/9 subroutines Introduction Location of subprograms in a program Translating functions (a) Void functions (b) Void functions with parameters
More informationMonday, October 17, 2016
Monday, October 17, 2016 Topics for today C functions and Pep/8 subroutines Passing parameters by reference Globals Locals Reverse Engineering II Representation of Booleans C Functions and Pep/8 Subroutines
More informationMonday, March 9, 2015
Monday, March 9, 2015 Topics for today C functions and Pep/8 subroutines Passing parameters by reference Globals Locals More reverse engineering: Pep/8 to C Representation of Booleans C Functions and Pep/8
More informationMonday, March 6, We have seen how to translate void functions. What about functions that return a value such as
Monday, March 6, 2017 Topics for today C functions and Pep/9 subroutines Translating functions (c) Non-void functions (d) Recursive functions Reverse Engineering: Pep/9 to C C Functions and Pep/9 Subroutines
More informationWednesday, February 15, 2017
Wednesday, February 15, 2017 Topics for today Before and after assembly: Macros, Linkers Overview of Chapter 6 Branching Unconditional Status bits and branching If statements While statements The V and
More informationWednesday, March 12, 2014
Wednesday, March 12, 2014 Topics for today Solutions to HW #3 Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Solutions to Homework #3 1. deci N,d < (a) N not defined lda
More informationMonday, March 13, 2017
Monday, March 13, 2017 Topics for today Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Arrays and indexed addressing (section 6.4) So far we have looked at scalars (int,
More informationCSC 221: Computer Organization, Spring 2009
1 of 7 4/17/2009 10:52 AM Overview Schedule Resources Assignments Home CSC 221: Computer Organization, Spring 2009 Practice Exam 2 Solutions The exam will be open-book, so that you don't have to memorize
More informationMonday, November 7, Structures and dynamic memory
Monday, November 7, 2016 Topics for today Structures Structures and dynamic memory Grammars and Languages (Chapter 7) String generation Parsing Regular languages Structures We have seen one composite data
More informationDEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE-238L: Computer Logic Design Fall 2013.
ECE-8L: Computer Logic Design Fall Notes - Chapter BINARY NUMBER CONVERSIONS DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-b-digit representation of a positive integer number (powers
More informationMonday, February 16, 2015
Monday, February 16, 2015 Topics for today How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and equate Assembler variants: Disassembler, Cross assembler Macros
More informationOptional: Building a processor from scratch
Optional: Building a processor from scratch In this assignment we are going build a computer processor from the ground up, starting with transistors, and ending with a small but powerful processor. The
More informationProgramming Language Dilemma Fall 2002 Lecture 1 Introduction to Compilation. Compilation As Translation. Starting Point
Programming Language Dilemma 6.035 Fall 2002 Lecture 1 Introduction to Compilation Martin Rinard Laborator for Computer Science Massachusetts Institute of Technolog Stored program computer How to instruct
More informationWednesday, September 21, 2016
Wednesday, September 21, 2016 Topics for today More high-level to translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and
More informationWednesday, April
Wednesday, April 9. 2014 Topics for today Addressing mode summary Structures Structures and dynamic memory Grammars and Languages (Chapter 7) String generation Parsing Regular languages Summary of addressing
More informationSolutions - Homework 2 (Due date: February 5 5:30 pm) Presentation and clarity are very important! Show your procedure!
Solutions - Homework (Due date: Februar 5 th @ 5: pm) Presentation and clarit are ver important! Show our procedure! PROBLEM ( PTS) In these problems, ou MUST show our conversion procedure. a) Convert
More informationWednesday, October 17, 2012
Wednesday, October 17, 2012 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Indexed branching Implementation of switch statement Arrays as parameters
More informationMonday, October 24, 2016
Monday, October 24, 2016 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Option A: Space-minimal solution Option B: Iliffe vectors Array bound
More informationExtra-credit QUIZ Pipelining -due next time-
QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.
More informationWednesday, April 19, 2017
Wednesday, April 19, 2017 Topics for today Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming
More informationWednesday, April 22, 2015
Wednesday, April 22, 2015 Topics for today Topics for Exam 3 Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition
More informationWednesday, February 7, 2018
Wednesday, February 7, 2018 Topics for today The Pep/9 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate
More informationWednesday, March 29, Implementation of sets in an efficient manner illustrates some bit-manipulation ideas.
Wednesday, March 29, 2017 Topics for today Sets: representation and manipulation using bits Dynamic memory allocation Addressing mode summary Sets Implementation of sets in an efficient manner illustrates
More informationWednesday, September 20, 2017
Wednesday, September 20, 2017 Topics for today More high-level to Pep/9 translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode
More informationWednesday, April 16, 2014
Wednesday, pril 16, 2014 Topics for today Homework #5 solutions Code generation nalysis lgorithm 4: infix to tree Synthesis lgorithm 5: tree to code Optimization HW #5 solutions 1. lda 0,i ; for sum of
More informationMonday, March 27, 2017
Monday, March 27, 2017 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,
More informationQUIZ. Name all the 4 parts of the fetch-execute cycle.
QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 Solution
More informationy = f(x) x (x, f(x)) f(x) g(x) = f(x) + 2 (x, g(x)) 0 (0, 1) 1 3 (0, 3) 2 (2, 3) 3 5 (2, 5) 4 (4, 3) 3 5 (4, 5) 5 (5, 5) 5 7 (5, 7)
0 Relations and Functions.7 Transformations In this section, we stud how the graphs of functions change, or transform, when certain specialized modifications are made to their formulas. The transformations
More informationMatrix Representations
CONDENSED LESSON 6. Matri Representations In this lesson, ou Represent closed sstems with transition diagrams and transition matrices Use matrices to organize information Sandra works at a da-care center.
More informationWednesday, September 13, Chapter 4
Wednesday, September 13, 2017 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/9 Features of the system Operational cycle Program trace Categories of
More informationWeek 10. Topic 1 Polynomial Functions
Week 10 Topic 1 Polnomial Functions 1 Week 10 Topic 1 Polnomial Functions Reading Polnomial functions result from adding power functions 1 together. Their graphs can be ver complicated, so the come up
More informationSubprograms, Subroutines, and Functions
Subprograms, Subroutines, and Functions Subprograms are also called subroutines, functions, procedures and methods. A function is just a subprogram that returns a value; say Y = SIN(X). In general, the
More informationTopic 2 Transformations of Functions
Week Topic Transformations of Functions Week Topic Transformations of Functions This topic can be a little trick, especiall when one problem has several transformations. We re going to work through each
More informationMonday, April 15, We will lead up to the Analysis and Synthesis algorithms involved by first looking at three simpler ones.
Monday, pril 15, 2013 Topics for today Code generation nalysis lgorithm 1: evaluation of postfix lgorithm 2: infix to postfix lgorithm 3: evaluation of infix lgorithm 4: infix to tree Synthesis lgorithm
More informationCOMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture
COMP 303 Computer Architecture Lecture 3 Comp 303 Computer Architecture 1 Supporting procedures in computer hardware The execution of a procedure Place parameters in a place where the procedure can access
More informationMonday, November 9, 2015
Monday, November 9, 2015 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation - Overview nalysis lgorithm 1: evaluation of postfix lgorithm 2: infix
More informationQUIZ. Name all the 4 parts of the fetch-execute cycle.
QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 QUIZ
More informationCOSC 243. Assembly Language Techniques. Lecture 9. COSC 243 (Computer Architecture)
COSC 243 Assembly Language Techniques 1 Overview This Lecture Source Handouts Next Lectures Memory and Storage Systems 2 Parameter Passing In a high level language we don t worry about the number of parameters
More informationWednesday, March 14, 2018
Wednesday, March 14, 2018 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Option A: Space-minimal solution Option B: Iliffe vectors Array bound
More informationQ1: /20 Q2: /30 Q3: /24 Q4: /26. Total: /100
ECE 2035(B) Programming for Hardware/Software Systems Fall 2013 Exam Two October 22 nd 2013 Name: Q1: /20 Q2: /30 Q3: /24 Q4: /26 Total: /100 1/6 For functional call related questions, let s assume the
More informationWeek 3. Topic 5 Asymptotes
Week 3 Topic 5 Asmptotes Week 3 Topic 5 Asmptotes Introduction One of the strangest features of a graph is an asmptote. The come in three flavors: vertical, horizontal, and slant (also called oblique).
More informationShift and Rotate Instructions
Shift and Rotate Instructions Shift and rotate instructions facilitate manipulations of data (that is, modifying part of a 32-bit data word). Such operations might include: Re-arrangement of bytes in a
More informationWednesday, February 4, Chapter 4
Wednesday, February 4, 2015 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/8 Features of the system Operational cycle Program trace Categories of
More informationCS S-11 Memory Management 1
CS414-2017S-11 Management 1 11-0: Three places in memor that a program can store variables Call stack Heap Code segment 11-1: Eecutable Code Code Segment Static Storage Stack Heap 11-2: Three places in
More informationWednesday, November 15, 2017
Wednesday, November 15, 2017 Topics for today Code generation Synthesis Algorithm 5: tree to code Optimizations Code generation Algorithm 5: generating assembly code Visiting all the nodes in a linked
More informationMonday, April 14, 2014
Monday, April 14, 2014 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation - Overview Analysis Algorithm 1: evaluation of postfix Algorithm 2: infix
More informationLow-level software. Components Circuits Gates Transistors
QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.
More informationWeek 27 Algebra 1 Assignment:
Week 7 Algebra Assignment: Da : p. 494 #- odd, -, 8- Da : pp. 496-497 #-9 odd, -6 Da : pp. 0-0 #-9 odd, -, -9 Da 4: p. 09 #-4, 7- Da : pp. - #-9 odd Notes on Assignment: Page 494: General notes for this
More informationImplementing Subroutines. Outline [1]
Implementing Subroutines In Text: Chapter 9 Outline [1] General semantics of calls and returns Implementing simple subroutines Call Stack Implementing subroutines with stackdynamic local variables Nested
More informationThe Little Man Computer - Interface
The Little Man Computer - Interface 1. Assembly Language goes here 2. Click ʻCompileʼ 3. Instructions appear as 3-digit opcodes here 4. You can RUN the program, watch it run SLOWly or STEP through the
More informationNotes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers)
Comp 104:Operating Systems Concepts Revision Lectures (separate questions and answers) Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects
More information20 Calculus and Structures
0 Calculus and Structures CHAPTER FUNCTIONS Calculus and Structures Copright LESSON FUNCTIONS. FUNCTIONS A function f is a relationship between an input and an output and a set of instructions as to how
More informationLecture 2 8/24/18. Computer Memory. Computer Memory. Goals for today. Computer Memory. Computer Memory. Variables Assignment Sequential Steps
Goals for toda Lecture 2 Variables Assignment Sequential Steps Sequential Steps, Variables, Assignment Computer Memor If we can t remember things, we can t actuall do ver much Computers have memor the
More informationLESSON 3.1 INTRODUCTION TO GRAPHING
LESSON 3.1 INTRODUCTION TO GRAPHING LESSON 3.1 INTRODUCTION TO GRAPHING 137 OVERVIEW Here s what ou ll learn in this lesson: Plotting Points a. The -plane b. The -ais and -ais c. The origin d. Ordered
More information0 COORDINATE GEOMETRY
0 COORDINATE GEOMETRY Coordinate Geometr 0-1 Equations of Lines 0- Parallel and Perpendicular Lines 0- Intersecting Lines 0- Midpoints, Distance Formula, Segment Lengths 0- Equations of Circles 0-6 Problem
More informationComp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers)
Comp 204: Computer Systems and Their Implementation Lecture 25a: Revision Lectures (separate questions and answers) 1 Today Here are a sample of questions that could appear in the exam Please LET ME KNOW
More informationToday s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1
Toda s class Geometric objects and transformations Wednesda, November 7, 27 Computer Graphics - Class 5 Vector operations Review of vector operations needed for working in computer graphics adding two
More informationMonday, February 11, 2013
Monday, February 11, 2013 Topics for today The Pep/8 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate
More informationPart 5,Assembly Language Questions
Part,Assembly Language Questions This study guide is provided as an aid in helping you to study for the ECE Department s 18-4, Fundamentals of Computer Engineering. The guide is a collection of previous
More informationDEEPIKA KAMBOJ UNIT 2. What is Stack?
What is Stack? UNIT 2 Stack is an important data structure which stores its elements in an ordered manner. You must have seen a pile of plates where one plate is placed on top of another. Now, when you
More informationClasses. Compiling Methods. Code Generation for Objects. Implementing Objects. Methods. Fields
Classes Implementing Objects Components fields/instance variables values differ from to usuall mutable methods values shared b all s of a class usuall immutable component visibilit: public/private/protected
More informationCDA 3103 Computer Organization Homework #7 Solution Set
CDA 3103 Computer Organization Homework #7 Solution Set 1 Problems 1. Write a MARIE assembly program for the following algorithm where the subroutine takes two numbers and returns their product. Your assembly
More informationExponential and Logarithmic Functions
Eponential and Logarithmic Functions Figure Electron micrograph of E. Coli bacteria (credit: Mattosaurus, Wikimedia Commons) Chapter Outline. Eponential Functions. Logarithmic Properties. Graphs of Eponential
More informationCopyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Review Topics. parameter passing, memory model)
Final Exam Review Original slides from Gregory Byrd, North Carolina State University Modified slides by C. Wilcox, S. Rajopadhye Colorado State University Review Topics! Number Representation & Arithmetic!
More informationSubroutines. int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;}
Subroutines Also called procedures or functions Example C code: int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;} // subroutine converts Celsius to kelvin int celtokel(int i) { return (i
More informationSaM. 1. Introduction. 2. Stack Machine
SaM 1. Introduction Have you ever heard the Java mantra, write once, run everywhere? So, how does that work? When you compile a Java program, you generate a binary file that contains byte-code. Byte-code
More informationMonday, April 9, 2018
Monday, April 9, 208 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation Overview Finite State Machines (see 7.2) If a language is regular (Type 3)
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationCS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri
CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:
More informationImplementing Procedure Calls
1 / 39 Implementing Procedure Calls February 18 22, 2013 2 / 39 Outline Intro to procedure calls Caller vs. callee Procedure call basics Calling conventions The stack Interacting with the stack Structure
More informationIntroduction to Homogeneous Transformations & Robot Kinematics
Introduction to Homogeneous Transformations & Robot Kinematics Jennifer Ka Rowan Universit Computer Science Department. Drawing Dimensional Frames in 2 Dimensions We will be working in -D coordinates,
More informationEECS1022 Winter 2018 Additional Notes Tracing Point, PointCollector, and PointCollectorTester
EECS1022 Winter 2018 Additional Notes Tracing, Collector, and CollectorTester Chen-Wei Wang Contents 1 Class 1 2 Class Collector 2 Class CollectorTester 7 1 Class 1 class { 2 double ; double ; 4 (double
More informationMonday, October 26, 2015
Monday, October 26, 2015 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,
More informationImplicit differentiation
Roberto s Notes on Differential Calculus Chapter 4: Basic differentiation rules Section 5 Implicit differentiation What ou need to know alread: Basic rules of differentiation, including the chain rule.
More information2.2 Absolute Value Functions
. Absolute Value Functions 7. Absolute Value Functions There are a few was to describe what is meant b the absolute value of a real number. You ma have been taught that is the distance from the real number
More informationCHAPTER ASSEMBLY LANGUAGE PROGRAMMING
CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority
More informationEssential Question: How do you graph an exponential function of the form f (x) = ab x? Explore Exploring Graphs of Exponential Functions. 1.
Locker LESSON 4.4 Graphing Eponential Functions Common Core Math Standards The student is epected to: F-IF.7e Graph eponential and logarithmic functions, showing intercepts and end behavior, and trigonometric
More informationA rubric for programming assignments
Fall 2012 Comp 162 Peter Smith A rubric for programming assignments Generally, half the points for a program assignment are for the Correctness of the program with respect to the specification. The other
More informationCS 403 Compiler Construction Lecture 8 Syntax Tree and Intermediate Code Generation [Based on Chapter 6 of Aho2] This Lecture
CS 403 Compiler Construction Lecture 8 Snta Tree and Intermediate Code Generation [Based on Chapter 6 of Aho2] 1 This Lecture 2 1 Remember: Phases of a Compiler This lecture: Intermediate Code This lecture:
More informationExponential and Logarithmic Functions
Eponential and Logarithmic Functions Figure Electron micrograph of E. Coli bacteria (credit: Mattosaurus, Wikimedia Commons) CHAPTER OUTLINE. Eponential Functions. Logarithmic Properties. Graphs of Eponential
More informationRun-time Environment
Run-time Environment Prof. James L. Frankel Harvard University Version of 3:08 PM 20-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Storage Organization Automatic objects are
More informationGraphing Review. Math Tutorial Lab Special Topic
Graphing Review Math Tutorial Lab Special Topic Common Functions and Their Graphs Linear Functions A function f defined b a linear equation of the form = f() = m + b, where m and b are constants, is called
More informationIntermediate Algebra. Gregg Waterman Oregon Institute of Technology
Intermediate Algebra Gregg Waterman Oregon Institute of Technolog c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More information19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd
19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd Will you walk a little faster? said a whiting to a snail, There s a porpoise close behind us, and he s treading
More informationUsing the same procedure that was used in Project 5, enter matrix A and its label into an Excel spreadsheet:
Math 6: Ecel Lab 6 Summer Inverse Matrices, Determinates and Applications: (Stud sections, 6, 7 and in the matri book in order to full understand the topic.) This Lab will illustrate how Ecel can help
More informationTransformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations
Chapter Transformations of Functions TOPICS.5.. Shifting, reflecting, and stretching graphs Smmetr of functions and equations TOPIC Horizontal Shifting/ Translation Horizontal Shifting/ Translation Shifting,
More informationCredits and Disclaimers
Credits and Disclaimers 1 The eamples and discussion in the following slides have been adapted from a variet of sources, including: Chapter 3 of Computer Sstems 3 nd Edition b Brant and O'Hallaron 86 Assembl/GAS
More informationLecture No.04. Data Structures
Lecture No.04 Data Structures Josephus Problem #include "CList.cpp" void main(int argc, char *argv[]) { CList list; int i, N=10, M=3; for(i=1; i
More informationMAN-522: COMPUTER VISION SET-2 Projections and Camera Calibration
MAN-522: COMPUTER VISION SET-2 Projections and Camera Calibration Image formation How are objects in the world captured in an image? Phsical parameters of image formation Geometric Tpe of projection Camera
More informationMIPS Programming. A basic rule is: try to be mechanical (that is, don't be "tricky") when you translate high-level code into assembler code.
MIPS Programming This is your crash course in assembler programming; you will teach yourself how to program in assembler for the MIPS processor. You will learn how to use the instruction set summary to
More informationThis section provides some reminders and some terminology with which you might not be familiar.
Chapter 3: Functions 3.1 Introduction The previous chapter assumed that all of your Bali code would be written inside a sole main function. But, as you have learned from previous programming courses, modularizing
More informationUNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Computational Science & Engineering
COMP60081 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE M.Sc. in Computational Science & Engineering Fundamentals of High Performance Execution Wednesday 16 th January 2008 Time: 09:45
More informationPart 7. Stacks. Stack. Stack. Examples of Stacks. Stack Operation: Push. Piles of Data. The Stack
Part 7 Stacks The Stack Piles of Data Stack Stack A stack is an abstract data structure that stores objects Based on the concept of a stack of items like a stack of dishes Data can only be added to or
More informationUNIT-II. Part-2: CENTRAL PROCESSING UNIT
Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:
More informationECE251: Tuesday September 11
ECE251: Tuesday September 11 Finish Branch related instructions Stack Subroutines Note: Lab 3 is a 2 week lab, starting this week and covers the Stack and Subroutines. Labs: Lab #2 is due this week. Lab
More informationQuestion 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures
Comp 104: Operating Systems Concepts Revision Lectures Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects you want to know about??? 1
More informationLesson 11 Skills Maintenance. Activity 1. Model. The addition problem is = 4. The subtraction problem is 5 9 = 4.
Lesson Skills Maintenance Lesson Planner Vocabular Development -coordinate -coordinate point of origin Skills Maintenance ddition and Subtraction of Positive and Negative Integers Problem Solving: We look
More information