Information Representation: Machine Instructions

Slides:



Advertisements
Similar presentations
PART 5: (2/2) Processor Internals CHAPTER 15: CONTROL UNIT OPERATION 1.
Advertisements

Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
Chapter 16 Control Unit Operation No HW problems on this chapter. It is important to understand this material on the architecture of computer control units,
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Memory - Registers Instruction Sets
Chapter 16 Control Unit Implemntation. A Basic Computer Model.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Chapter 15 IA 64 Architecture Review Predication Predication Registers Speculation Control Data Software Pipelining Prolog, Kernel, & Epilog phases Automatic.
1 TK6123: COMPUTER ORGANISATION & ARCHITECTURE Prepared By: Associate Prof. Dr Masri Ayob Lecture 6: CPU and Memory (1)
Processor Types And Instruction Sets Barak Perelman CS147 Prof. Lee.
Computer Organization and Architecture
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Processor Structure & Operations of an Accumulator Machine
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
Computer Systems Organization CS 1428 Foundations of Computer Science.
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Chapter 4 MARIE: An Introduction to a Simple Computer.
CPU How It Works. 2 Generic Block Diagram CPU MemoryInputOutput Address Bus Data Bus.
Chapter 8: The Very Simple Computer
Lecture 14 Today’s topics MARIE Architecture Registers Buses
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Machine Instructions.
September 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 2: Implementation of a Simplified Computer Jeremy R. Johnson Wednesday,
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Lecture 15 Microarchitecture Level: Level 1. Microarchitecture Level The level above digital logic level. Job: to implement the ISA level above it. The.
Dale & Lewis Chapter 5 Computing components
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Register Transfer Languages (RTL)
Basic Elements of Processor ALU Registers Internal data pahs External data paths Control Unit.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
GROUP 2 CHAPTER 16 CONTROL UNIT Group Members ๏ Evelio L. Hernandez ๏ Ashwin Soerdien ๏ Andrew Keiper ๏ Hermes Andino.
PART 4: (1/2) Central Processing Unit (CPU) Basics CHAPTER 12: P ROCESSOR S TRUCTURE AND F UNCTION.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Dale Roberts, Lecturer Information.
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.
Control Unit Operations Chapter10:. What is Control Unit (CU)?(1)  Part of a CPU or other device that directs its operation.  Tells the rest of the.
Chapter 10 Control Unit Operation “Controls the operation of the processor”
Processor Organization and Architecture Module III.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Jeremy R. Johnson William M. Mongan
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
BASIC COMPUTER ARCHITECTURE HOW COMPUTER SYSTEMS WORK.
Types of Micro-operation  Transfer data between registers  Transfer data from register to external  Transfer data from external to register  Perform.
The 8085 Microprocessor Architecture
Control Unit Lecture 6.
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Chapter 4 The Von Neumann Model
Micro-Operations A computer executes a program Fetch/execute cycle
William Stallings Computer Organization and Architecture
William Stallings Computer Organization and Architecture 7th Edition
Chapter 15 Control Unit Operation
Computer Architecture
The Processor and Machine Language
CS149D Elements of Computer Science
Morgan Kaufmann Publishers Computer Organization and Assembly Language
MARIE: An Introduction to a Simple Computer
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
William Stallings Computer Organization and Architecture 7th Edition
Chapter 14 Control Unit Operation
William Stallings Computer Organization and Architecture 8th Edition
The 8085 Microprocessor Architecture
Information Representation: Machine Instructions
Computer Operation 6/22/2019.
Presentation transcript:

Information Representation: Machine Instructions Department of Computer and Information Science, School of Science, IUPUI Information Representation: Machine Instructions CSCI 230 Dale Roberts, Lecturer IUPUI droberts@cs.iupui.edu

Review: Computer Organization A Typical Von-Neumann Architecture Example: Input unit Output unit Memory unit Arithmetic and logic unit (ALU) Central processing unit (CPU) Secondary storage unit Control Circuit (ex: PC: Program Counter) ALU Memory I/O CPU

Registers – Program Counter Program Counter (PC) Contains the memory address of the next instruction to be executed. The contents of the program counter are copied to the memory address register before an instruction is fetched from memory. At the completion of the fetched instruction, the control unit updates the program counter to point to the next instruction which is to be fetched.

Registers – Memory Address Register Memory Address Register (MAR) A register located on the central processing unit which is in turn connected to the address lines of the system. This register specifies the address in memory where information can be found and can be also used to point to a memory location where information is to be stored.

Registers – Instruction Register Instruction Register (IR) A register located on the central processing unit which holds the contents of the last instruction fetched. This instruction is now ready to be executed and is accessed by the control unit.

IR Structure The Instruction Register typically has a structure that includes operation code and an optional operand. Everyone calles the operation code an “Opcode” It is up to the manufacturer to determine how many bits comprise an instruction, and which bits store the opcode and operand.

Registers – Memory Buffer Register Memory Buffer Register (MBR) A register located on the central processing unit which is in turn connected to the data lines of the system. The main purpose of this register is to act as an interface between the central processing unit and memory. When the appropriate signal is received by the control unit, the memory location stored in the memory address register is used to copy data from or to the memory buffer register.

Registers - Accumulator Accumulator (ACC) A register located on the central processing unit. The contents can be used by the arithmetic-logic unit for arithmetic and logic operations, and by the memory buffer register. Usually, all results generated by the arithmetic-logic unit end up in the accumulator.

Arithmetic Logic Unit Arithmetic-Logic Unit (ALU) Performs arithmetic operations such as addition and subtraction as well as logical operations such as AND, OR and NOT. Most operations require two operands. One of these operands usually comes from memory via the memory buffer register, while the other is the previously loaded value stored in the accumulator. The results of an arithmetic-logic unit operation is usually transfered to the accumulator.

Memory Memory is made up of a series of zero's (0) and one's (1) called bits or binary. These individual bits are grouped together in lots of eight and are referred to as a byte. Every byte in memory can be accessed by a unique address which identifies its location. The memory in modern computers contains millions of bytes and is often referred to as random-access memory (RAM). Memory interacts with the MAR and MBR to read and write values from memory via a bus.

Fetch/Execute Cycle All computers have an instruction execution cycle. A basic instruction execution cycle can be broken down into the following steps: Fetch cycle Execute cycle

Fetch cycle The illustrated fetch cycle above can be summarized by the following points: PC => MAR MAR => memory => MBR MBR => IR PC incremented

Execute Cycle After the CPU has finished fetching an instruction, the CU checks the contents of the IR and determines which type of execution is to be carried out next. This process is known as the decoding phase. The instruction is now ready for the execution cycle.

Types of Opcodes The actions within the execution cycle can be categorized into the following four groups: CPU - Memory: Data may be transferred from memory to the CPU or from the CPU to memory. CPU - I/O: Data may be transferred from an I/O module to the CPU or from the CPU to an I/O module. Data Processing: The CPU may perform some arithmetic or logic operation on data via the arithmetic-logic unit (ALU). Control: An instruction may specify that the sequence of operation may be altered. For example, the program counter (PC) may be updated with a new memory address to reflect that the next instruction fetched, should be read from this new location.

LOAD ACC, memory The illustrated LOAD operation summarized in the following points: IR [address portion] => MAR MAR => memory => MBR MBR => ACC

ADD ACC, memory The illustrated ADD operation can be summarized in the following points: IR [address portion] => MAR MAR => memory => MBR MBR + ACC => ALU ALU => ACC

xComputer Applet xComputer applet – a java applet that simulates a simple model computer (which is also called xComputer). The model computer is discussed in Chapter 3 of The Most Complex Machine. The xComputer consists of a Central Processing Unit (CPU) and a main memory that holds 1024 sixteen-bit binary numbers. The CPU contains an Arithmetic-Logic Unit (ALU) for performing basic arithmetic and logical computations. It also contains eight registers, which hold binary numbers that are being used directly in the CPU's computations, a Control circuit, which is responsible for supervising the computations that the CPU performs, and a clock, which drives the whole operation of the computer by turning its single output wire on and off.

xComputer Instructions xComputer uses 16 bits per instruction. 6 bits are dedicated to the opcode, leaving 10 bits for the operand. The type of information stored in the operand is dependent on the instruction being executed. A listing of xComputer opcodes can be found at http://www.cs.iupui.edu/~aharris/n301/xMachine.html. The xComputer applet can be run from http://www.cs.iupui.edu/~aharris/n301/alg/tmcm-java-labs/labs/xComputerLab1.html.

Sample Opcodes (12) refers to the contents of address 12 Code Assembly Name Example Description 000000 ADD Add-to-AC ADD 12 AC = AC + (12) 000001 SUB Subtract-from-AC SUB 12 AC = AC – (12) 000010 AND Logical-AND-with-AC AND 12 Bitwise AND with (12) 000011 OR Logical-OR-with-AC OR 12 Bitwise OR with (12) 000100 NOT Logical-NOT-of-AC Bitwise NOT of AC. Parm ignored. 000101 SHL Shift-AC-Left shift left 1 bit 000110 SHR Shift-AC-Right shift right 1 bit 000111 INC Increment-AC AC++ 001000 DEC Decrement-AC AC-- (12) refers to the contents of address 12

Semantic Gap Machine languages: Native tongue of a particular kind of computer. Each instruction is a binary string. The code is used to indicate operations to be performed and the memory cells to be addressed. This form is the easiest form for computers to understand, but is the most difficult for a person to understand. Assembly languages: Again, specific to one type of computer. Uses descriptive names for operations and data, e.g. “LOAD value”, “ADD delta”, “Store value”. Assemblers translate this to machine language. Intermediate level. Somewhat descriptive, but basically follow the machine instructions. High-level languages: Write program instructions called statements that resemble a limited version of English. e.g. “value = value + delta”. Portable, meaning it can be used on different types of computers without modification. Compilers translate them to machine languages. Example are Fortran, Pascal, COBOL, C, C++, Basic, etc. Semantic gap between statements in a high-level language and machine/assembly language. Each high level statement may represent many hundreds of machine instructions. Compilers must bridge this gap. Complex machine instruction computer try to reduce this gap by implementing high-level language opcodes. This diminishes the semantic gap but makes the machine instructions more complex, and therefore makes the CPU circuitry more complex.

Real-life Example: Pentium 4. The instruction set information for the Pentium 4 process can be found at ftp://download.intel.com/design/Pentium4/manuals/24547112.pdf.

Pentium 4 ADD Description Adds the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. The destination operand can be a register or a memory location; the source operand can be an immediate, a register, or a memory location. (However, two memory operands cannot be used in one instruction.) When an immediate value is used as an operand, it is sign-extended to the length of the destination operand format. The ADD instruction performs integer addition. It evaluates the result for both signed and unsigned integer operands and sets the OF and CF flags to indicate a carry (overflow) in the signed or unsigned result, respectively. The SF flag indicates the sign of the signed result. This instruction can be used with a LOCK prefix to allow the instruction to be executed atomically. Operation DEST ← DEST + SRC; So you can see that the instructions are a little more complicated in real life than in xComputer. But the same principles apply.

Pentium 4 Add (cont)

Acknowledgements Several graphics and terms were obtained from Jonathan Michael Auld Central Queensland University. xComputer and its machine instructions were developed by David Eck.