Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Computer Architecture question: Write a program that prints the content of the i

ID: 642682 • Letter: C

Question

Computer Architecture question:

Write a program that prints the content of the instruction memory, in effect, disassembling the program. Start with the default program memory address of 0x00400000; read words from the memory sequentially and output the first N instructions on the console. N will be an integer read from the keyboard.

As an example, if you have:

Address Content
------------------------
[0x00400000] 0x3408010a
[0x00400004] 0x3409000c
[0x00400008] 0x01195120

in the memory, the result of running your program with N = 3, would print the following to the console window:

0x3408010a
0x3409000c
0x01195120

Explanation / Answer

addiu $1, $0, 0x3408010a # shouldn't print hex for addiu sw $1, 0X8($3) # shouldn't print hex for sw sll $a1, $a0, 3 # should use reg numbers instead of names srl $6,$7,3 # no spaces between arguments ori $1 $1 0X1234 # forgot commas lui $t0, 0X3409000c # hex should be uppercase and not zero extended j 54345 # address should be in hex jal 00400548 # forgot the leading 0x bne $3, $4, 4 # needs full target address in hex

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote