CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.

Slides:



Advertisements
Similar presentations
CH10 Instruction Sets: Characteristics and Functions
Advertisements

INSTRUCTION SET ARCHITECTURES
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Lecture 14: Review Intro to IT COSC1078 Introduction to Information Technology Lecture 14 Revision and Review James Harland
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
The processor and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
The central processing unit and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
What is an instruction set?
Lecture 13 - Introduction to the Central Processing Unit (CPU)
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Instruction Set Architecture
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Chapter 4 The Von Neumann Model
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
Introduction to Computer Engineering CS/ECE 252, Fall 2009 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin – Madison.
Computer Architecture And Organization UNIT-II General System Architecture.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor.
Computer Architecture and Organization
Today’s topics Architecture overview Architecture overview Machine instructions Machine instructions Instruction Execution Cycle Instruction Execution.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Computer Architecture EKT 422
Computer Organization 1 Instruction Fetch and Execute.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
COMPUTER ORGANISATION Sri.S.A.Hariprasad Sr.Lecturer R.V.C.E Bangalore.
Stored Program A stored-program digital computer is one that keeps its programmed instructions, as well as its data, in read-write,
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Dale & Lewis Chapter 5 Computing components
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Chapter 4 The Von Neumann Model
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
Control Unit Lecture 6.
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
CS149D Elements of Computer Science
CSCI206 - Computer Organization & Programming
The Von Neumann Model Basic components Instruction processing
Chapter 5: Computer Systems Organization
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
MARIE: An Introduction to a Simple Computer
ECEG-3202 Computer Architecture and Organization
Introduction to Microprocessor Programming
The Stored Program Computer
Information Representation: Machine Instructions
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Chapter 10 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
Presentation transcript:

CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming

CEG 320/520: Computer Organization and Assembly Language Programming2 Assembly Language Programming CPU –ALU –Registers –Control logic Memory –Organization –Cache –Virtual Memory I/O –Organization of an I/O device –Polled, Interrupt driven, DMA Computer Organization CPU Memory I/O High level code Assembly code Compiler Machine code Assembler CPU We will write assembly language code, and assemble it into machine code. We will examine in detail how the CPU executes that code. &

CEG 320/520: Computer Organization and Assembly Language Programming3 Computer Organization Very Brief Introduction

CEG 320/520: Computer Organization and Assembly Language Programming4 Intro to Computer Organization: Goals General –Basic types of computer operations Instruction cycle –Fetch-execute-store cycle Data Representation –Binary, hex, 2’s complement Memory organization –Big Endian vs Little Endian –BYTE, WORD, LONG WORD –How memory is addressed in the Registers –Defining feature of a Von Neumann machine –Register size and how bits are numbered in the Reading: –General Computer Organization: HVZ Chapter 1, 7.1, 7.2 –Memory: HVZ Chapter 2.2

CEG 320/520: Computer Organization and Assembly Language Programming5 Intro to Computer Organization: Von Neumann The Von Neumann model of computer processing –Stored Program: Program and data are both stored as sequences of bits in the computer’s memory. –The program is executed one instruction at a time under the direction of the control unit. The instruction-execution cycle –Instruction Fetch (IF) stage Get next instruction from the memory address in the program counter (PC) Place the new instruction in the Instruction Register (IR) Increment the PC to the next instruction address –Execute operation (EX) stage Execute the operation specified by the machine instruction in the IR –Branch instructions may update the PC –Repeat

CEG 320/520: Computer Organization and Assembly Language Programming6 Intro to Computer Organization: Instructions Machine-level instructions either move data and/or addresses, or do simple math or logic operations on data and/or addresses. –Data and/or addresses can be moved to or from memory, and in and out of CPU registers. –Addresses are really just a special type of data. There are three basic types of computer instructions –Arithmetic Instructions: operate on values stored in memory or registers Arithmetic, Shift, and Logic instructions –Move Instructions: move data between memory and registers Load/Store instructions Move/Copy portions of memory –Branch Instructions: select one of two possible next instructions to execute Branch on condition, Unconditional branch (Jump)

CEG 320/520: Computer Organization and Assembly Language Programming7 Intro to Computer Organization: Data Representation Binary –Any unsigned whole number can be represented in base 2 (binary) as a string of 1’s and 0’s. –A binary number can be thought of as a series of “bits” (binary digits), each of which can have the value 1 or 0: 4-bit example: = 5 10 –Range of representation N-bit binary numbers represent the range of numbers from 0 … 2 n-1 4-bit binary numbers represent 0 … +16. –There are 10 kinds of people in the world: those who understand binary and those who don’t.

CEG 320/520: Computer Organization and Assembly Language Programming8 Intro to Computer Organization: Data Representation Hexadecimal –Easier and more compact for humans to view, write, and understand. –There is a one-to one mapping from binary to hexadecimal (hex), where each 4 bits represents one hexadecimal digit. Example: = 53B 16 –For this reason, computer memory and register contents are usually shown in hex. Note: base is generally indicated only when it is not obvious from context.

CEG 320/520: Computer Organization and Assembly Language Programming9 Intro to Computer Organization: Data Representation 2’s Complement - Signed number representation –Positive numbers: Sign (leftmost) bit = 0. Magnitude: binary representation of number. –Negative numbers: Sign (leftmost) bit = 1. Magnitude: complement binary representation to form 1’s complement, then add 1. –Range of Representation: For n-bit 2’s complement, range of numbers that may be represented is -2 n-1 … 2 n-1 – 1. 4-bit 2’s complement represents numbers -8 … +7.

CEG 320/520: Computer Organization and Assembly Language Programming10 Intro to Computer Organization: Data Representation 2’s Complement - Why? –Only one representation for ‘0’ Signed magnitude: 00 (positive 0) or 10 (negative 0) 1’s complement: 00 (positive 0) or 10 (negative 0) 2’s complement: 00 –Arithmetic is simplified Addition is performed identically for positive and negative numbers Carry generated by adding sign bits can be thrown away

CEG 320/520: Computer Organization and Assembly Language Programming11 Intro to Computer Organization: Data Representation 2’s Complement – Hexadecimal –Converting a 2’s complement number to a hexadecimal representation merely involves breaking up the 2’s complement representation into 4-bit binary chunks, and converting those to hexadecimal. –Don’t get fancy! Don’t convert the 2’s complement to unsigned binary then convert that to hexadecimal! You will get the wrong value. 2’s complement: Hexadecimal: C 28 A 9

CEG 320/520: Computer Organization and Assembly Language Programming12 Intro to Computer Organization: Memory Most basic operation: getting information from memory to the CPU and back. Conceptually, computer memory is simply a collection of locations where information can be stored as bits. Most often, memory is byte-addressable. This means it is divided into bytes (8-bit quantities) each identified by a unique address. Generally, bytes are addressed sequentially, beginning with address 0.

CEG 320/520: Computer Organization and Assembly Language Programming13 Intro to Computer Organization: Memory Each byte has its own address.

CEG 320/520: Computer Organization and Assembly Language Programming14 Intro to Computer Organization: Memory A WORD is the basic unit of information –Most CPU operations take place using words –The word-length is the amount of information retrieved in a single memory access. It is usually easiest to think of memory as a collection of words Pentium – 32-bit words Motorola – 16-bit words – 32-bit words Dec Alpha – 64-bit words

CEG 320/520: Computer Organization and Assembly Language Programming15 Intro to Computer Organization: Memory Note that 16-bit word addresses are all divisible by 2. The word at address n contains the bytes at addresses n and n+1. –Big Endian addressing: left byte is considered at address n. (makes sense to look at) –Little Endian: the opposite is true. (easy to get the low-order byte of a word)

CEG 320/520: Computer Organization and Assembly Language Programming16 Intro to Computer Organization: Memory The Motorola memory addressing: –Memory is divided into 16-bit words, each having a unique even address (0,2,4…). –Bytes are addressed using the Big Endian scheme. –A long word is a 32-bit value which can begin at any word address.

CEG 320/520: Computer Organization and Assembly Language Programming17 Intro to Computer Organization: Registers Registers are temporary storage locations –Much faster than memory (10–100×) –Inside the CPU, gated directly to components –Special registers: program counter (PC), instruction register (IR), memory address register (MAR), memory data register (MDR) Data is typically transferred to a register before operating on it, then results are stored back to memory. Motorola –Eight data registers named D0-D7 –Eight address registers named A0-A7 A7 is a special register - the stack pointer (SP) –Program Counter (PC) –Status Register (SR)

CEG 320/520: Computer Organization and Assembly Language Programming18 Data registers are 32 bits wide. –Operations on data registers can be performed on BYTE, WORD, or LONG word values. Registers are accessed like Little Endian memory –WORD operations use only bits –BYTE operations use only bits 7-0. Address registers are 32 bits wide. –Only WORD and LONG word operations can be performed on address registers. –The uses just 24-bits to address memory, but we will always consider addresses to be LONG words … … Intro to Computer Organization: Registers

CEG 320/520: Computer Organization and Assembly Language Programming19 Intro to Computer Organization: You Should Know General –Basic types of computer operations Instruction cycle –Fetch-execute-store cycle Data Representation –Binary, hex, 2’s complement Memory organization –Big Endian vs Little Endian –BYTE, WORD, LONG WORD –How memory is addressed in the Registers –Defining feature of a Von Neumann machine –Register size and how bits are numbered in the Reading: –General Computer Organization: HVZ Chapter 1, 7.1, 7.2 –Memory: HVZ Chapter 2.2