MARIE: An Introduction to a Simple Computer

Slides:



Advertisements
Similar presentations
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
Advertisements

CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
MARIE: An Introduction to a Simple Computer
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Lecture 16 Today’s topics: –MARIE Instruction Decoding and Control –Hardwired control –Micro-programmed control 1.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
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.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
1 Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can be specified with register transfer statements.
MARIE: An Introduction to a Simple Computer. 2 MARIE Our model computer, the Machine Architecture that is Really Intuitive and Easy, MARIE, was designed.
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,
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Lecture Overview Introduction Instruction processing A simple program
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
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.
Structure and Role of a Processor
Processor Organization and Architecture Module III.
Designing a CPU –Reading a programs instruction from memory –Decoding the instruction –Executing the instruction –Transferring Data to/From memory / IO.
Jeremy R. Johnson William M. Mongan
Types of Micro-operation  Transfer data between registers  Transfer data from register to external  Transfer data from external to register  Perform.
Functions of Processor Operation Addressing modes Registers i/o module interface Memory module interface Interrupts.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Dr. Clincy Professor of CS
Basic Computer Organization and Design
CS 270: Mathematical Foundations of Computer Science
Computer Organization and Architecture + Networks
Control Unit Lecture 6.
Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.
Chapter 4 The Von Neumann Model
CHAPTER 4 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.
Micro-Operations A computer executes a program Fetch/execute cycle
Chapter 4 The Von Neumann Model
William Stallings Computer Organization and Architecture
William Stallings Computer Organization and Architecture 7th Edition
Computer System Overview
A Closer Look at Instruction Set Architectures: Expanding Opcodes
Chapter 15 Control Unit Operation
Chapter 4 The Von Neumann Model
The Processor and Machine Language
MARIE: An Introduction to a Simple Computer
Chapter 4 The Von Neumann Model
Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.
MARIE Instruction Set Architecture
Chapter One: Introduction
Dr. Clincy Professor of CS
Computer Organization and ASSEMBLY LANGUAGE
The Von Neumann Model Basic components Instruction processing
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Processor Organization and Architecture
William Stallings Computer Organization and Architecture 7th Edition
BIC 10503: COMPUTER ARCHITECTURE
Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.
William Stallings Computer Organization and Architecture 8th Edition
Chapter 4 The Von Neumann Model
MARIE: An Introduction to a Simple Computer
MARIE: An Introduction to a Simple Computer
MARIE: An Introduction to a Simple Computer
CS Chapter 4 Dr. Clincy Professor of CS TODAY’S AGENDA
A Discussion on Assemblers
The Stored Program Computer
Information Representation: Machine Instructions
COMPUTER ARCHITECTURE
Chapter 4 The Von Neumann Model
Presentation transcript:

MARIE: An Introduction to a Simple Computer

Lecture Overview MARIE Instruction processing Introduction The Architecture Registers and Buses The Instruction Set Architecture Register Transfer Notation Instruction processing

MARIE – Introduction (1/1) We are now familiar with computer components but how these are connected together? How these work together? Leonardo Da Vinci once said: “When you wish to produce a result by means of an instrument, do not allow yourself to complicate it” In this part we will use a MARIE, A Machine Architecture that is Really Intuitive and Easy. MARIE will help us to understand how computer functions (even the more complex computers)

The MARIE architecture has the following characteristics: The Architecture (1/1) The MARIE architecture has the following characteristics: Binary, two's complement data representation. Stored program, fixed word length data and instructions. 4K x 16 word-addressable main memory. 16-bit instructions: 4 bits for the opcode, 12 bits for the address. A 16-bit arithmetic logic unit (ALU). Seven registers for control and data movement.

Registers and Buses (1/5) MARIE Registers and Buses (1/5) MARIE’s seven registers are: AC: Accumulator, a 16-bit register that holds a conditional operator (e.g., "less than") or one operand of a two-operand instruction. MAR: Memory address register, a 12-bit register that holds the memory address of an instruction or an operand of an instruction. MBR: Memory buffer register, a 16-bit register that holds the data after its retrieval from, or before its placement in memory.

Registers and Buses (2/5) MARIE Registers and Buses (2/5) MARIE’s seven registers are: PC: Program counter, a 12-bit register that holds the address of the next program instruction to be executed. IR: Instruction register, a 16-bit register that holds an instruction immediately preceding its execution. InREG: Input register, an 8-bit register that holds data read from an input device. OutREG: Output register, an 8-bit register that holds data that is ready for the output device.

Registers and Buses (3/5) MARIE Registers and Buses (3/5) The MARIE architecture is shown in the figure below:

Registers and Buses (4/5) MARIE Registers and Buses (4/5) MARIE cannot transfer data or instructions into or out of registers without a bus. In MARIE, we assume a common bus scheme Each device on the bus is identified by a unique number. If the device is required to use the common bus, Its number is set on the control lines. Some direct pathways (without using the common bus) are also available to speed up execution MAR – Memory ; AC – ALU ; AC – MBR ; MBR – ALU.

Registers and Buses (5/5) MARIE Registers and Buses (5/5) The Data path in MARIE is shown in this figure Note that a data word (that is an instruction) in the main memory travels a relatively long path before achieving the IR!

Lecture Overview Introduction MARIE Instruction processing The Architecture Registers and Buses The Instruction Set Architecture Register Transfer Notation Instruction processing

The Instruction Set Architecture (1/7) MARIE The Instruction Set Architecture (1/7) MARIE has a very simple, yet powerful, instruction set. The Instruction Set Architecture (ISA) specifies the format of its instructions and the primitive operations that the machine can perform. The ISA is an interface between a computer’s hardware and its software. Some ISAs include hundreds of different instructions for processing data and controlling program execution.

The Instruction Set Architecture (2/7) MARIE The Instruction Set Architecture (2/7) For MARIE, each instruction consists of 16 bits These bits are organized as follows: Opcode: 4 bits (bits 12 to 15), specifies the instruction to be executed (which allows for a total of 24=16 instructions, but only 13 are used) Address: 12-bits (bits 0 to 11), forms an address. An instruction word

The Instruction Set Architecture (3/7) MARIE The Instruction Set Architecture (3/7) The fundamental MARIE instructions are:

The Instruction Set Architecture (4/7) MARIE The Instruction Set Architecture (4/7) Example: Consider the following binary instruction: 0001000000000011. What is the job of this instruction? Solution: The first four MSB forms the opcode “0001”. It corresponds to a LOAD instruction. The remaining 12 bits indicate the address of the value we are loading, which is address 3 in main memory. This instruction causes the data value found in main memory, address 3, to be copied into the AC

The Instruction Set Architecture (5/7) MARIE The Instruction Set Architecture (5/7) One important instruction is “SKIPCOND” When the Skipcond instruction is executed, the value stored in the AC must be inspected. The next instruction is skipped (resp. not skipped), if the condition tested is True (resp. False). Bits 11 and 10 (say b11b10) in the AC specify the condition to be tested, if: b11b10 = 00: The CPU tests if AC < 0 b11b10 = 01: The CPU tests if AC = 0 b11b10 = 10: The CPU tests if AC > 0

The Instruction Set Architecture (6/7) MARIE The Instruction Set Architecture (6/7) Example: Consider the following binary instruction: 1000100000000000. What is the job of this instruction? Solution: The opcode “1000” corresponds to a “skipcond” b11b10 = 10, so the instructions’ job is to skip the next instruction if AC > 0.

The Instruction Set Architecture (7/7) MARIE The Instruction Set Architecture (7/7) In general we use: SKIPCOND 000 which means skip the next instruction if the AC <0. SKIPCOND 400 which means skip the next instruction if the AC =0. SKIPCOND 800 which means skip the next instruction if the AC >0. Note that 000, 400 and 800 are in base 16, They are equivalent to 12bits (Address part)!

Lecture Overview Introduction MARIE Instruction processing The Architecture Registers and Buses The Instruction Set Architecture Register Transfer Notation Instruction processing

Register Transfer Notation (1/7) MARIE Register Transfer Notation (1/7) MARIE instruction appears to be very simplistic Actually, at the component level, each instruction involves multiple operations called “microoperations” Register Transfer Language (RTL), or Register Transfer Notation (RTN) specifies the exact sequence of microoperations that are carried out by an instruction.

Register Transfer Notation (2/7) MARIE Register Transfer Notation (2/7) In the MARIE RTL we will use the following : M[X]: to indicate the actual data value stored in memory location X ←: to indicate the transfer of bytes to a register or memory location In the following few slides we will present the RTL for each of the instructions in the ISA for MARIE

Register Transfer Notation (3/7) MARIE Register Transfer Notation (3/7) Load X (loads the contents of memory location X into the AC) MAR← X Place the address X in MAR; MBR← M[MAR] The data M[MAR] at location address MAR is moved into the MBR; AC← MBR The content of MBR is placed in the AC. Store X (stores the contents of AC into the memory location X) MAR← X Place the address X in MAR; MBR← AC Place the content of AC in MBR M[MAR]← MBR Place the content of MBR in the memory location MAR (M[MAR] is replaced by MBR)

Register Transfer Notation (4/7) MARIE Register Transfer Notation (4/7) Add X (The data value stored at address X is added to the AC). MAR← X Place the address X in MAR; MBR← M[MAR] Place the data M[MAR] at location address MAR in MBR; AC← AC + MBR Place the sum AC + MBR in AC Subt X (The data value stored at address X is subtracted from AC). AC← AC - MBR Place AC - MBR in AC

Register Transfer Notation (5/7) MARIE Register Transfer Notation (5/7) Input (Inputs a value from the keyboard into AC) AC← InREG Place the content of InREG (contains the input) in the AC. Output (Output the value in AC to the display) OutREG← AC Place the content of AC (contains the output) in the OutREG (to sent data to the display) Halt (Terminate the program) no need for any RTL! Jump X (unconditional branch to the given address, X) PC← X Load X into the PC

Register Transfer Notation (6/7) MARIE Register Transfer Notation (6/7) Skipcond if IR[11–10] = 00 then {if bits 10 and 11 in the IR are both 0} if AC < 0 then PC ← PC+1 else if IR[11–10] = 01 then {if bit 11 = 0 and bit 10 = 1} if AC = 0 then PC ← PC + 1 else if IR[11–10] = 10 then {if bit 11 = 1 and bit 10 = 0} if AC > 0 then PC ← PC + 1

Register Transfer Notation (7/7) MARIE Register Transfer Notation (7/7) Important Notes Any instruction is firstly placed into the instruction register IR where: IR[15-12] contains the opcode IR[11-0] contains the operand (address) In all the previous RTL, X can be replaced by IR[11-0]! Example: The RTL for Jump X can be written as follows: PC← IR[11-0]

Lecture Overview Introduction MARIE Instruction processing The Fetch-Decode-Execute cycle Interrupts

The Fetch-Decode-Execute cycle (1/1) Instruction processing The Fetch-Decode-Execute cycle (1/1) MARIE, like any other computer architecture, follow the basic machine cycle: the fetch, decode, and execute cycle Fetch Decode Execute

Most computers provide a way of interrupting a running program Instruction processing Interrupts (1/3) An important issue (that is not covered here for MARIE) is interrupt handling Most computers provide a way of interrupting a running program Examples of interrupts: A user break is issued (e.g., Ctrl+C) I/O is requested by the user or a program A critical error occurs Practically, when an interrupt occurs a special bit in the “status register” or “flag register” of the CPU is set.

The CPU checks this bit at the beginning of every machine cycle Instruction processing Interrupts (2/3) The CPU checks this bit at the beginning of every machine cycle If the bit is set, the CPU processes an interrupt as follows: Pause the execution of the current program Run the interrupt’s appropriate routine Continue the execution of the previously paused program (after finishing the interrupt’s routine) If the bit is not set, the CPU performs a normal new fetch, decode, execute cycle of the program currently being executed.

Instruction processing Interrupts (3/3) When the CPU finishes the interrupt’s routine, it must return to the exact point at which it was running in the original program. Before the CPU switches to the interrupt service routine, it must save: The contents of the PC The contents of all other registers in the CPU Any status conditions that exist for the original program.