lab2 - .data MEM: .skip 32 .text /* PREAMBLE - Name:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
.data MEM: .skip 32 .text /* PREAMBLE ------------------------- Name: Assignment: Lab 2 Objectives: * Implement high level control structures in assembly language * Interpret encodings in different ways, including sign-extending and non-sign-extending reads from memory * Use bit manipulation to parse an encoded instruction Problem: This is a continuation, and a refinement, of Lab 1, to write a SPARC assembly language program to simulate the processing of the SAM machine. Methodology: The complete fetch/execute cycle is emulated in assembly, starting at the beginning of memory and interpreting individual bytes as instructions. These SAM instructions are interpreted as their SPARC equivalents with the register state displayed between individual instructions. Register Mapping: To properly emulate each of the SAM system registers the following SPARC registers are associated with each role, %r1 <--> temporary variable %r2 <--> program counter (PC) %r3 <--> accumulator (ACC) %r4 <--> instruction register (IR) %r5 <--> memory address register (MAR) %r6 <--> memory data register (MDR) */ ! Symbolic Constants for ISEM extended operations ("Traps"): .set exit, 0 .set putchar, 1 .set putinthex, 4 .set getint, 5 ! Symbolic Constants for opcodes: .set ADD, 0 .set SUB, 1 .set MPY, 2 .set DIV, 3 .set LOAD, 4 .set STORE, 5 .set HALT, 6 .set BRL, 7 prelim: ! preliminary computation loadMem: set '\n', %r8 ! load newline for output ta putchar ! display character set 'M', %r8 ! load M for output ta putchar ! display character set ' ', %r8 ! load space for output ta putchar ! display character
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2012 for the course CSE 360 taught by Professor Sam during the Winter '11 term at Ohio State.

Page1 / 4

lab2 - .data MEM: .skip 32 .text /* PREAMBLE - Name:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online