Summary of the MARIE Assembly Language



Similar documents
CHAPTER 4 MARIE: An Introduction to a Simple Computer

CPU Organisation and Operation

Central Processing Unit (CPU)

MICROPROCESSOR AND MICROCOMPUTER BASICS

Computer organization

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

1 Classical Universal Computer 3

CPU Organization and Assembly Language

Notes on Assembly Language

MACHINE ARCHITECTURE & LANGUAGE

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

BASIC COMPUTER ORGANIZATION AND DESIGN

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Instruction Set Architecture (ISA)

Chapter 5 Instructor's Manual

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

CHAPTER 7: The CPU and Memory

Microprocessor & Assembly Language

CSE 141L Computer Architecture Lab Fall Lecture 2

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

Systems I: Computer Organization and Architecture

Central Processing Unit

1 Description of The Simpletron

LSN 2 Computer Processors

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Administrative Issues

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

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

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

Levels of Programming Languages. Gerald Penn CSC 324

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

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

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

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Translating C code to MIPS

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

Chapter 2 Logic Gates and Introduction to Computer Architecture

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

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

CSC 2405: Computer Systems II

Instruction Set Architecture

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

LC-3 Assembly Language

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

CSCI 4717 Computer Architecture. Function. Data Storage. Data Processing. Data movement to a peripheral. Data Movement

In this Chapter you ll learn:

Chapter 9 Computer Design Basics!

Programmer s Model = model of µc useful to view hardware during execution of software instructions

PART B QUESTIONS AND ANSWERS UNIT I

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

An Overview of Stack Architecture and the PSC 1000 Microprocessor

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

MACHINE INSTRUCTIONS AND PROGRAMS

EC 362 Problem Set #2

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

Chapter 7D The Java Virtual Machine

Instruction Set Design

A3 Computer Architecture

EE361: Digital Computer Organization Course Syllabus

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

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

8085 INSTRUCTION SET

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

CS352H: Computer Systems Architecture

Chapter 2 Assemblers

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 6 Program Control

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

The 104 Duke_ACC Machine

An Introduction to the ARM 7 Architecture

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

OVERVIEW OF MICROPROCESSORS

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

CPU Sim 3.1: A Tool for Simulating Computer Architectures for CS3 classes

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Traditional IBM Mainframe Operating Principles

Systems I: Computer Organization and Architecture

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

Computer Organization and Architecture

İSTANBUL AYDIN UNIVERSITY

High level code and machine code

Figure 1: Graphical example of a mergesort 1.

Introducción. Diseño de sistemas digitales.1

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

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Chapter 7 Assembly Language

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Exemplar Work for SAMs. Units A452 and A453

The Little Man Computer

Basic Computer Organization

A SystemC Transaction Level Model for the MIPS R3000 Processor

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

TIMING DIAGRAM O 8085

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

CS201: Architecture and Assembly Language

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

M6800. Assembly Language Programming

Faculty of Engineering Student Number:

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

EECS 427 RISC PROCESSOR

Transcription:

Supplement for Assignment # (sections.8 -. of the textbook) Summary of the MARIE Assembly Language Type of Instructions Arithmetic Data Transfer I/O Branch Subroutine call and return Mnemonic ADD X SUBT X ADDI X LOAD X STORE X INPUT OUTPUT JUMP X SKIPCOND C JNS X JUMPI X HALT Hex Opcode B A 9 8 C Description Add the contents of address X to Subtract the contents of address X from the Add Indirect: Use the value at X as the actual address of the data operand to add to Put all zeros in the Load the contents of address X into Store the contents of at address X Input a value from the keyboard into Output the value in to the display Unconditional branch to X by loading the value of X into PC Skip the next instruction based on the condition, C: C = : skip if is negative (b b = ) C = : skip if the = (b b = ) C = 8 : skip if the is positive (b b = ) Jump-and-Store: Store the PC at address X and jump to X+ Use the value at X as the address to jump to Terminate the program MARIE Machine-language Instruction Format Opcode Address (or Condition) A simple MARIE program can be written to perform the high-level language statements: RESULT = X + Y - Z print RESULT Address Label Assembly Language Machine Language LOAD X ADD Y SUBT Z 8 STORE RESULT 9 OUTPUT HALT X, DEC A Y, DEC 8 Z, DEC 9 RESULT, DEC The lines at address to 9 are assembler directives (directions to the assembler) to initialize the memory location associated with X (address ) to DECimal, the memory location associated with Y (address ) to, etc. Lines at address to are the actual machine-language MARIE program. If the PC = (program counter), the program execution would start at address which contains. This instruction would be fetched into the CPUs IR (instruction register), bits - contain the operations code of would be decoded to determine that it is a LOAD instruction. Execution of the LOAD causes the specified memory Supplement MARIE AL - page

Supplement for Assignment # (sections.8 -. of the textbook) address s ( in bits -) content to be loaded into the accumulator () register (i.e., the value would be loaded into the ). During the fetch-decode-execute cycle, the PC would get incremented to the next instruction. The program instructions are executed sequentially until the HALT instruction which stops the program. The branch instructions, JUMP and SKIPCOND, potentially cause the PC to jump (i.e., alter the flow of control in the program). These instructions are useful for implementing high-level language selection (IF, IF-THEN-ELSE, SWITCH, etc.) and looping statements (FOR, WHILE, REPEAT, etc.). For example, consider the following IF-THEN-ELSE statement and corresponding flow-chart: HLL statement Flow chart Assembly Language LOAD X if X < Y then X < Y? False SUBT Y SKIPCOND JUMP ELSE True THEN, then body else JUMP END_IF ELSE, else body end if END_IF, If X < Y is True, then the value of (X-Y) in the is negative. The SKIPCOND cause the JUMP ELSE instruction to be jumped over if the is negative. Since the then-part code follows the JUMP ELSE instruction, it is only executed if X < Y. After the then-part code is executed, the JUMP END_IF causes the else-body to be skipped. If X < Y is False, then the value of (X - Y) in the will not be negative the SKIPCOND instruction will not jump over the JUMP ELSE instruction. For a loop example, consider the following FOR-loop and corresponding flow-chart: HLL statement Flow chart Assembly Language for I = to do I = I <? True for body False FOR_INIT, LOAD ONE STORE I FOR_COND, LOAD I SUBT TEN SKIPCOND 8 JUMP FOR_BODY JUMP END_FOR FOR_BODY, end for I = I + LOAD I ADD ONE STORE I JUMP FOR_COND END_FOR, Supplement MARIE AL - page

Supplement for Assignment # (sections.8 -. of the textbook) If I [ is False, then (I - ) is positive, so the SKIPCOND 8 skips to JUMP END_FOR. Thus, dropping out of the FOR loop. Otherwise, the JUMP FOR_BODY is not skipped. After the for-body executes and the loop-control variable I is incremented, the JUMP FOR_COND loops back to recheck the loop control variable. The simplicity of the MARIE instruction set make writing assembly-language programs difficult. So, we ll only write small toy programs in MARIE, and later learn to write realistic assembly-language programs in the slightly more complex MIPS instruction set. However, the simplicity of the MARIE architecture is a huge benefit as we turn our attention to the hardware of implementing the CPU datapath and control unit. MARIE Registers and Buses: The revised Figure.9 (below) has moved the Memory from the CPU chip and hence the internal CPU Datapath. Thus, memory can only be accessed via the MAR (Memory-Address Register) and the MBR (Memory-Buffer Register) which is much more realistic. This has some impact on the microoperations that access memory. For example, fetching the instruction pointed at by the PC into the IR would require the following microoperations: MAR b PC MBR b M[MAR] (read from memory into the MBR instead of directly into the IR as descibed on page 99) IR b MBR However, the authors seem to understand this since their microoperations to execute the Load X (on page 9) use the MBR correctly: MAR b X (X is the address part of the IR, so this should technically be MAR b IR - ) MBR b M[MAR] (read from memory into the MBR instead of directly into the ) b MBR Revised Figure.9 Datapath in MARIE MAR PC MBR IR InREG ALU address data/instr. Memory -bits Input Device Address - OutREG Output Device Supplement MARIE AL - page

The text discusses the microoperations of the fetch-decode-execute machine cycle in the execution of the Simple Program below that calculates RESULT = X + Y. Address Label Assembly Language Machine Language LOAD X ADD Y STORE RESULT HALT X, DEC Y, DEC - FFE9 RESULT, DEC Step Decode IR[-] Get operand Execute Supplement for Assignment # (sections.8 -. of the textbook) Revised Figure. (a) LOAD X ( in ML) Step # PC IR MAR MBR (initial values) T MARbPC T MBRbM[MAR] T IRbMBR T PCbPC + T MARbIR[-] T MBRbM[MAR] bmbr T Revised Figure. (b) ADD Y ( in ML) Step Step # PC IR MAR MBR (initial values AFTER LOAD X) T MARbPC T MBRbM[MAR] T IRbMBR T PCbPC + Decode IR[-] T MARbIR[-] Get operand T MBRbM[MAR] FFE9 Execute b + MBR FFE9 C T Revised Figure. (c) STORE RESULT ( in ML) (YOU COMPLETE THIS AS PART OF LECTURE) Step Step # PC IR MAR (initial values AFTER ADD Y) T T T T Decode IR[-] T Execute* T * Get Operand step is not necessary for STORE instructions MBR FFE9 C Supplement MARIE AL - page

Advanced MARIE Assembly Language Example: Print null terminated string to output HLL: index = while str[index]!= do output str[index] index = index + end while Address 8 9 A B C D E F 8 9 A B C D F Supplement for Assignment # (sections.8 -. of the textbook) Label WHILE, DO, END_WHILE, ONE, INDEX, ADDR, STR_BASE, STR, NULL, Assembly Language STORE INDEX LOAD STR_BASE ADD INDEX STORE ADDR ADDI ADDR SKIPCOND JUMP DO JUMP END_WHILE OUTPUT LOAD INDEX ADD ONE STORE INDEX JUMP WHILE HALT DEC DEC HEX HEX DEC / H DEC 9 / E DEC / L DEC / L DEC 9 / O DEC /carriage return DEC 8 / W DEC 9 / O DEC 8 / R DEC / L DEC 8 / D DEC / NULL CHAR Machine Language A A B 8 9A 9A D B 9 8 C C F D F C Supplement MARIE AL - page