COMP3221: Microprocessors and Embedded Systems

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
INSTRUCTION SET ARCHITECTURES
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
05/03/2009CA&O Lecture 8,9,10 By Engr. Umbreen sabir1 Computer Arithmetic Computer Engineering Department.
COE Computer Organization & Assembly Language
COMP3221: Microprocessors and Embedded Systems--Lecture 7 1 COMP3221: Microprocessors and Embedded Systems Lecture 7: Arithmetic and logic Instructions.
COMP3221: Microprocessors and Embedded Systems--Lecture 7 1 COMP3221: Microprocessors and Embedded Systems Lecture 7: Arithmetic and logic Instructions.
COMP3221: Microprocessors and Embedded Systems--Lecture 8 1 COMP3221: Microprocessors and Embedded Systems Lecture 8: Program Control Instructions
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
Memory - Registers Instruction Sets
COMP3221: Microprocessors and Embedded Systems--Lecture 4 1 COMP3221: Microprocessors and Embedded Systems Lecture 4: Number Systems (II)
COMP3221: Microprocessors and Embedded Systems
COMP3221: Microprocessors and Embedded Systems--Lecture 9 1 COMP3221: Microprocessors and Embedded Systems Lecture 9: Data Transfer Instructions
Overview of Microprocessors
Design and Synthesis of a RISC Stored-Program Machine
CSE378 MIPS ISA1 MIPS History MIPS is a computer family –R2000/R3000 (32-bit); R4000/4400 (64-bit); R8000; R10000 (64-bit) etc. MIPS originated as a Stanford.
INSTRUCTION SET OF MICROPROCESSOR 8085
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
COMP2011 Assembly Language Programming and Introduction to WRAMP.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
CSC 3210 Computer Organization and Programming Chapter 8 MACHINE INSTRUCTIONS D.M. Rasanjalee Himali.
CSE378 Instr. encoding.1 Instruction encoding The ISA defines –The format of an instruction (syntax) –The meaning of the instruction (semantics) Format.
Computer Architecture EKT 422
Differences in ISA Instruction length
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Instruction cycle.
EEL5708/Bölöni Lec 8.1 9/19/03 September, 2003 Lotzi Bölöni Fall 2003 EEL 5708 High Performance Computer Architecture Lecture 5 Intel 80x86.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
COMP3221: Microprocessors and Embedded Systems--Lecture 10 1 COMP3221: Microprocessors and Embedded Systems Lecture 10: Shift and Bit-set Instructions.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
Universal College Of Engineering & Technology UCET 1/27.
“ INSTRUCTIONS SET OF AVR MICROCONTROLLER ” SIGMA INSTITUTE OF ENGINEERING Prepared By: SR.NO NAME OF STUDENT ENROLLMENT 1 Abhishek Lakhara
COMP2121: Microprocessors and Interfacing
CPU Organisation & Operation
A Closer Look at Instruction Set Architectures
ELE2MIC Friday Lecture Venue Change
Morgan Kaufmann Publishers
COMP2121: Microprocessors and Interfacing
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures: Expanding Opcodes
COMP3221: Microprocessors and Embedded Systems
Instruction Formats Each instruction consists of two parts:
THE sic mACHINE CSCI/CMPE 3334 David Egle.
CSCI206 - Computer Organization & Programming
1 Overview of Microprocessors A. Parveen. 2 Lecture overview Introduction to microprocessors Instruction set architecture Typical commercial microprocessors.
MIPS History MIPS is a computer family
COMP3221: Microprocessors and Embedded Systems
MIPS History MIPS is a computer family
MIPS Assembly.
University of Gujrat Department of Computer Science
Instruction encoding The ISA defines Format = Encoding
Evolution of ISA’s ISA’s have changed over computer “generations”.
What is Computer Architecture?
Instruction encoding The ISA defines Format = Encoding
Introduction to Microprocessor Programming
What is Computer Architecture?
What is Computer Architecture?
Evolution of ISA’s ISA’s have changed over computer “generations”.
Instruction encoding The ISA defines Format = Encoding
MIPS History MIPS is a computer family
COMP3221: Microprocessors and Embedded Systems
Review In last lecture, done with unsigned and signed number representation. Introduced how to represent real numbers in float format.
CSE378 Introduction to Machine Organization
Presentation transcript:

COMP3221: Microprocessors and Embedded Systems Lecture 5: Instruction Format http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Overview Instruction format AVR instruction format examples PowerPC instruction format examples COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Instruction Formats Instructions typically consist of Opcode (Operation code) – defines the operation (e.g. addition) Operands – what’s being operated on (e.g. particular registers or memory address) There are many different formats for instructions COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Instruction Formats OpCode OpCode Opd OpCode Opd1 Opd2 OpCode Opd1 Opd2 Opd3 Instructions typically have 0, 1, 2 or 3 operands – Could be memory addresses, constants, register addresses (i.e. register numbers) COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 AVR Instruction Examples Clear register. Syntax: clr Rd Operand: 0  d  31 Operation: Rd ← 0 Instruction format. 0 0 1 0 0 1 d d d d d d d d d d 15 – OpCode uses 6 bits (bit 9 to bit 15). – The only operand uses the remaining 10 bits (only 5 bits (bit 0 to bit 4) are actually needed). COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 AVR Instruction Examples Subtraction with carry. Syntax: sbc Rd, Rr Operation: Rd ← Rd – Rr – C Rd: Destination register. 0  d  31 Rr: Source register. 0  r  31 C: Carry Instruction format. 0 0 0 0 1 0 r d d d d d r r r r 15 – OpCode uses 6 bits (bit 9 to bit 15). – Two operands share the remaining 10 bits. COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Instruction Lengths On some machines – instructions are all the same length On other machines – instructions can have different lengths COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 AVR Instruction Examples Almost all instructions are 16 bits long. – add Rd, Rr – sub Rd, Rr – mul Rd, Rr – brge k Few instructions are 32 bits long. – lds Rd, k ( 0  k  65535 ) loads 1 byte from the SRAM to a register. COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Design Criteria for Instruction Formats 1. Backwards Compatibility e.g. Pentium 4 supports various instruction lengths so as to be compatible with 8086 2. Instruction Length Ideally (if you’re starting from scratch) All instructions same length Short instructions are better (less memory needed to store programs and can read instructions in from memory faster) COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Instruction Design Criteria (cont.) 3. Room to express operations 2n operations needs at least n bits Wise to allow room to add additional opcodes for next generation of CPU 4. Number of operand bits in instruction Do you address bytes or words? COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 OpCode  Operand Tradeoffs Instructions can tradeoff number of OpCode bits against number of operand bits Example: 16 bit instructions 16 registers (i.e. 4-bit register addresses) Instructions could be formatted like this: But what if we need more instructions and some instructions only operate on 0, 1 or 2 registers? OpCode Operand1 Operand2 Operand3 COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Expanding OpCodes Some OpCodes can mean “look elsewhere in the instruction for the real OpCode” e.g. if first 4 bits are 1111, OpCode is really contained in next 4 bits (i.e. effectively an 8 bit OpCode), and so on COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 Expanding OpCodes Other combinations are possible Exercise (two minutes) For a 16 bit instruction machine with 16 registers, design OpCodes that allow for 14 3-operand instructions 30 2-operand instructions 30 1-operand instructions 32 0-operand instructions COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 PowerPC Examples 1 1 PowerPC ISA defines OpCode as the first six bits This specifies type of instruction (operation) OpCode specifies format of the rest of the instruction COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 PowerPC Machine Instruction Example 1 32 bits OpCode 6 bits 1 Destination Register 5 bits 1 Source Register 5 bits 1 16 bits Value (2’s complement) 1 OpCode (001110two or 14) tells us that this instruction is an integer addition: destination-register = source-register + value r5 = r12 + (-1) COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 PowerPC Machine Instruction Example 2 6 bits OpCode 1 11 bits 1 Secondary OpCode 1 OpCode (111111two or 63) tells us this is a double precision floating point instruction But it does not tell us what it actually does! We need to look at a Secondary OpCode COMP3221: Microprocessors and Embedded Systems--Lecture 5

COMP3221: Microprocessors and Embedded Systems--Lecture 5 PowerPC Machine Instruction Example 2 5 bits Destination Register 1 5 bits Source Registers A & B 1 1 1 Secondary OpCode Secondary OpCode (42) tells us this is a double precision floating point addition destination-reg = register-A + register-B fr13 = fr26 + fr6 COMP3221: Microprocessors and Embedded Systems--Lecture 5