Day 2 Flashcards
which register holds the instruction to be decoded and executed?
The IR register
- what is o.p?*
- how many o.p are there?*
- a short cut of operation code*
- 5 bits - 32 operaion codes*
Explain immidiate addressing
- why is it called that way?*
- why we can’t always use that?*
- The instruction contains the operand itself(data) rather than an address which points to some data.
- Such an operand is called an immediate operand because it is automatically fetched from memory at the same time the instruction itself is fetched; hence it is immediately available for use.
- 10 bits are saved for the register, thus if the data is of size > 2^17 immediate addressing can’t be done.
Explain direct addressing
- Specifying an operand in memory by giving its full address.
- the instruction will always access exactly the
same memory location. So while the value can change, the location cannot. - Direct addressing can only be used to access global variables whose address is known at compile time.
what is indirect addressing
An address which specifies not the operand but the address of the operand.
what is direct register addressing?
which registers are used?
same as direct addressing but specifies a register instead of a memory location. Usually using a register is faster than using the memory.
It uses the 32 temporary use registers
What is indirect register addressing?
- The operand specified comes from memory or goes to memory
- The address is contained in a register
- When an address is used this way it is called a pointer
- we can now reference memory without having its full address in the instruction
- It can use different memory words on different memory executions of the instruction.
For each instruction determine its addressing type
First three instructions: (note: # means constant)
- First operand - register direct
- Second operand - immediate
Fourth instruction:
- First operand - register direct
- Second operand - register indirect
Fifth instruction:
- First operand - register direct
- Second operand - immediate
- Sixth instruction:*
- First and second operand - register direct
what is register index addressing
- reference memory words at a known offset from a register.
- register + const
what is relative addressing?
- op address = address of PC register + const
- Which instruction use only ra and c1.*
- That is, the instruction is of the form:*
opcode ra c1.
why is there no need for a base register?
- ldr, str, lar*
- There is no need for a base register because the base register is implicit - PC register.*
- ldr ra, PC, c1*
- str ra, PC, c1*
- lar ra, PC, c1*
What is the structure of an instruction?
- 32 bits in total
- 5 bits for instruction code
-
next 5 bits - ra register to which we can add
- c1 constant - up to 22 bits
-
next 5 bits - rb register to which we can add
- c2 constant - up to 17 bits
-
next 5 bits - rc register to which we can add
- c3 constant - up to 12 bits
The ra,rb,rc registers describe one of the 32 registers