Microprocessors. Microprocessors and rpeanut. Memory. Eric McCreath

Similar documents
Microprocessors and rpeanut. Eric McCreath

First Semester Examination Introduction to Computer Systems (COMP2300/COMP6300)

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

Typical Processor Execution Cycle

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

In 8086 Carry flag, Parity flag, Auxiliary carry flag, Zero flag, Overflow flag, Trace flag, Interrupt flag, Direction flag, and Sign flag.

What Are The Main Differences Between Program Counter Pc And Instruction Register Ir

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition

Chapter 1: Basics of Microprocessor [08 M]

CPU Structure and Function

Digital System Design Using Verilog. - Processing Unit Design

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Outcomes. Lecture 13 - Introduction to the Central Processing Unit (CPU) Central Processing UNIT (CPU) or Processor

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Hardware Level Organization

Microcomputer Architecture and Programming

From CISC to RISC. CISC Creates the Anti CISC Revolution. RISC "Philosophy" CISC Limitations

CISC324: Operating Systems. Assignment 1

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

The Central Processing Unit

Alternate definition: Instruction Set Architecture (ISA) What is Computer Architecture? Computer Organization. Computer structure: Von Neumann model

Introduction to CPU architecture using the M6800 microprocessor

Computer Architecture Review CS 595

Lecture 4: Instruction Set Architecture

This simulated machine consists of four registers that will be represented in your software with four global variables.

ECE232: Hardware Organization and Design

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

William Stallings Computer Organization and Architecture

A3 Computer Architecture

Processing Unit CS206T

Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack

CSE 410. Operating Systems

Chapter 2 Logic Gates and Introduction to Computer Architecture

Computer System Architecture

Computer Organization II CMSC 3833 Lecture 33

SCRAM Introduction. Philipp Koehn. 19 February 2018

Memory Models. Registers

Instruction Set Architecture of MIPS Processor

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Author : Dalbir Singh, Computer Science Deptt. CPU Structure and Functions. 1. Processor Organization

IT 252 Computer Organization and Architecture. Introduction. Chia-Chi Teng

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

Chapter 02: Computer Organization. Lesson 02: Functional units and components in a computer organization- Part 1: Processor

ECE232: Hardware Organization and Design

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

Class Notes. Dr.C.N.Zhang. Department of Computer Science. University of Regina. Regina, SK, Canada, S4S 0A2


Register Are Two Names For The Same Place

STRUCTURE OF DESKTOP COMPUTERS

Instruction Set Architectures

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Instruction Set Architecture. "Speaking with the computer"

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function

Assembly Language. Lecture 2 x86 Processor Architecture

CISC / RISC. Complex / Reduced Instruction Set Computers

General Purpose Processors

UNIT- 5. Chapter 12 Processor Structure and Function

CS 333 Introduction to Operating Systems. Class 1 - Introduction to OS-related Hardware and Software

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces


Registers. Registers

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

For more notes of DAE

ELC4438: Embedded System Design Embedded Processor

The Stored Program Computer

Programming Model 2 A. Introduction

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

COS 140: Foundations of Computer Science

Representation of Information

Introduction to Microcontrollers

EE 3170 Microcontroller Applications

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

Instruction Set Principles and Examples. Appendix B

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

Basic Processing Unit: Some Fundamental Concepts, Execution of a. Complete Instruction, Multiple Bus Organization, Hard-wired Control,

LC-3 Instruction Set Architecture. Textbook Chapter 5

The MARIE Architecture

Wed. Aug 23 Announcements

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Module 5 - CPU Design

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

LC-3 Instruction Set Architecture

Basics of Microprocessor

Chapter 2 Instruction Set Architecture

MICROPROCESSOR MCQs. 1) What does the microprocessor comprise of? a. Register section b. One or more ALU c. Control unit d.

AVR Microcontrollers Architecture

Chapter 13 Reduced Instruction Set Computers

Instruction Set Architecture

There are four registers involved in the fetch cycle: MAR, MBR, PC, and IR.

CHAPTER 5 A Closer Look at Instruction Set Architectures

Multiple Choice Type Questions

William Stallings Computer Organization and Architecture

The LC-3 Instruction Set Architecture. ISA Overview Operate instructions Data Movement instructions Control Instructions LC-3 data path

Transcription:

Microprocessors Microprocessors and rpeanut Eric McCreath There are many well known microprocessors: Intel x86 series, Pentium, Celeron, Xeon, etc. AMD Opteron, Intel Itanium, Motorola 680xx series, PowerPC, SPARC/ UltraSPARC, MIPS, Compaq Alpha, AVR, PIC, ARM, Atom, Tegra, IBM Cell... We shall investigate the design and operation of the ANU illustrative microprocessor, the rpeanut. Memory 2 The rpeanut is a 32 bit microprocessor with: 32 bit registers, and 16 bit addresses, memory that is addressable in words of 32 bits. So the total maximum amount of addressable memory is words or 262144 bytes (256KiB). Only the addresses 0x0000 to 0x7FFF are connected to actual memory. Addresses between 0x8000 and 0xFFFFare used for memory mapped IO (although only 3 of these addresses are actually used). 3 4

Memory When the microprocessor is reset the instruction pointer (IP) is set to 0x0100, so normally a program will be load at this point for execution. Addresses 0x0000 to 0x00FF are reserved for the interrupt vector and other OS code. Also the last 960 words of actual memory is used for the frame buffer. Memory contains both data and programs. Memory is accessed via: the MAR (Memory Address Register), the MDR (Memory Data Register), and bus control signals. 0x0000-0x00FF Interrupts and OS 0x0100-0x7B3F 0x7C40-0x7FFF General Memory Frame Buffer 0x8000-0xFFFF Not connect to real memory. Used for memory mapped IO. 5 6 To read from main memory: To write to main memory: The CPU places the address it wishes to read from into the MAR. The CPU places the address it wishes to write to into the MAR, also the data the CPU is writing is placed into the MDR. The MAR is placed on the address bus and a read signal is given to the bus. The MAR and MDR is placed on the bus and a write signal is given to the bus. Memory reads this address and writes to the data bus. Memory writes the data to the address. The contents of the data bus is copied into the MDR. 7 8

CPU (Central Processing Unit) CPU (Central Processing Unit) The CPU contains: A control unit, The following 32 bit registers: 8 generally purpose registers these may be used for storing either data or addresses. These are denoted R0, R1,... R7. 3 constant registers. These are denoted ONE, ZERO, MONE. An instruction register (IR) - which holds the current instruction that is being executed. A status register (SR) - contains status information about the CPU. Bit 0 is used for integer overflow (OF), bit 1 is used for interrupt mask (IM), bit 2 to enable the timer interrupt (TI). The following 16 bit registers: A stack pointer (SP) - this points to the top of the stack and is used for method calls, method returns, and interrupts. A program counter (PC) - which contains the address of the next instruction to execute. An ALU (Arithmetic Logic Unit) which does 2-complement integer arithmetic and bitwise logic computations. The MAR, MDR, and a number in internal buses for moving information around the CPU. Note that the registers: MAR, MDR, IR and PC are not directly accessible via the instruction set. Although clearly the execution of instructions will effect these registers. Fetch-decode-execute cycle 9 Instruction Set 10 The control unit sequences the movement of data around the CPU. The microprocessor goes through the follow execution cycle: do { IR = mem[pc]; PC = PC + 1; execute_instruction in IR; check for interrupts; } while(!halt); Instructions are all 1 word long (32 bits). Registers have the labels R0,R1,...R7, SP, SR, ONE, ZERO, MONE and take a nibble (4 bits) in the machine code. The encoding of this nibble is: R0 is 0x0, R1 is 0x1,..., R7 is 0x7, SP is 0x8, SR is 0x9, ONE is 0xB, ZERO is 0xC, and MONE is 0xD. Addresses and values take 16 bits of the 32 bit machine code instruction. Values are sign extended from 16 bits to 32 bits. The format of the instructions is given in the specification document. 11 12

Assembling Code By Hand Load and Store Instruction Assembly code provides a human readable way of describing the machine code of that is executed on a CPU. The mapping from assembler to machine code is a simple and direct process. This is normally done by the assembler. However, it is useful to be able to do this by hand. It basically involves looking up the table of instructions and putting together the bytes of the instruction based on the format of that instruction. Say we have the assembly instruction: The "load" instruction let you load data into a register. The data could be a literal within the text or may be another location within memory. Whereas the "store" lets you transfer data from a register to a memory location. store add R5 R2 R3 Looking up the addition instruction in the table we have: CPU add <RS1> <RS2> <RD> => 0x1<RS1><RS2><RD>0000 + Hence "add R5 R2 R3" would assemble to: 0x15230000 load Main memory Load Addressing Modes 13 Store Addressing Modes 14 All load operations load from main memory into a designated register. There are 4 possible addressing modes: All store operations store from a designated register into main memory. There are 3 possible addressing modes: Immediate load - this takes a value from the operand in the instruction, sign extends it, and stores it into a register. Absolute store - this takes the address in the operand and stores the register value at this address in main memory. Absolute load - this takes the address in the operand and loads the word at this address in main memory into a register. Indirect load - this takes the address in a given register and loads the word at this register's address in main memory into a register. base+displacement load - this adds a value from the operand to a register to give an address, which is used as the address to load from. Indirect store - this takes the address in a given register and stores the source value (also in a register) at the given register's address in main memory. base+displacement store - this adds a value from the operand to a register to give the address. This address is used to store the sources register value. 15 16

Hello World Example Exercises Address 0xFFF0 is the dataio address for the simple terminal device. When words are written to this address, there is no memory to store this information, rather the word is directed to a simple terminal device. In the simulator this appears with a text area. To implement hello world in rpeanut one can simply load the character literals into a register and store them to the dataio address. Read over the spec for rpeanut. Convert the following instructions to machine code. load #10 R2 halt add R3 R4 R5 move R4 R5 Write a program that prints your name. 0x0100 : load #'H' R1 load #'e' R1 load #'l' R1 load #'l' R1 load #'o' R1 halt 17 18