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

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

Notes: The Marie Simulator

Computer Organization II CMSC 3833 Lecture 33

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

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

CMSC 3833 Lecture 37

Problem Points Your Points Total 80

2.2 THE MARIE Instruction Set Architecture

CC312: Computer Organization

Instruc=on Set Architecture

Programming Using C Homework 5

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

The MARIE Architecture

CDA 3103 Computer Organization Homework #7 Solution Set

CS311 Lecture: The Architecture of a Simple Computer

Instruc=on Set Architecture

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

Modern Instruc?on Sets

Chapter 4. MARIE: An Introduction to a Simple Computer

Instruc=on Set Architecture

Floa=ng- Point Numbers

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

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Exam 1 Review

If you would prefer to run the Marie simulator from the command prompt, you may use the command: java -jar MarieSim.jar

Part 1 (70% of grade for homework 2): MIPS Programming: Simulating a simple computer

MARIE: An Introduction to a Simple Computer

Modern Instruc?on Sets

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Exam Review

A Guide to the MARIE Machine Simulator Environment Accompanying The Essentials of Computer Organization and Architecture by Linda Null and Julia Lobur

Computer Architecture /

Reading assignment. Chapter 3.1, 3.2 Chapter 4.1, 4.3

Lecture 4: MIPS Instruction Set

Performance Measurement

MARIE: An Introduction to a Simple Computer

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop

Objec0ves. Gain understanding of what IDA Pro is and what it can do. Expose students to the tool GUI

ORG ; TWO. Assembly Language Programming

Getting Started with the HCS12 IDE

Macro Assembler. Defini3on from h6p://

Chapter 4. Chapter 4 Objectives

ECE 473 Computer Architecture and Organization Project: Design of a Five Stage Pipelined MIPS-like Processor Project Team TWO Objectives

We will use the accumulator machine architecture to demonstrate pass1 and pass2.

Processor Architecture

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Binary Numbers

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MIPS Assembly

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18

CSE 141 Lab NOTES. How we ll grade Part A

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

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

SOEN228, Winter Revision 1.2 Date: October 25,

MIPS Assembly (FuncDons)

EE 3613: Computer Organization Homework #2

BBM 101 Introduc/on to Programming I Fall 2014, Lecture 5. Aykut Erdem, Erkut Erdem, Fuat Akal

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

ECE 30 Introduction to Computer Engineering

Teaching London Computing

Unit 2: Data Storage CS 101, Fall 2018

Instruction Set Architecture

Final Programming Project

Lecture 5: Procedure Calls

Unit 10: Data Structures CS 101, Fall 2018

Introduction to Computer Science. Homework 1

Computer architecture Assignment 3

LAB C Translating Utility Classes

Supplement for MIPS (Section 4.14 of the textbook)

Monday, February 16, 2015

CS 135: Computer Architecture I

Y = (A + C) (A + B) (B + C)

Pseudocode. ARITHMETIC OPERATORS: In pseudocode arithmetic operators are used to perform arithmetic operations. These operators are listed below:

Introduction. C provides two styles of flow control:

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

CS61C Machine Structures. Lecture 1 Introduction. 8/27/2006 John Wawrzynek (Warzneck)

Extra-credit QUIZ Pipelining -due next time-

Compilers and Assemblers

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Version Control

Lab 2: Structured Program Development in C

CT 229. Java Syntax 26/09/2006 CT229

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

Please put your cellphone on vibrate

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

MIPS Assembly: More about Memory and Instructions CS 64: Computer Organization and Design Logic Lecture #7

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++

Lecture 2: The Instruction Set Architecture

CSSE232 Computer Architecture I. Datapath

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Looping Subtasks. We will examine some basic algorithms that use the while and if constructs. These subtasks include

Logistics. IIT CS 350 S '17 - Hale

QUIZ: What value is stored in a after this

COMP1917 Computing 1 Written Exam Sample Questions

CSE/EEE 230 Computer Organization and Assembly Language

CHAPTER 5 A Closer Look at Instruction Set Architectures

Jackson State University Department of Computer Science CSC / Advanced Information Security Spring 2013 Lab Project # 5

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer

11. A Computing Machine

Computer Architecture 2/26/01 Lecture #

SaM. 1. Introduction. 2. Stack Machine

CPS 104 Computer Organization and Programming

Introduction to MiniSim A Simple von Neumann Machine

CHAPTER SEVEN PROGRAMMING THE BASIC COMPUTER

Transcription:

ECPE 170 Jeff Shafer University of the Pacific MARIE Simulator

2 Schedule Today MARIE assembly programming Friday 17 th MARIE assembly programming Monday 20 th No class Wednesday 22 nd MARIE assembly programming Quiz 3! Topic: Assembly programming! I will give you Table 4.7 from the book

3 Prelab Setup MARIE Simulator If you are using your own laptop, make sure Java is installed hhp://java.oracle.com (Java SE, then download Java 7 JRE) Get the MARIE simulator now ECPE 170 Sakai site under Resources or Textbook website: hhp://computerscience.jbpub.com/ecoa/3e/simulators.aspx Today s goals: Run some sample programs And write your own!

4 Recap MARIE Instructions (Full) Binary Hex InstrucRon Meaning 0001 1 LOAD X Load contents of address X into AC 0010 2 STORE X Store contents of AC at address X 0011 3 ADD X Add contents of address X to AC 0100 4 SUBT X Subtract contents of address X from AC 0101 5 INPUT Input value from keyboard into AC 0110 6 OUTPUT Output value in AC to display 0111 7 HALT Terminate program 1000 8 SKIPCOND Skip next instruc_on on condi_on based on AC value 1001 9 JUMP X Load value of X into PC 1010 A CLEAR Set AC to 0 1011 B ADDI X Add contents of address Mem[X] to AC 1100 C JUMPI X Load contents of address Mem[X] into PC 1101 D LOADI X Load contents of address Mem[X] into AC 1110 E STOREI X Store contents of AC at address Mem[X] See table 4.7 in book!

5 MARIE Assembly High- Level Language X = 5 Y = 7 Z = X + 7 Assembly LOAD X ADD Y STORE Z X, DEC 5 Y, DEC 7 Z, DEC 0

6 Using the MARIE Simulator To use the simulator 1. Unzip the downloaded archive into a folder on your U: drive 2. Browse the files and locate MarieSim.jar MarieSim is a JAVA applica_on Unless your computer has.jar files associated with the Java machine, you will need to run the program by hand Go to Start Menu, pick Run Enter: java -jar MarieSim.jar

7

8 Using the MARIE Simulator Our programs are wrihen in MARIE assembly language.mas files Need to use the assembler before running (simula;ng) the program! What does the assembler do again? To start, do File à Edit Opens editor Type in your file, or File à Open to load Choose file Ex4_1.mas

9

10 Using the MARIE Simulator Assembly file format: Typical MARIE line: (Label is op;onal) Labels: define addresses we want to access End with a comma (,) Opcode: the opera_on to perform Operands: other data needed by the instruc_on Comments: you know, comments Comments start with / symbol in MARIE Label, opcode operands / comments

11 Special Commands What is DEC? HEX? ORG? END? Are they assembly commands for the processor? No these are commands for the assembler only! DEC X The number to follow is wrihen in base 10 (please convert to binary) HEX X The number to follow is wrihen in base 16 (please convert to binary) ORG X Please store this program in memory star_ng at memory address X (in Hex) END - Stop Assembly (finished!)

12 Using the MARIE Simulator Ready to run simulator? Assemble source code Assemble à Assemble Current File Files produced by assembler.lst file = Original assembly code + machine code.map file = Symbol table from assembly process.mex file = Machine code (only) Errors? Lis_ng file will indicate line and problem No errors? Ready to simulate!

13

14 Using the MARIE Simulator To simulate, Fileà Load Pick the.mex file created by the assembler Code shows up in upper lep window Addresses shown on the lep Machine code shown on the right Registers shown in the middle Output (from OUTPUT instruc_on) on right BoHom windows shows memory dump

15 Using the MARIE Simulator Ways to simulate Run: run con_nuously un_l you choose Stop or CPU executes a HALT Step Choose Runà Set stepping modeà on first Lets you examine one instruc_on at a _me Breakpoints Lets you pick instruc_ons to stop at Check the box next to the instruc_ons address Choose Breakpoints à Run to Breakpoints

16 Lab Exercise 1 With a partner (if desired), take 5 minutes to: Examine the assembly code in the file Ex4_1.mas (already open) Write the equivalent C++ (or Java, or pseudocode) for the opera_on being performed Equivalent code doesn t have to be perfect You could write several different C++ programs that accomplish the same tasks!

17 ORG 100 Load Addr /Load address of first number to be added Store Next /Store this address is our Next pointer Load Num /Load the number of items to be added Subt One /Decrement Store Ctr /Store this value in Ctr to control looping Loop, Load Sum /Load the Sum into AC AddI Next /Add the value pointed to by location Next Store Sum /Store this sum Load Next /Load Next Add One /Increment by one to point to next address Store Next /Store in our pointer Next Load Ctr /Load the loop control variable Subt One /Subtract one from the loop control variable Store Ctr /Store this new value in loop control variable Skipcond 000 /If control variable < 0, skip next instruction Jump Loop /Otherwise, go to Loop Halt /Terminate program Addr, Hex 117 /Numbers to be summed start at location 118 Next, Hex 0 /A pointer to the next number to add Num, Dec 5 /The number of values to add Sum, Dec 0 /The sum Ctr, Hex 0 /The loop control variable One, Dec 1 /Used to increment and decrement by 1 Dec 10 /The values to be added together Dec 15 Dec 20 Dec 25 Dec 30

18 Lab Exercise 1 int myarray[5]={10,20,30,40,50}; int num=5; int counter=0; int sum=0; counter = num 1; do { sum = sum + myarray[counter]; counter = counter 1; } while(counter >=0)

19 Lab Exercise 2 With a partner (if desired), write and run a complete MARIE assembly program to accomplish the follow task: if X==Y then X = X * 2; else Y = Y X; Show me the running program with X=12 10, Y=20 10

20 Lab Exercise 2 ORG 100 If, LOAD X /Load the first value SUBT Y /Subtract the value of Y, store result in AC SKIPCOND 400 /If AC=0, skip the next instruction JUMP Else /Jump to Else part if AC is not equal to 0 Then, LOAD X /Reload X so it can be doubled ADD X /Double X STORE X /Store the new value JUMP Endif /Skip over the false (else) part to end of if Else, LOAD Y /Start the else part by loading Y SUBT X /Subtract X from Y STORE Y /Store Y-X in Y Endif, HALT /Terminate program (it doesn't do much!) X, Dec 12 Y, Dec 20 END

21 Submission Rules for MARIE Homework Homework #9 and #10 Work individually or in teams of 2 Each person must submit assignment! Put your name and partner s name in comments You MUST comment your code! At least 90% of the lines! No points for uncommented code Sakai submission Turn in each.mas source file separately Name them ex428.mas, ex429.mas, Files should be PLAIN ASCII TEXT (use MARIE editor) Zero points if you give me a.doc,.docx,.pdf, etc We will run your program in the simulator for grading