100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Otro

CIS 480/580 Computer Architecture, Spring 2021 Project 1 & 2 – MIPS Assembler

Puntuación
-
Vendido
-
Páginas
6
Subido en
10-04-2023
Escrito en
2022/2023

CIS 480/580 Computer Architecture, Spring 2021 Project 1 & 2 – MIPS Assembler 1. Objectives This project is designed to help students to understand the RISC architecture (MIPS) and its instruction set and assembly. 2. Goals Your team (2 persons) will build an MIPS assembler for a subset of MIPS instructions in C. This assembler will read a simple MIPS program and generate an MIPS machine code output file. 3. Specification Project 2 is the extension of Project 1 by including branch and jump instructions. Note that the shaded parts in this document are Project 2 requirements. Due dates for Project 1 and 2 is March 12 and March 26, respectively. While there are no language requirements, I will be grading your programs using Linux, so make sure your program can easily be compiled and run in a Linux environment. C and Java should work without issue, C# should be fine as long as you don’t use any GUI components. 3.1 Input Your assembler will read and parse the contents of a simple MIPS program (). Each line of the program contains an MIPS instruction or a directive. No line is blank. A label will not appear on a line by itself. Operands are comma-separated. There will be no white spaces between operands. No line will begin with white spaces. Lines containing instructions have the following format: [label:]<tab>instruction<tab>operands Lines containing directives have the following format: [label:]<tab>directive[<tab>operand] The supported instructions are as follows. You may wish to consult additional MIPS references or the textbook to know the details of the instructions. Instruction Name Syntax Semantic ADD Addition add $1,$2,$3 $1 = $2 + $3 SUB Subtract sub $1,$2,$3 $1 = $2 - $3 SLL Shift left logical sll $1,$2,5 $1 = $2 << 5 SRL Shift right logical srl $1,$2,5 $1 = $2 >> 5

Mostrar más Leer menos
Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Grado

Información del documento

Subido en
10 de abril de 2023
Número de páginas
6
Escrito en
2022/2023
Tipo
Otro
Personaje
Desconocido

Temas

Vista previa del contenido

CIS 480/580 Computer Architecture, Spring 2021
Project 1 & 2 – MIPS Assembler
1. Objectives

This project is designed to help students to understand the RISC architecture (MIPS) and its
instruction set and assembly.


2. Goals

Your team (2 persons) will build an MIPS assembler for a subset of MIPS instructions in C. This
assembler will read a simple MIPS program and generate an MIPS machine code output file.


3. Specification

Project 2 is the extension of Project 1 by including branch and jump instructions. Note that the
shaded parts in this document are Project 2 requirements. Due dates for Project 1 and 2 is March
12 and March 26, respectively.

While there are no language requirements, I will be grading your
programs using Linux, so make sure your program can easily be
compiled and run in a Linux environment. C and Java should work
without issue, C# should be fine as long as you don’t use any GUI
components.
3.1 Input

Your assembler will read and parse the contents of a simple MIPS program (program-name.asm).
Each line of the program contains an MIPS instruction or a directive. No line is blank. A label
will not appear on a line by itself. Operands are comma-separated. There will be no white spaces
between operands. No line will begin with white spaces. Lines containing instructions have the
following format:

[label:]<tab>instruction<tab>operands

Lines containing directives have the following format:
[label:]<tab>directive[<tab>operand]

The supported instructions are as follows. You may wish to consult additional MIPS references or
the textbook to know the details of the instructions.

Instruction Name Syntax Semantic
ADD Addition add $1,$2,$3 $1 = $2 + $3
SUB Subtract sub $1,$2,$3 $1 = $2 - $3
SLL Shift left logical sll $1,$2,5 $1 = $2 << 5
SRL Shift right logical srl $1,$2,5 $1 = $2 >> 5



This study source was downloaded by 100000850872992 from CourseHero.com on 04-10-2023 12:40:07 GMT -05:00


https://www.coursehero.com/file/91299083/20221S-project1-2-1-1doc/

, SLT Set less than slt $1,$2,$3 If $2<$3, $1=1; otherwise, $1=0
ADDI Addition immediate addi $1,$2,45 $1 = $2 + 45
LUI Load upper immediate lui $1,0xA5A5 ** Upper 16-bit of $1 = 0xA5A5
(Lower 16-bit of $1 is set to 0)
ORI Or immediate ori $1,$2,0xB6B6 $1 = $2 | 0x0000 B6B6 (bitwise OR)
LW Load word lw $1,100($2) $1 = Memory[$2+100]
SW Store word sw $1,100($2) Memory[$2+100] = $1
BEQ Branch on equal beq $1,$2,Label If $1=$2, jump to Label
BNE Branch on not equal bne $1,$2,Label If $1≠$2, jump to Label
J Jump j Label Jump to Label
LA * Load address la $1,Label lui $1, upper 16-bit of Label
ori $1, $1, lower 16-bit of Label

* LA is a pseudo-instruction. It is used to load the memory location (Label, 32 bits) into
the destination register. The assembler replaces it with two instruction sequence, lui
followed by ori.
** This is just an example. We only allows decimal numbers in the assembly
program.

The supported directives are as follows.

Directive Name Syntax Semantic
.text Text segment .text Program section in memory;
(no operand) it begins at 0x0000 0200 by default
.data Data segment .data Data section in memory;
(no operand) it begins at 0x0000 0000 by default
.space n Allocation of n bytes .space 10 Allocation of 10 bytes of memory
of memory
.word w Allocation of a word . word 16 Allocation of a word (4 bytes or 32 bits)
and initialized to w and initialized to 16 (0x0001 0000).

The registers are denoted as $0, $1, $2, etc. instead of “$s0” or “r1”.


3.2 Output

The assembler generates an output file (program-name.out) of size 1KB consisting of 512B of
data segment (begins at 0x0000) and 512B of text segment (begins at 0x0200). Since each data
and instruction is 4B long, there will be at maximum 128 word data and at maximum 128
instruction words. This file can be considered a binary executable file. Do not try to open this file
as it causes an error. The assembler does not detect syntax errors and assumes the assembly input
is correctly formed. We assume big-endian.

For a sample assembly input file (test.asm):

.data
print_data: .word 0
add_result: .word 0
load_data: .word 1
.word 2
.text
start: la $1,load_data



This study source was downloaded by 100000850872992 from CourseHero.com on 04-10-2023 12:40:07 GMT -05:00


https://www.coursehero.com/file/91299083/20221S-project1-2-1-1doc/
$7.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
ExamsConnoisseur Self
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
566
Miembro desde
2 año
Número de seguidores
343
Documentos
1497
Última venta
1 semana hace

4.3

67 reseñas

5
40
4
11
3
12
2
1
1
3

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes