CPU Organization and Assembly Language

Similar documents
Instruction Set Architecture (ISA)

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

CHAPTER 7: The CPU and Memory

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Computer Organization and Architecture

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Chapter 2 Logic Gates and Introduction to Computer Architecture

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

LSN 2 Computer Processors

Central Processing Unit (CPU)

Instruction Set Design

Instruction Set Architecture

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

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

PROBLEMS. which was discussed in Section

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Chapter 5, The Instruction Set Architecture Level


Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

An Overview of Stack Architecture and the PSC 1000 Microprocessor

picojava TM : A Hardware Implementation of the Java Virtual Machine

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

Administrative Issues

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

MACHINE ARCHITECTURE & LANGUAGE

Faculty of Engineering Student Number:

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Processor Architectures

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

(Refer Slide Time: 00:01:16 min)

1 Classical Universal Computer 3

İSTANBUL AYDIN UNIVERSITY

Chapter 7D The Java Virtual Machine

Microprocessor and Microcontroller Architecture

Summary of the MARIE Assembly Language

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

Chapter 5 Instructor's Manual

CISC, RISC, and DSP Microprocessors

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

The Central Processing Unit:

Traditional IBM Mainframe Operating Principles

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

CPU Organisation and Operation

Introducción. Diseño de sistemas digitales.1

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

Computer Systems Design and Architecture by V. Heuring and H. Jordan

Chapter 2 - Computer Organization

EECS 427 RISC PROCESSOR

8085 INSTRUCTION SET

EE361: Digital Computer Organization Course Syllabus

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Week 1 out-of-class notes, discussions and sample problems

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Computer Organization and Components

Notes on Assembly Language

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

Microprocessor or Microcontroller?

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

PART B QUESTIONS AND ANSWERS UNIT I

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

Basic Computer Organization

Computer Architectures

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

CS 152 Computer Architecture and Engineering. Lecture 22: Virtual Machines

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

(Cat. No L3) Product Data

ARM Architecture. ARM history. Why ARM? ARM Ltd developed by Acorn computers. Computer Organization and Assembly Languages Yung-Yu Chuang

Design Cycle for Microprocessors

ARM Microprocessor and ARM-Based Microcontrollers

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Microprocessor & Assembly Language

M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

In the Beginning The first ISA appears on the IBM System 360 In the good old days

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

1 The Java Virtual Machine

MACHINE INSTRUCTIONS AND PROGRAMS

High level code and machine code

Number Representation

CPU Sim 3.1: A Tool for Simulating Computer Architectures for CS3 classes

Computer organization

Introduction to RISC Processor. ni logic Pvt. Ltd., Pune

Property of ISA vs. Uarch?

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Intel 8086 architecture

A SystemC Transaction Level Model for the MIPS R3000 Processor

Computer Architecture Basics

Systems I: Computer Organization and Architecture

Microprocessor/Microcontroller. Introduction

Guide to RISC Processors

How To Write Portable Programs In C

Chapter 2 Assemblers

VLIW Processors. VLIW Processors

Transcription:

COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015

Outline 1 2 3 4 5 6 7 8

Homework and announcements Reading: Chapter 12 Homework: exercises at end of Chapter 12 (online); due 10/14 Slides: online Prelim I: 7 October! Detailed questions possible on material up through RAID Conceptual questions on material up to/including today s lecture

The central processing unit () Recall: control rest of computer All instructions (processing) done here Three parts: registers, ALU, control unit (CU) Today: organization Controlling the : and assembly

All s have at least some registers: counter (IC) Also called program counter (PC) Address of next instruction program status word (PSW): status bits/flags instruction register (IR): holds instruction during decoding Data registers for program s use Likely differ on how many others, what they are used for, etc.

Register design issues: protected or user-accessible? Want to protect the machine, other processes from current process PSW: protect (usually) IC: generally protected, but... special instructions to change it (branch, subroutine call, etc.) IR: protected Data registers: accessible via many instructions

Register design issues: general- or special-purpose? General-purpose flexibility Special-purpose reduce #, size of operands, maybe optimize speed Mixed: some general-, some special-purpose

Other register design issues Size maybe different for different purposes Combining using multiple registers as single register Responsibility for saving on interrupt hardware or software?

instructions: pattern of bits that cause to perform an operation set: all instructions machine can perform determines capabilities, API of comprises the machine of

execution Fetch instruction IR Decode instruction Fetch operands (if any) Perform instruction Store results (if any)

format: fields: sub of bits that have meaning op code field with unique patterns of bits specifying operations small in early computers, 1 3 bytes in Intel operands: specify data operated on by instruction 0 or more/instruction operand field may refer to different kinds of operands: in the instruction, in a register, in memory,... Other fields addressing mode, operand size specification, hints to about branch likelihood,...

Assembly very difficult for humans to use prone to coding errors Assembly : Human-readable machine (from 1950s on) Usually one-to-one relation to machine instructions Op codes represented by mnemonics: e.g., ADD instead of a bitstring Operands: often symbolic as well, decimal numbers, etc. Addresses within program: symbols (tags, labels) Assembler: program that translates assembly program object code (machine )

Abstraction Assembly : some abstraction Place within abstraction hierarchy:

of instructions Data transfer Arithmetic Logical Control transfer System control

Data transfer instructions Move data Source, destination: registers, memory Different addressing possible Transfer size: often a word could be byte could be enormous

Arithmetic instructions ALU carries out instructions Virtually all s: addition, subtraction, multiplication, division Signed integers, usually also floating point Often have to move data to location expected by ALU e.g., register Question: why have subtraction, etc., when you can do it all with addition?

Logical instructions Usually: and, or, not, xor, equal, shift, rotate, arithmetic shift Sometimes: operate on particular bits via a mask Questions: What about taking the complement? Can you do this with not? With xor? How would you use a mask to clear bits? How would you use a mask to set bits?

Control transfer instructions Branch (or jump) instructions Unconditional, conditional Absolute, relative, base register Subroutine call/return

System control instructions Protected operations: only accessed when processor is in a special kernel mode kernel mode: for OS Access protected registers, memory, etc. I/O instructions: usually in this class, too

How many instructions should a have? One philosophy: have only a few, simple instructions s can be optimized Simpler/fewer less chip space needed Implemented closer to CU, ALU faster RISC reduced instruction set computers Typically have many (hundreds) of registers Examples: SPARC, PowerPC

How many instructions should a have? Another philosophy: Large number of instructions Include special-purpose instructions (e.g., for multimedia) Easier for programmers Less memory, disk space needed CISC complex instruction set computers Example: Intel processor family

RISC or CISC? Advantages of RISC: register-based instructions use registers as cache for cache/memory simple, optimized instructions single instruction size very, very fast Advantages of pure CISC: ease of use may optimize in hardware some common tasks Modern s: CISC machines with some RISC-like features Pipelining, predictive execution: reduce RISC s advantages

of data Numbers Integers sign-magnitude, 2 s complement, packed decimal Floating point numbers (single, double) Character data: ASCII, Unicode, EBCDIC codes Strings: usually OS- or -level abstractions Logical data Blocks, general bit strings e.g., for multimedia

Operand fields describe operands Address mode: determines where actual operand lives (its effective address) Specified: As special in other fields Implicitly, by selection of particular opcode Modes include: immediate, direct, indirect, register, register indirect, displacement, others Issues: How many bits required for instruction? How many memory references required fetch/store actual operand

Immediate addressing Immediate mode: operand present in instruction itself E.g., ADD #5,loca might mean add 5 to whatever is in loca Typically a fixed-length field in the instruction Usually just for 2 s complement or characters Advantages: need only a few bits (usually) to describe operand no additional memory reference neeed to fetch operand

Direct addressing Direct mode: operand lives in a memory location Operand field in instruction: address of real operand E.g., ADD #5,1024: Add 5 to whatever is stored in address 1024 Bits needed for operand field? varies by computer up to size of word often less: restricted range, relative to some base address

Direct addressing Memory references needed: 1 2 3 Mem 4 Data Address Busses

Indirect addressing Indirect mode: operand field contains not the effective address, but the address where that is stored E.g., ADD #5, @8; if 8 contains the 24, then this means add 5 to the contents of 24. 48 44 40 36 32 28 24 20 16 12 8 4 0 1010 24

Indirect addressing Number of memory references needed: 2 1 4 5 3 6 7 Mem 8 Data Address Busses

Register addressing Operand is a register Operand field contains the register number... although... sometimes no operand: register implicit in opcode E.g., ADD #5,r4: add 5 to register 4 Few bits needed for operand field(s) RISC machines: heavy users of register addressing (maybe force for all) No need to fetch from/store to memory

Register indirect addressing: Register contains address of the operand, not the operand E.g., ADD #5,@r4: if reg. 4 contains 1024, then 5 is added to that memory location Number of bits for operand field? Same as register addressing But need a memory access to fetch the effective address Question: when would you use this?

Other addressing Relative displacement addressing: jump relative to program counter Base register displacement addressing: set a base register all specified addresses are added to this effective address

set design Which operations to include? I/O instructions or memory-mapped I/O? RISC or CISC, or mixed? Format of instructions? size: part of word, word, multiple words...? Same sized instructions? Fields within instruction? Same format for all instructions? Address which, and how to specify? # of registers Address granularity?