Lecture 8 - More on Sigma16 Flashcards
When is AND true?
if both operands are true
What is OR false?
if both operands are false
When is XOR true?
if both operands are different.
How do you work out the bitwise XOR of 2 8-bit words?
Compare the binary numbers. If they are the same put 0 and if they are different put 1
When is bitwise AND useful and how would it be used?**
It is useful when you want to isolate a particular bit
Eg., 4 most significant bits.
If we bitwise AND $F0 to the word you want to isolate the 4 most signficant bits in $7D.
$F0 = 1111 0000
$7D = 0111 1101
Since ANDing any bit with 0 gives 0 and ANDing any bit with 1 leaves the bit unchanged we can mask the bits we aren’t interested in so the
bitwise-AND = 0111 0000
What RRR instructions DON’T work with unsigned numbers?
MUL, DIV, CMPGT, CMPLT
What instructions work for non-numerics?
CMPEQ
What is special about R15?
The remainder from DIV always goes in here
Anything in there is overwritten
What is special about R0?
It is always 0
What is an instruction cycle?
The sequence of events & time involved in fetching & executing an instruction.
What is a memory cycle?
The time involved in reading/writing a single word from & to a single memory location (over the data bus)
How many memory cycles are involved in an instruction cycle?*
An instruction cycle may involve several memory cycles:
RRR takes 1 memory cycle (fetch)
RX takes 2 memory cycles
(except for LOAD and STORE which take 3 memory cycles)
So generally RX instructions are twice as slow as RRR instructions
What 2 instructions will you always find in the CPU?
Instruction Register: contains the operation word of the instruction being executed
Program counter: the address of the next instruction that will be executed.
It can be thought of as an index in an array of memory
What 2 registers are specific to Sigma16?
Instruction register: An address register contains the target address (EA) specified in an RX or X instruction
Data register: holds temporary data.
How do you describe the speed of memory cycles?
Accessing memory is a relatively slow process.
RRR instructions are 1 memory cycle because they are already on the circuit.
RX instructions generally take 2 memory cycles.
1 . to find out they are an RX instruction eg., JUMP
2. to find out where to go
LOAD & STORE take 3 memory cycles.
- to find out they are a LOAD/STORE
- to find out what they need to LOAD/STORE
- go to memory to load/store it
What does shiftl and shfitr mean?
If we have Ra, Rb, Rc: shiftl shifts Rb left by Rc places and stores in Ra. We add zeroes to the end of Ra for the spaces that we’ve shifted and on the other side, the bits are shifted out and dropped off.
How many memory cycles does JUMP instruction take?
To fetch it, it has two words of machine code.
So two memory cycles
What questions do we need to ask when examining the machine code instructions on a new CPU?
1) how many memory cycles are needed to fetch the whole instruction?
2) How many cycles are needed to fetch or store data?
3) How many independent memory locations can the instruction access?
Why can’t we have multiple types of instructions in a CPU?
Many complex instructions mean a long operation word and a complex CU.
A CU with many instruction types is slower than a simple one with few types
What is RISC?
Reduced instruction set computer