计算机系统设计代写 | ELEC 385: Computer System Design Homework #8

这个作业是编写一个MIPS汇编语言程序来播放Jeopardy主题曲

ELEC 385: Computer System Design
Homework #8

1. Write a MIPS assembly language program to play the Jeopardy theme song using the
instrument of your choice and at the volume of your choice. The following assembly directives
initialize the notes of the song and duration for which each note is to be played.
.eqv E,250
.eqv Q,500
.eqv QQ,700
.eqv H,1000
.data
Notes: .word 72,77,72,65,72,77,72,1
.word 72,77,72,77,81,1,79,77,76,75,74
.word 72,77,72,65,72,77,72,1
.word 77,74,72,70,69,67,65,0
Dur: .word Q,Q,Q,Q,Q,Q,H,Q
.word Q,Q,Q,Q,QQ,Q,Q,E,E,E,E
.word Q,Q,Q,Q,Q,Q,H,Q
.word QQ,Q,Q,Q,Q,Q,Q,0
You are required to use two functions (subroutines) in your solution. The following describes
the calling sequence and the passing of the arguments. Make sure you follow all MIPS
function conventions.
Function1(int note, int duration)
{
jal Function2;
}
# Play note for given duration
Function2( )
{
}
# Delay for 400ms
This problem uses two new MARS system calls, sleep and MIDI out. See the help menu to
learn how to use each. Make sure to read the notes below the system call table for the full
description of the calls.
Comment your program. Include in your comments a list of registers used with an explanation
of how each was used. Submit a hard copy of your source file (.asm) in class on the due date.
In addition, name your source file LastName.asm and upload to Brightspace so I can test it.
2. Consider the MIPS program of Exercise 6.24, shown on page 362. Draw a picture of the
stack after each jal instruction has been executed (jal f and jal f2). Note that f2 is a
recursive function so jal f2 is executed multiple times during the execution of the program.
Make sure to indicate the contents of each stack entry (use xxxxxxxx when unknown) and
the contents of the sp register. Assume sp=0x7FFFFFFC at the start of the program. Show
all numbers in their full 8-chacter hex glory.
3. Translate the following MIPS assembly language program into machine code. Show all
your work in binary, but report the machine code for each instruction in hexadecimal.
4. Translate the following machine code into assembly language. Include register names (not
just numbers), and labels for branch and jump instructions. Assume the code starts at
0x00400000.
0x23BDFFF8
0x01285026
0x1211FFFD
0x15400002
0x8FAE0004
0XA40F0064
0x0000B012
0x0C100000
5. Now that you’ve done all the handwork on the last three problems, use MARS to check
your answers. If you made any mistakes, go back and fix them. Repeat as necessary.