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

Презентация:



Advertisements
Похожие презентации
Lecture # Computer Architecture Computer Architecture = ISA + MO ISA stands for instruction set architecture is a logical view of computer system.
Advertisements

CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Introduction and Addressing Modes.
HPC Pipelining Parallelism is achieved by starting to execute one instruction before the previous one is finished. The simplest kind overlaps the execution.
Chapter 6 Digital Arithmetic: Operations and Circuits ECE 221 Intro. Digital Systems Fall Semester 2002 ECE Department, UMASS-Amherst Prof. Hill Prof.
UNIT 2. Introduction to Computer Programming. COM E 211: Basic Computer Programming UNIT 2. Introduction to Computer Programming Algorithm & Flowcharting.
Sequences Sequences are patterns. Each pattern or number in a sequence is called a term. The number at the start is called the first term. The term-to-term.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Building a Simple Ethernet Network Understanding How an Ethernet LAN Works.
The 8085 is an 8-bit general purpose microprocessor that can address 64K Byte of memory. It has 40 pins and uses +5V for power. It can run at a maximum.
Linear Block Codes Mahdi Barhoush Mohammad Hanaysheh.
1/27 Chapter 9: Template Functions And Template Classes.
© 2002 IBM Corporation Confidential | Date | Other Information, if necessary © Wind River Systems, released under EPL 1.0. All logos are TM of their respective.
Operators and Arithmetic Operations. Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands.
The Law of Demand The work was done by Daria Beloglazova.
A Bill is a proposal for a new law, or a proposal to change an existing law that is presented for debate before Parliament. Bills are introduced in either.
Basic Input - Output. Output functions printf() – is a library function that displays information on-screen. The statement can display a simple text message.
In mathematics, the notion of permutation is used with several slightly different meanings, all related to the act of permuting (rearranging) objects.
Computers are a necessary part of modern life. Computers play an important role in the lives of most of us today, whether we realize it or not. Some people,
© 2009 Avaya Inc. All rights reserved.1 Chapter Two, Voic Pro Components Module Two – Actions, Variables & Conditions.
Flynns Architecture. SISD (single instruction and single data stream) SIMD (single instruction and multiple data streams) MISD (Multiple instructions.
Name: Yogesh Mehla Website: Phone:
Транксрипт:

CEG 320/520: Computer Organization and Assembly Language Programming1 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, 2s 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 computers 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 1s and 0s. –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 dont.

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 2s 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 1s complement, then add 1. –Range of Representation: For n-bit 2s complement, range of numbers that may be represented is -2 n-1 … 2 n-1 – 1. 4-bit 2s complement represents numbers -8 … +7.

CEG 320/520: Computer Organization and Assembly Language Programming10 Intro to Computer Organization: Data Representation 2s Complement - Why? –Only one representation for 0 Signed magnitude: 00 (positive 0) or 10 (negative 0) 1s complement: 00 (positive 0) or 10 (negative 0) 2s 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 2s Complement – Hexadecimal –Converting a 2s complement number to a hexadecimal representation merely involves breaking up the 2s complement representation into 4-bit binary chunks, and converting those to hexadecimal. –Dont get fancy! Dont convert the 2s complement to unsigned binary then convert that to hexadecimal! You will get the wrong value. 2s 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, 2s 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