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

Similar documents
Summary of the MARIE Assembly Language

Notes on Assembly Language

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Lab Experience 17. Programming Language Translation

1 Classical Universal Computer 3

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

Figure 1: Graphical example of a mergesort 1.

CSE 141L Computer Architecture Lab Fall Lecture 2

Chapter 7 Assembly Language

PCSpim Tutorial. Nathan Goulding-Hotta v0.1

UT69R000 MicroController Software Tools Product Brief

MACHINE ARCHITECTURE & LANGUAGE

MICROPROCESSOR AND MICROCOMPUTER BASICS

LC-3 Assembly Language

Fall 2006 CS/ECE 333 Lab 1 Programming in SRC Assembly

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

================================================================

Installing and using XAMPP with NetBeans PHP

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

PROBLEMS (Cap. 4 - Istruzioni macchina)

Z80 Instruction Set. Z80 Assembly Language

2011, The McGraw-Hill Companies, Inc. Chapter 3

The Little Man Computer

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

The 104 Duke_ACC Machine

POOSL IDE Installation Manual

WSNetServer User Manual. Date: July

Memory Management Simulation Interactive Lab

Introduction to LogixPro - Lab

Systems I: Computer Organization and Architecture

CSC 2405: Computer Systems II

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Chapter 2: Elements of Java

Introduction to MIPS Programming with Mars

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

In this Chapter you ll learn:

Chapter 5 Instructor's Manual

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Modbus RTU Communications RX/WX and MRX/MWX

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Computer organization

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

An Introduction to MPLAB Integrated Development Environment

3. Programming the STM32F4-Discovery

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 1

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

VIP Intelligent Transporta1on System Database- How to Set up a Local Populated Database. October 26, 2010

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Lecture 2 Mathcad Basics

TEACHING COMPUTER ARCHITECTURE THROUGH SIMULATION (A BRIEF EVALUATION OF CPU SIMULATORS) *

Lab 1 Beginning C Program

1 Description of The Simpletron

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

(Refer Slide Time: 00:01:16 min)

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Administrative Issues

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Assembly Language Programming

Training Simulator and Demo Software

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Microprocessor & Assembly Language

Here is a diagram of a simple computer system: (this diagram will be the one needed for exams) CPU. cache

User Manual. DG LINK Application Program This document applies to firmware version 2.00 and above.

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Before entering the lab, make sure that you have your own UNIX and PC accounts and that you can log into them.

PIC Programming in Assembly. (

How to Mail Merge PDF Documents

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

Instructions for Installing and Using the FOCUS DL-15 Data Transfer Software

Introduction to Microcontrollers

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Using the JNIOR with the GDC Digital Cinema Server. Last Updated November 30, 2012

Free Excel add-in for linear regression and multivariate data analysis

BASIC COMPUTER ORGANIZATION AND DESIGN

Informatica e Sistemi in Tempo Reale

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Section 5: Installing the Print Driver

CHAPTER 7: The CPU and Memory

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Installing LearningBay Enterprise Part 2

Developing applications under CODE COMPOSER STUDIO

PART B QUESTIONS AND ANSWERS UNIT I

Lab 1: Full Adder 0.0

Shimadzu UV-VIS User s Guide

Downloading Your Financial Statements to Excel

Automatic data recovery

Installing Primavera P6 Professional R8.2

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Introduction to the use of the environment of Microsoft Visual Studio 2008

S7 for Windows S7-300/400

The previous chapter provided a definition of the semantics of a programming

BA-1000 Software Package. Version 1.00

16-bit ALU, Register File and Memory Write Interface

Transcription:

ECPE 170 Jeff Shafer University of the Pacific MARIE Simulator

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

3 Recap MARIE Instructions (Full) Binary Hex InstrucJon 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!

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

5 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 (or) Run java jar <mariesimfile>

6

7 Using the MARIE Simulator Our programs are wriben 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

8

9 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 Start with / in Marie Label, opcode operands / comments

10 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 wriben in base 10 (please convert to binary) HEX X The number to follow is wriben 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!)

11 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!

12

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

14 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

15 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!

16 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)

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 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

19 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

20 Homework #8 Exercises 4.28 + 4.29 Work individually or in teams of 2 Each person must submit assignment! Put your name and partner s name in comments Sakai submission Turn in each.mas source file separately Name them ex428.mas, ex429.mas, Files should be PLAIN ASCII TEXT (use NotePad or MARIE editor) Zero points if you give me a.doc,.docx,.pdf, scanned copy of a printout, smoke signals, etc You MUST comment your code! (at least 90% of the lines!) No points for uncommented code