110 likes | 238 Views
Computer Science 210 Computer Organization. Machine Language Instructions: Computation. Types of Instructions. Operate (computation): NOT, AND, ADD Data movement: LD, LDR, LDI, LEA, ST, STR, STI Control: BR, JMP, JSR, JSRR, RET, RTI, TRAP. Bitwise NOT.
E N D
Computer Science 210Computer Organization Machine Language Instructions: Computation
Types of Instructions • Operate (computation): NOT, AND, ADD • Data movement: LD, LDR, LDI, LEA, ST, STR, STI • Control: BR, JMP, JSR, JSRR, RET, RTI, TRAP
Bitwise NOT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst NOT RSrc NOT Dst Src 1 1 1 1 1 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 R3 NOT R5 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1
Data Path for NOT 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 NOT Dst Src 1 1 1 1 1 1 RDst NOT RSrc
Bitwise AND (2 flavors) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst RSrc1 AND RSrc2 AND Dst Src1 0 0 0 Src2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst RSrc1 AND Data AND Dst Src1 1 imm5 Data is the sign-extend of imm5 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Clear R1 0 1 0 10 0 10 011 0 0 0 0 0
ADD (2 flavors) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst RSrc1 ADD RSrc2 ADD Dst Src1 0 0 0 Src2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst RSrc1 ADD Data ADD Dst Src1 1 imm5 Data is the sign-extend of imm5 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Increment R1 0 0 0 10 0 10 011 0 0 0 0 1
Data Path for AND/ADD (register mode) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 AND Dst Src1 0 0 0 Src2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ADD Dst Src1 0 0 0 Src2 RDst RSrc1 AND RSrc2 0 bit means register mode RDst RSrc1 ADD RSrc2
Data Path for AND/ADD (immediate mode) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 AND Dst Src1 1 imm5 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ADD Dst Src1 1 imm5 RDst RSrc1 AND Data 1 bit means immediate mode RDst RSrc1 ADD Data
Other Useful Operations • Decrement the contents of a given register • Copy the contents of RA to RB • Subtract RB from RA and store the result in RC
The LC-3 Simulator • Various versions, ours comes from U Texas • Supports assembly, loading of object files, and visualized execution • Next, Step, Finish, Continue, Stop • Can edit PC, registers, and memory
Using the Simulator • Run /opt/lc3tools/lc3sim-tk • Enter instructions starting at x3000 • Set PC to x3000, then Next or Continue