Assignment 6 - CS1104
Assignment 6 - CS1104
Assignment 6 - CS1104
For the Assembly code, we can convert it to binary by understanding the instruction type.
Whether it’s a type A or a type C. Depending on the code format as its broken down with the most
significant bit which indicate the type of an instruction. If a binary value starts with a zero, than this is an
A-Address code, however if it starts with 1, than this is a C-instruction. Regarding the breakdown of a C-
instruction, as given the values of a, c, d, j. Each can tell us what the CPU will do to the next instruction
and how the control bits control the ALU
D=A 1110110000010000, This a C-instruction, which use arth a=0, the des is D=010 and A=110000
D=D+A 1110000010010000, This a C-instruction, which use arth a=0, the des is D=010 and D+A=000010
M=D 1110001100001000, This a C-instruction, which use arth a=0, the des is M=001 and D=001100
Part 2
D=M 1111110000010000, This a C-instruction, which use arth a=1, the des is D=010 and M=110000
D=D-M 1111010011010000, This a C-instruction, which use arth a=1, the des is D=010 and D-M =010011
D;JGT 1110001100000001, This a C-instruction, which use arth a=0, the des is null=000 and JGT=D
=001100 and a jump of 001
D=M 1111110000010000, This a C-instruction, which use arth a=1, the des is D=010 and M=110000
0;JMP 1110101010000111, This a C-instruction, which use arth a=0, the des is null=000 and JMP=0
=101010 and a jump of 111
D=M 1111110000010000, This a C-instruction, which use arth a=1, the des is D=010 and M=110000
M=D 1110001100001000, This a C-instruction, which use arth a=0, the des is M=001 and D=001100
0;JMP 1110101010000111, This a C-instruction, which use arth a=0, the des is null=000 and JMP=0
=101010 and a jump of 111