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

What high-level languages call goto is usually called a jump instruction in asse

ID: 1715980 • Letter: W

Question

What high-level languages call goto is usually called a jump instruction in assembly language, but there is a problem in that you can't fit an opcode and a full 32-bit address inside a single 32-bit instruction word. In many ISAs, this is resolved by making the jump instruction longer -- here, two 32-bit words: the first holds the jmp opcode and the second has no opcode, but holds the 32-bit address to get the next instruction from. In other words, that second 32-bit word should end up getting copied into the PC. Add states to the following to implement this two-word jmp. (Hint: after fetching the first word of the jmp instruction, the PC holds the address of the second word.)

when op() op(4) Jmp

Start:
PCout, MARin, MEMread, Yin
CONST(4), ALUadd, Zin, UNTILmfc
MDRout, IRin
Zout, PCin, JUMPonop
HALT /* Should end here on undecoded op */

Jmp:
/* YOUR STATES GO HERE! */

Explanation / Answer

when op() op(4) Jmp

Start:
PCout, MARin, MEMread, Yin
CONST(4), ALUadd, Zin, UNTILmfc
MDRout, IRin
Zout, PCin, JUMPonop
HALT /* Should end here on undecoded op */

Jmp:

PCout, MDRin, MEMread
UNTILmfc
MDRout, PCin, JUMP(Start)

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