# LC-3 Data Structures. Textbook chapter 10

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 LC-3 Data Structures Textbook chapter 10

2 LC-3 data structures Abstract data structures are Defined by the rules for inserting and extracting data In this section, we will talk about The array The stack Arithmetic using a stack CMPE12 Summer

3 The array data structure Array: A list of values arranged sequentially in memory and grouped under a single name In C, the expression a[4] refers to the 5th element of the array a Most assembly languages have only basic concept of arrays (.blkw in LC-3) E.g., a list of integers starting at 5 number[0] = 5; number[1] = 6; number[2] = 7; number[3] = 8; CMPE12 Summer

4 Properties of arrays Each element is the same size (i.e. same type) Elements are stored contiguously First element is located at the lowest memory address In assembly language we must Allocate correct amount of space for an array Map array addresses to memory addresses E.g., myarray.blkw 5 CMPE12 Summer

5 What is a pointer? A pointer is an address of a variable in memory It s just an address Lets the programmer use indirect addressing Indirectly address variables Base of an array is the pointer to the first element Wait, what? myarray.blkw 5 What happens when LEA R2, myarray? CMPE12 Summer

6 Array example myarray.blkw 5 LEA R2, myarray LDR R0, R2, #0 STR R0, R2, #2 CMPE12 Summer

7 Multi-dimensional arrays? How do you represent a checkerboard? The problem: memory is linear One-dimensional CMPE12 Summer

8 Multi-dimensional arrays Consider two rows Array elements are sublabeled with their row and column A: 2 rows (numbered 0 and 1) A: 4 columns (numbered 0 to 3) In array A: A02 is the 0 th row and 2 nd column How do you map this onto a linear structure? A A00 A01 A02 A03 1 A10 A11 A12 A13 CMPE12 Summer

9 Array memory mappings Row major Read down the row first Column major Read down the column first CMPE12 Summer

10 Array representation: Row major A x3100 x3101 x x3103 x3104 x x3106 x3107 CMPE12 Summer

11 Array representation: Column major A x3100 x3101 x x3103 x3104 x x3106 x3107 CMPE12 Summer

12 FIFO (Standard queue) FIFO is first in, first out Standard queue (waiting in line) FRONT SHOES CMPE12 Summer

13 LIFO (Standard stack) LIFO is last in, first out Sometimes called FILO, first in, last out Standard stack TOP CMPE12 Summer

14 Example: LIFO and FIFO (LIFO) Stack: (FIFO) Queue: A, B, C C, B, A D, E, F D, E, F C F B E A D CMPE12 Summer

15 The stack data structure Stack structure is LIFO (last in, first out) Basic pieces of stack Stack itself Top of stack Two basic stack operations Push: Put data on top of stack Pop: Remove top element from stack CMPE12 Summer

16 Stack overflow and underflow Trying to pop from empty stack Underflow Trying to push onto full stack Overflow CMPE12 Summer

17 Stack overflow R1 R0 TOP.. push R0 push R1.. CMPE12 Summer

18 Stack underflow.. pop R0 pop R1. TOP. CMPE12 Summer

19 A coin holder as a stack CMPE12 Summer

20 A hardware stack Implemented in hardware (i.e., with registers) Previous data entries move up to accommodate each new data entry Note that the Top Of Stack is always in the same place CMPE12 Summer

21 Stacks in hardware and software Implemented in hardware with registers Previous data entries move up to accommodate each new data entry Implemented in software with code, in memory Stack pointer points to the top (empty) element Stack grows from high (0xffff) to low (0x0000) memory CMPE12 Summer

22 Stack in LC-3 In LC-3 The stack pointer moves as new data is entered R6 acts as the stack pointer (the TOS register) CMPE12 Summer

23 PUSH in LC-3 Write data to top empty location of stack Top of stack is pointed to by stack pointer (SP) Decrement stack pointer (stack is moving down in memory) E.g., Assume data to push is in R0 PUSH STR R0, R6, #0 ADD R6, R6, #-1 [R0] R6 CMPE12 Summer

24 POP in LC-3 Increment stack pointer (stack is moving down in memory) Now points to full location Read data from top of stack E.g., Assume data to pop goes into R0 POP ADD R6, R6, #1 LDR R0, R6, #0 R6 CMPE12 Summer

25 Checking for overflow and underflow Before pushing, we have to test for overflow Before popping, we have to test for underflow In both cases, use R5 to report success or failure Flow chart is similar for push and overflow POP CMPE12 Summer

26 When is the stack empty or full? If SP always points to next empty element (next available location to push) Stack overflow when SP = Stack underflow when SP = x3ffa x3ffb x3ffc x3ffd x3ffe x3fff x4000 MAX BASE CMPE12 Summer

27 Stack protocol on LC-3: An example Conventions PUSH pushes R0, returns success in R5 POP pops into R0, returns success in R5 Stack pointer is R6 and points to the top empty element All other used registers need to be calleesaved PUSH and POP should not overwrite any other registers The stack goes from x3fff to x3ffb CMPE12 Summer

28 Stack protocol in LC-3: POP POP ST R2, Save2 ; save, needed by POP ST R1, Save1 ; save, needed by POP LD R1, nbase ; nbase contains -x3fff ADD R1, R1, #-1 ; R1 now has -x4000 ADD R2, R6, R1 ; compare SP to BASE BRz fail_exit ; branch if stack is empty ADD R6, R6, #1 ; adjust stack pointer LDR R0, R6, #0 ; the actual pop BRnzp success_exit CMPE12 Summer

29 Stack protocol in LC-3: PUSH PUSH ST R2, Save2 ; needed by PUSH ST R1, Save1 ; needed by PUSH LD R1, nmax ; nmax has -x3ffb ADD R2, R6, R1 ; compare SP to x3ffb BRz fail_exit ; branch is stack is full STR R0, R6, #0 ; the actual push ADD R6, R6, #-1 ; adjust stack pointer CMPE12 Summer

30 Stack protocol in LC-3: Return values success_exit LD R1, Save1 ; restore registers LD R2, Save2 AND R5, R5, #0 ; R5 <-- success RET fail_exit LD R1, Save1 ; restore registers LD R2, Save2 AND R5, R5, #0 ADD R5, R5, #1 ; R5 <-- fail RET nbase.fill xc001 ; nbase has -x3fff nmax.fill xc005 ; nmax has x3ffb Save1.FILL x0000 Save2.FILL x0000 CMPE12 Summer

31 Stack as an alternative to registers Three-address vs zero-address The LC-3 explicitly specifies the location of each operand: it is a three-address machine e.g. ADD R0, R1, R2 Some machines use a stack data structure for all temporary data storage: these are zeroaddress machines The instruction ADD would simply pop the top two values from the stack, add them, and push the result back on the stack Some calculators use a stack to do arithmetic, most general purpose microprocessors use a register bank CMPE12 Summer

32 Recommended exercises Read and implement the examples in textbook sections 10.3, 10.4, and 10.5 Ex 10.3, 10.4, 10.5 ok but tedious Ex 10.6 (and 10.7), 10.8, 10.9 CMPE12 Summer

### appendix a The LC-3 ISA

A.1 Overview The Instruction Set Architecture (ISA) of the LC-3 is defined as follows: Memory address space 16 bits, corresponding to 2 16 locations, each containing one word (16 bits). Addresses are numbered

### PROBLEMS (Cap. 4 - Istruzioni macchina)

98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

### CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code

### Unit 5 Central Processing Unit (CPU)

Unit 5 Central Processing Unit (CPU) Introduction Part of the computer that performs the bulk of data-processing operations is called the central processing unit (CPU). It consists of 3 major parts: Register

### PROGRAMMING CONCEPTS AND EMBEDDED PROGRAMMING IN C, C++ and JAVA: Lesson-4: Data Structures: Stacks

PROGRAMMING CONCEPTS AND EMBEDDED PROGRAMMING IN C, C++ and JAVA: Lesson-4: Data Structures: Stacks 1 STACK A structure with a series of data elements with last sent element waiting for a delete operation.

### Data Structures Using C++ 2E. Chapter 7 Stacks

Data Structures Using C++ 2E Chapter 7 Stacks Stacks Data structure Elements added, removed from one end only Last In First Out (LIFO) FIGURE 7-1 Various examples of stacks Data Structures Using C++ 2E

### LC-3 Assembly Language. Programming and tips Textbook Chapter 7

LC-3 Assembly Language Programming and tips Textbook Chapter 7 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program that turns symbols

### DATA STRUCTURES USING C

DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

### LC-3 Assembly Language

LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

### Comp 245 Data Structures. Stacks

Comp 245 Data Structures Stacks What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO random access to other elements within the stack An

### Module 2 Stacks and Queues: Abstract Data Types

Module 2 Stacks and Queues: Abstract Data Types A stack is one of the most important and useful non-primitive linear data structure in computer science. It is an ordered collection of items into which

### LC-3 Assembly Language

LC-3 Assembly Language (Textbook Chapter 7) Assembly and assembler Machine language - binary 0001110010000110 Assembly language - symbolic ADD R6, R2, R6 ; increment index reg. Assembler is a program that

### Common Data Structures

Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees

### Algorithms and Data Structures

Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2

### Central Processing Unit

Central Processing Unit General Register Organization Stack Organization Instruction Formats Addressing Modes Data Transfer and Manipulation Micro Programmed Control Reduced Instruction Set Computer Parallel

### Introduction to Computer Engineering. CS/ECE 252, Spring 2013 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison

Introduction to Computer Engineering CS/ECE 252, Spring 2013 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison Chapter 7 & 9.2 Assembly Language and Subroutines Human-Readable

### Data Structures and Data Manipulation

Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval

### Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine This is a limited version of a hardware implementation to execute the JAVA programming language. 1 of 23 Structured Computer

### Stacks typically used for temporary storage of data Analogous to a stack of paper or a stack of cards Some rules:

A stack is an example of a data structure A method of organising data Defined structure and operations typically used for temporary storage of data Analogous to a stack of paper or a stack of cards Some

### Adapting the PowerPC 403 ROM Monitor Software for a 512Kb Flash Device

Adapting the PowerPC 403 ROM Monitor Software for a 512Kb Flash Device IBM Microelectronics Dept D95/Bldg 060 3039 Cornwallis Road Research Triangle Park, NC 27709 Version: 1 December 15, 1997 Abstract

### MAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) -----------------------------------------

=============================================================================================================================== DATA STRUCTURE PSEUDO-CODE EXAMPLES (c) Mubashir N. Mir - www.mubashirnabi.com

### Data Structure. Lecture 3

Data Structure Lecture 3 Data Structure Formally define Data structure as: DS describes not only set of objects but the ways they are related, the set of operations which may be applied to the elements

### 1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated

### Chapter 3: Restricted Structures Page 1

Chapter 3: Restricted Structures Page 1 1 2 3 4 5 6 7 8 9 10 Restricted Structures Chapter 3 Overview Of Restricted Structures The two most commonly used restricted structures are Stack and Queue Both

### Chapter 4 Lecture 3 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 4 Lecture 3 The Microarchitecture Level Integer JAVA Virtual Machine This is a limited version of a hardware implementation to execute the JAVA programming language. 1 of 30 Review The Data Path

### Chapter 4 Integer JAVA Virtual Machine

Processor Block Diagram Chapter 4 Integer JAVA Virtual Machine 1 of 14 ECE 357 Register Definitions PC MBR MAR MDR SP LV CPP TOS OPC H Program Counter: Access Data in Method Area Memory Branch Register:

### Lecture 4. Announcements:

Announcements: Lecture 4 HW1 posted on Saturday morning. We gave a little over a week. We are going to discuss relevant material over the next two lectures. Lab1 posted. But if you start doing it, you

### Chapter 7 Assembly Language

Revisited: Counting Characters (From Ch 5 & 6) Count the occurrences of a character in a file Remember this? Chapter 7 Assembly Language Count = 0 (R2 = 0) Ptr = 1st file character (R3 = M[x3012]) Input

### DATA STRUCTURE - STACK

DATA STRUCTURE - STACK http://www.tutorialspoint.com/data_structures_algorithms/stack_algorithm.htm Copyright tutorialspoint.com A stack is an abstract data type ADT, commonly used in most programming

### Chapter 7 Assembly Language

Chapter 7 Assembly Language Human-Readable Machine Language Computers like ones and zeros 0001110010000110 Humans like symbols ADD R6,R2,R6 increment index reg. Assembler is a program that turns symbols

### MIPS: The Virtual Machine

2 Objectives After this lab you will know: what synthetic instructions are how synthetic instructions expand to sequences of native instructions how MIPS addresses the memory Introduction MIPS is a typical

### Data Structures Using C++ 2E. Chapter 5 Linked Lists

Data Structures Using C++ 2E Chapter 5 Linked Lists Doubly Linked Lists Traversed in either direction Typical operations Initialize the list Destroy the list Determine if list empty Search list for a given

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### 10CS35: Data Structures Using C

CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

### Chapter 7D The Java Virtual Machine

This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

### Loop Example. CMPE 325 Computer Architecture II. Loop Solution. Loops in C. Improved Loop Solution. Loop Efficiency. Assembly Language (cont)

CMPE 325 Computer rchitecture II Cem Ergün Eastern Mediterranean University ssembly Language (cont) Loop Example Consider the code where array is an integer array with 100 elements Loop: g = g + [i] i

### Assembly Programming: Ch 7. Example LC-3 instruction. Example LC-3 instruction. Example LC-3 instruction. Machine language:

Assembly Programming: Ch 7 Computer Systems Microarchitectures Assembly Programming Input/Output Interfaces Instruction Set Architectures Computing Structures Logic Transistors Bits Is Src2 an immediate?:

### 1 Classical Universal Computer 3

Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

### George M. Georgiou and Brian Strader. California State University, San Bernardino. August 2005

11 0011 101 01 10 111 10 11 0011100 11000 0010 11 010 11 00 0110001 00101 1101 11010 0011011010 10011101 01100101111 001 00 01110 00100 10100101 11101111001110 10001 11 011 0110 0110 101101 0110111110000000110001000000100100101010

### Data Structures Using C++ 2E. Chapter 7 Stacks

Data Structures Using C++ 2E Chapter 7 Stacks Linked Implementation of Stacks Disadvantage of array (linear) stack representation Fixed number of elements can be pushed onto stack Solution Use pointer

### The Java Virtual Machine

The Java Virtual Machine The Java programming language is a high-level language developed by Sun Microsystems, now a wholly owned subsidiary of Oracle, Inc. The Java language is neither interpreted nor

### Data Structures and Algorithms V22.0102. Otávio Braga

Data Structures and Algorithms V22.0102 Otávio Braga We use a stack When an operand is read, output it When an operator is read Pop until the top of the stack has an element of lower precedence Then push

### Chapter 9 Stack and Subroutines

1 Chapter 9 Stack and Subroutines The Stack 2 The stack is an area of memory identified by the programmer for temporary storage of information. The stack is a LIFO structure. Last In First Out. The stack

### DATA STRUCTURE - QUEUE

DATA STRUCTURE - QUEUE http://www.tutorialspoint.com/data_structures_algorithms/dsa_queue.htm Copyright tutorialspoint.com Queue is an abstract data structure, somewhat similar to stack. In contrast to

### Data Structures and Algorithms Stacks and Queues

Data Structures and Algorithms Stacks and Queues Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/23 6-0: Stacks and

### Data Types and Addressing Modes 29

29 This section describes data types and addressing modes available to programmers of the Intel Architecture processors. 29.1 Fundamental Data Types The fundamental data types of the Intel Architecture

### Stacks. Linear data structures

Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

### 2) Write in detail the issues in the design of code generator.

COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

### PIPELINING CHAPTER OBJECTIVES

CHAPTER 8 PIPELINING CHAPTER OBJECTIVES In this chapter you will learn about: Pipelining as a means for executing machine instructions concurrently Various hazards that cause performance degradation in

CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois (modified by Yuan Long) Administrative Issues Required Prerequisites CSc 2010 Intro to CSc CSc 2310 Java Programming

### The stack and the stack pointer

The stack and the stack pointer If you google the word stack, one of the definitions you will get is: A reserved area of memory used to keep track of a program's internal operations, including functions,

### HW7 - Due Fri. Dec 10th

HW7 - Due Fri. Dec 10th Use the "homework8" DropBox in Learn@UW to turn in all your solutions. One copy per group is sufficient, please make sure you include your name and your partner's name in the document

### 4.3 Stacks and Queues. Pushdown Stacks. Data Structures and Data Types. Collections

Data Structures and Data Types 4.3 Stacks and Queues Data types Set values. Set operations on those values. Some are built in to Java: int, double, char,... Most are not: Complex, Picture, Charge, Stack,

### Linked Lists, Stacks, Queues, Deques. It s time for a chainge!

Linked Lists, Stacks, Queues, Deques It s time for a chainge! Learning Goals After this unit, you should be able to... Differentiate an abstraction from an implementation. Define and give examples of problems

### Assembly Language: Function Calls" Jennifer Rexford!

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

### Data Structures 2014

Unit-1 Introduction Short Questions:1. Define data structure. 2. Define algorithm. 3. List out areas in which data structures are applied. 4. List out structure of algorithm. 5. List out properties of

### MIPS Calling Convention

MIPS Calling Convention This document summarizes the calling conventions that we expect you to use in ECE 314 for homework problems and assembly language programming projects. These are the rules for how

### Stacks, Queues and Linked Lists

Stacks, Queues and Linked Lists Adnan Aziz 1 Dynamic sets CLRS Part III, page 197 In mathematics, a set is a well-defined collection of elements (elements could be numbers, functions, geometric shapes);

### W4118 Operating Systems. Junfeng Yang

W4118 Operating Systems Junfeng Yang Outline PC organization x86 instruction set gcc inline assembly and calling conventions PC organization One or more CPUs, memory, and device controllers connected through

### A4-R3: COMPUTER ORGANISATION

A4-R3: COMPUTER ORGANISATION NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF ANSWER

### Lecture 27 C and Assembly

Ananda Gunawardena Lecture 27 C and Assembly This is a quick introduction to working with x86 assembly. Some of the instructions and register names must be check for latest commands and register names.

### MICROPROCESSOR AND MICROCOMPUTER BASICS

Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

### csci 210: Data Structures Stacks and Queues

csci 210: Data Structures Stacks and Queues Summary Topics stacks and queues as abstract data types implementations arrays linked lists analysis and comparison application: searching with stacks and queues

### Quiz for Chapter 2 Instructions: Language of the Computer3.10

Date: 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in Red 1. [5 points] Prior to the early 1980s, machines

### The LC-3. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

The LC-3 University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer

### Local workspace of a subroutine: Recursion and recursive subroutines:

Local workspace of a subroutine: A number of temporary memory locations required by the subroutine for temporary private variables used in addition to available data registers. Recursion and recursive

### Last not not Last Last Next! Next! Line Line Forms Forms Here Here Last In, First Out Last In, First Out not Last Next! Call stack: Worst line ever!

ECE 551 C++ Programming, Data structures, and Algorithms Abstract Data Type: Stack Last In First Out (LIFO) 1 2 2 1 4 3 1 3 4 Stacks in Programming Worst line ever! 5 3 1 5 Stacks are not useful for waiting

### CPU- Internal Structure

ESD-1 Elettronica dei Sistemi Digitali 1 CPU- Internal Structure Lesson 12 CPU Structure&Function Instruction Sets Addressing Modes Read Stallings s chapters: 11, 9, 10 esd-1-9:10:11-2002 1 esd-1-9:10:11-2002

### Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

### Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Overview CISC Developments Over Twenty Years Classic CISC design: Digital VAX VAXÕs RISC successor: PRISM/Alpha IntelÕs ubiquitous 80x86 architecture Ð 8086 through the Pentium Pro (P6) RJS 2/3/97 Philosophy

### CHAPTER 7: The CPU and Memory

CHAPTER 7: The CPU and Memory The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides

### Programming the Basic Computer. lecture 8

Programming the Basic Computer lecture 8 Programming the Basic Computer A computer system includes both hardware and software. Hardware consist of the physical components. Software refers to computer programs.

### Chapter 7. Arrays and Collections. Instructor s Manual Table of Contents. At a Glance. Chapter Overview. Chapter Objectives.

C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-1 Chapter 7 Arrays and Collections At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes

### MIPS Memory Organization

MIPS Memory Organization 1 In addition to memory for static data and the program text (machine code), MIPS provides space for the run-time stack (data local to procedures, etc.) and for dynamically-allocated

### 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

### Section 45. Data Memory with Extended Data Space (EDS)

Section 45. Data Memory with Extended Data Space (EDS) HIGHLIGHTS This section of the manual contains the following topics: 45.1 Introduction... 45-2 45.2 Data Memory Organization... 45-3 45.3 Extended

### Computer Programming using C

Computer Programming using C Lecture 11: Buffers and linked lists: solutions Dr Julian Miller Room P/M/101 Ext 2383; E-mail: jfm@ohm http://www.elec.york.ac.uk/intsys/users/jfm7 Contents Solution to buffers

### TIE-20106 1 TIE-20106 2

TIE-20106 1 1 List structures In this chapter, a few simple data structures (stack and queue) that can be implemented with arrays and/or lists are covered. Two more complex structures based on lists are

### Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

### UNIVERSITI MALAYSIA SARAWAK KOTA SAMARAHAN SARAWAK PSD2023 ALGORITHM & DATA STRUCTURE

STUDENT IDENTIFICATION NO UNIVERSITI MALAYSIA SARAWAK 94300 KOTA SAMARAHAN SARAWAK FAKULTI SAINS KOMPUTER & TEKNOLOGI MAKLUMAT (Faculty of Computer Science & Information Technology) Diploma in Multimedia

### The conceit is that inside the CPU is a tiny man that runs around organising data and performing the calculations. Inside the box of the CPU are:!

Little Man Computer The Little Man Computer is a conceptual model of a simple CPU, introduced by Dr. Stuart Madnick of M.I.T. in 1965. Although it seems simplistic, in fact the model captures many important

### Chapter 5. Processing Unit Design

Chapter 5 Processing Unit Design 5.1 CPU Basics A typical CPU has three major components: Register Set, Arithmetic Logic Unit, and Control Unit (CU). The register set is usually a combination of general-purpose

### Assembly Language Programming: Subroutines

Assembly Language Programming: Subroutines by Alex Milenkovich, milenkovic@computer.org Objectives: Introduce subroutines, subroutine nesting, processor stack, and passing the parameters to subroutines.

### Instructions: Assembly Language

Chapter 2 Instructions: Assembly Language Reading: The corresponding chapter in the 2nd edition is Chapter 3, in the 3rd edition it is Chapter 2 and Appendix A and in the 4th edition it is Chapter 2 and

### Chapter 6 Programming the LC-3

Chapter 6 Programming the LC-3 ased on slides McGraw-Hill Additional material 24/25/26 Lewis/Martin Aside: ooting the Computer How does it all begin? We have LC-3 hardware and a program, but what next?

### Intel 8086 architecture

Intel 8086 architecture Today we ll take a look at Intel s 8086, which is one of the oldest and yet most prevalent processor architectures around. We ll make many comparisons between the MIPS and 8086

### Processing Unit Design

&CHAPTER 5 Processing Unit Design In previous chapters, we studied the history of computer systems and the fundamental issues related to memory locations, addressing modes, assembly language, and computer

### An Introduction to Assembly Programming with the ARM 32-bit Processor Family

An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2

### 1 The Java Virtual Machine

1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

### Chapter 1 Computer System Overview

Operating Systems: Internals and Design Principles Chapter 1 Computer System Overview Eighth Edition By William Stallings Operating System Exploits the hardware resources of one or more processors Provides

### Chapter 17 Recursion

Chapter 17 Recursion What is Recursion? A recursive function is one that solves its task by calling itself on smaller pieces of data. Similar to recurrence function in mathematics. Like iteration -- can

### MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

### 8051 Programming. The 8051 may be programmed using a low-level or a high-level programming language.

8051 Programming The 8051 may be programmed using a low-level or a high-level programming language. Low-Level Programming Assembly language programming writes statements that the microcontroller directly

### 1 Description of The Simpletron

Simulating The Simpletron Computer 50 points 1 Description of The Simpletron In this assignment you will write a program to simulate a fictional computer that we will call the Simpletron. As its name implies

### MACHINE INSTRUCTIONS AND PROGRAMS

CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

### Data Structures. Topic #4

Topic #4 Today s Agenda Stack and Queue ADTs What are they Like Ordered Lists, are position oriented Use of Data Structures for Stacks and Queues arrays (statically & dynamically allocated) linear linked

### CHAPTER 4 ESSENTIAL DATA STRUCTRURES

CHAPTER 4 ESSENTIAL DATA STRUCTURES 72 CHAPTER 4 ESSENTIAL DATA STRUCTRURES In every algorithm, there is a need to store data. Ranging from storing a single value in a single variable, to more complex