Section 7.2
Review Questions
Instructions of the CSC-1
-
How many instructions are there in the CSC-1?
answer...
24
-
What is the smallest number of bits you need to encode all these?
(HINT: Take the ceiling of the logarithm base 2 of the above number.)
answer...
5 (since 24 = 16 (too small) and 25 = 32)
-
Write out the format of the LDI instruction.
answer...
0010kkkkkkkkkkkk
-
If the top 4 bits of an instruction are all 1's, what do we automatically
know about the bottom 8 bits?
answer...
they are ignored, there is no operand
-
There are 15 instructions whose opcode is 4 bits long. Why can't we also
have a 16th instruction, whose opcode is 1111?
answer...
because we need that bit pattern as an "escape" to tell the machine
that there are more instructions whose top 4 bits are all 1's
-
In the blank to the left of each instruction below, write its mnemonic.
__________ No Operation (waste cycle)
__________ Subtract memory word xx...from A
__________ Add memory word xx... to A
__________ Load memory word xx... into A
__________ Jump to address xx... if V=1
__________ Boolean bitwise AND of memory with A
__________ Halt the computer
__________ Return from subroutine
__________ Boolean bitwise OR of memory with A
__________ Store A via S (indirect store)
__________ Load constant kk... into A
__________ Boolean bitwise NOT of memory
__________ Jump to address xx... if C=1
__________ Call subroutine xx...
__________ Jump to address xx... if N=1
__________ Copy A into S
__________ Jump to address xx... if Z=1
__________ Copy S into A
__________ Shift Left 1 bit (logical shift)
__________ Jump to address xx... if N=0 and Z=0
__________ Shift Right 1 bit (logical shift)
__________ Load A via S (indirect load)
__________ Store A into memory xx...
__________ Jump to address xx... unconditionally
answer...
___NOP____ No Operation (waste cycle)
___SUB____ Subtract memory word xx...from A
___ADD____ Add memory word xx... to A
___LOD____ Load memory word xx... into A
___JV_____ Jump to address xx... if V=1
___AND____ Boolean bitwise AND of memory with A
___HLT____ Halt the computer
___RET____ Return from subroutine
___OR_____ Boolean bitwise OR of memory with A
___LDS____ Store A via S (indirect store)
___LDI____ Load constant kk... into A
___NOT____ Boolean bitwise NOT of memory
___JC_____ Jump to address xx... if C=1
___CAL____ Call subroutine xx...
___JN_____ Jump to address xx... if N=1
___A2S____ Copy A into S
___JZ_____ Jump to address xx... if Z=1
___S2A____ Copy S into A
___SHL____ Shift Left 1 bit (logical shift)
___JP_____ Jump to address xx... if N=0
___SHR____ Shift Right 1 bit (logical shift)
___LDS____ Load A via S (indirect load)
___STD____ Store A into memory xx...
___JMP____ Jump to address xx... unconditionally