Assembly language sits just above the level of the ALU. Usually a machine instru
ID: 3803611 • Letter: A
Question
Assembly language sits just above the level of the ALU. Usually a machine instruction is a sequence of bits, some of which control the ALU. Others decide where the arguments to the ALU will come from, where they will be stored, and how the program execution should advance. In this assignment, you will look at the machine instructions of the Hack architecture and MIPS.
-------------
a. Write the 16 bit code for an A-instruction in Hack that will load the constant 17 into the A register.
b. Write the 16 bit code for a C-instruction in Hack that will add the D and A registers and save the result back to D.
c. Write the 16 bit code for a C-instruction in Hack that will branch to the location held in A if the value in D is less than or equal to zero.
Explanation / Answer
a.) @ 11 // load the constant 17 into the A register
b.) D = D + A // add the D and A registers and save the result back to D
c.) @A
D; JGT //branch to the location held in A if the value in D is less than or equal to zero