Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

Similar documents
Computer Organization II CMSC 3833 Lecture 33

CC312: Computer Organization

Computer Architecture. CSE 1019Y Week 16. Introduc>on to MARIE

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

The MARIE Architecture

Problem Points Your Points Total 80

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Introduc>on to MARIE

Chapter 4. MARIE: An Introduction to a Simple Computer

Notes: The Marie Simulator

MARIE: An Introduction to a Simple Computer

MARIE: An Introduction to a Simple Computer

Chapter 4. Chapter 4 Objectives. MARIE: An Introduction to a Simple Computer

CSE100 Lecture03 Machines, Instructions, and Programs Introduction to Computer Systems

CS311 Lecture: The Architecture of a Simple Computer

2.2 THE MARIE Instruction Set Architecture

Chapter 4. Chapter 4 Objectives

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

CDA 3103 Computer Organization Homework #7 Solution Set

CMSC 3833 Lecture 37

CHAPTER 4 MARIE: An Introduction to a Simple Computer

SCRAM Introduction. Philipp Koehn. 19 February 2018

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

a number of pencil-and-paper(-and-calculator) questions two Intel assembly programming questions

Fundamentals of Computer Architecture. 8. Bringing It All Together The Hardware Engineer s Perspective

MARIE: An Introduction to a Simple Computer

William Stallings Computer Organization and Architecture

Running Applications

A3 Computer Architecture

The Institution of Engineers - Sri Lanka

session 7. Datapath Design

2010 Summer Answers [OS I]

Processing Unit CS206T

Faculty of Engineering Systems & Biomedical Dept. First Year Cairo University Sheet 6 Computer I

Introduction to CPU architecture using the M6800 microprocessor

COMARCH. COMPUTER ARCHITECTURE TERM 3 SY COMPUTER ENGINEERING DE LA SALLE UNIVERSITY Quiz 1

General purpose registers These are memory units within the CPU designed to hold temporary data.

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MARIE Simulator

Hardware Level Organization

Wednesday, February 4, Chapter 4

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

AS/A Level Computing Syllabus 2011

Chapter 4. MARIE: An Introduction to a Simple Computer 4.8 MARIE 4.8 MARIE A Discussion on Decoding

CS501_Current Mid term whole paper Solved with references by MASOOM FAIRY

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

Register Transfer and Micro-operations

Wednesday, September 13, Chapter 4

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

PSIM: Processor SIMulator (version 4.2)

The Stored Program Computer

DC57 COMPUTER ORGANIZATION JUNE 2013

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

Computer architecture Assignment 3

C.P.U Organization. Memory Unit. Central Processing Unit (C.P.U) Input-Output Processor (IOP) Figure (1) Digital Computer Block Diagram

THE MICROPROCESSOR Von Neumann s Architecture Model

CPU Structure and Function

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

Teaching London Computing

Chapter 5. Computer Architecture Organization and Design. Computer System Architecture Database Lab, SANGJI University

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

Computer Organization and Architecture, Pt. 2

William Stallings Computer Organization and Architecture

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Computer Organisation CS303

Instruc=on Set Architecture

Chapter 16. Control Unit Operation. Yonsei University

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Chapter 2 Instruction Set Architecture

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

Machine Language and Assembly Language

Instruction Set Architecture

Address Modes effective address

Computer Architecture

Micro-Operations. execution of a sequence of steps, i.e., cycles

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

1DT157 Digitalteknik och datorarkitekt. Digital technology and computer architecture, 5p

Computer Architecture (part 2)

ECE 375 Computer Organization and Assembly Language Programming Winter 2018 Solution Set #2

Computer Organization

CHAPTER 5 A Closer Look at Instruction Set Architectures

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

CPU Structure and Function

Chapter 10 - Computer Arithmetic

Programming Level A.R. Hurson Department of Computer Science Missouri University of Science & Technology Rolla, Missouri

17. Instruction Sets: Characteristics and Functions

Processor design - MIPS

2. Computer Evolution and Performance

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

STRUCTURE OF DESKTOP COMPUTERS

Arab Open University. Computer Organization and Architecture - T103

Microcontroller Systems

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

CHAPTER 5 A Closer Look at Instruction Set Architectures

OSIAC Read OSIAC 5362 posted on the course website

Programming Using C Homework 5

address ALU the operation opcode ACC Acc memory address

ASSIGNMENT ECE514 (COMPUTER ORGANIZATION) ASSIGNMENT NO. 3

CPU. Fall 2003 CSE 207 Digital Design Project #4 R0 R1 R2 R3 R4 R5 R6 R7 PC STATUS IR. Control Logic RAM MAR MDR. Internal Processor Bus

9/25/ Software & Hardware Architecture

Chapter 3 : Control Unit

UNIT 8C Computer Organization: The Machine s Language. von Neumann Architecture

Transcription:

Department of Computer and Mathematical Sciences CS 3401 Assembly Language 4 Lab 4: Introduction to MARIE Objectives: The main objective of this lab is to get you familiarized with MARIE a simple computer simulator. The MARIE architecture has the following characteristics: Binary, two's complement data representation. Stored program, fixed word length data and instructions. 4K words of word-addressable main memory. 16-bit data words. 16-bit instructions, 4 for the opcode and 12 for the address as shown below. A 16-bit arithmetic logic unit (ALU). Seven registers for control and data movement. Figure 1: MARIE Architecture Figure 2: MARIE Instruction set MARIE s seven registers are: Accumulator, AC, a 16-bit register that holds a conditional operator (e.g., "less than") or one operand of a two-operand instruction. Memory address register, MAR, a 12-bit register that holds the memory address of an instruction or the operand of an instruction. Memory buffer register, MBR, a 16-bit register that holds the data after its retrieval from, or before its placement in memory. Program counter, PC, a 12-bit register that holds the address of the next program instruction to be executed. Instruction register, IR, which holds an instruction immediately preceding its execution. Input register, InREG, an 8-bit register that holds data read from an input device. Output register, OutREG, an 8-bit register, that holds data that is ready for the output device.

Task 1: Micro-operations -- Register Transfer Language (RTL) The exact sequence of micro-operations that are carried out by an instruction can be specified using register transfer language (RTL). In the MARIE RTL, it uses the notation M[X] to indicate the actual data value stored in memory location X, and to indicate the transfer of bytes to a register or memory location. For example the Load X instruction AC MBR Activity 1.1: What is the RTL for the Add X instruction? Activity 1.2: What is the RTL for the Subt X instruction? AC AC - MBR Activity 1.3: What is the RTL for the JnS X instruction? MBR PC M[MAR] MBR MBR X AC 1 PC AC Activity 1.4: What is the RTL for the AddI X instruction? MAR MBR

Task 2: Instruction Processing An instruction is executed as follows: The fetch-decode-execute cycle is the series of steps that a computer carries out when it runs a program. We first have to fetch an instruction from memory, and place it into the IR. Once in the IR, it is decoded to determine what needs to be done next. If a memory value (operand) is involved in the operation, it is retrieved and placed into the MBR. With everything in place, the instruction is executed. Activity 2.1: Suppose the location X in a Load X instruction is 104 which contains the value of 35 d and the instruction stored at 100 in the memory, complete the following table: (initial values) 100 Fetch MAR PC 100 100 IR M[MAR] 100 1104 100 PC PC + 1 101 1104 100 Decode MAR IR[11-0] 101 1104 104 (decode IR[15-12]) 101 1104 104 Get operand Execute AC MBR 101 1104 104 0023 101 1104 104 0023 0023 Activity 2.2: Suppose the location X in an ADD X instruction is 105 which contains the value of 23 d and the instruction stored at 101 in the memory, complete the following table: (initial values) 101 1104 104 0023 0023 Fetch MAR PC 101 101 101 0023 0023 IR M[MAR] 101 3105 101 0023 0023 PC PC + 1 102 3105 101 0023 0023 Decode MAR IR[11-0] 102 3105 105 0023 0023 (decode IR[15-12]) 102 3105 105 0023 0023 Get operand 102 3105 105 FFE9 0023 Execute 102 3105 105 FFE9 000C

Activity 2.3: Suppose the location X in a Store X instruction is 106 and the instruction stored at 102 in the memory, complete the following table: (initial values) 102 3105 105 FEE9 000C Fetch MAR PC 102 3105 102 FFE9 000C IR M[MAR] 102 2106 102 FFE9 000C PC PC + 1 103 2106 102 FFE9 000C Decode MAR IR[11-0] 103 2106 106 FFE9 000C (decode IR[15-12]) 103 2106 106 FFE9 000C Get operand 103 2106 106 FFE9 000C Execute MBR AC 103 2106 106 000C 000C M[MAR] MBR 103 2106 106 000C 000C Task 3: MARIE Assembly Program Activity 3.1: Enter the following assembly code in MARIE Assembly Code Editor and save. Load X Subt Y Skipcond 000 Jump Else Then, Load Y Subt X Store Y Jump Endif Else, Load X Subt Y Store X Endif, Halt X, DEC 20 Y, DEC 30 Activity 3.2: Assemble the program, then debug or run the program in MARIE Simulator. Activity 3.3: What is the content at location of X and Y at end of the program? Location Content X 0014 Y 000A

Activity 3.4: Replace the instruction X, DEC 20 by X, DEC 40. What is the content at location of X and Y at end of the program? Location X Y Content 000A 001E Activity 3.5: Describe what the program in Activity 3.1 does. if (X - Y) < 0 Y = Y X else X = X - Y Activity 3.6: Convert each instruction in the following program to its corresponding machine code in hex. Location Instruction Machine Code 000 Load X 100C 001 Subt Y 400D 002 Skipcond 000 8000 0003 Jump Else 9008 004 Then, Load Y 100D 005 Subt X 400C 006 Store Y 200D 007 Jump Endif 900B 008 Else, Load X 100C 009 Subt Y 400D 00A Store X 200C 00B Endif, Halt 7000 00C X, DEC 20 0014 00D Y, DEC 30 001E