Chapter 3: Instructions: Machine Code Flashcards
What can instructions be broken down into?
Can be broken down into fields:
- Opcode
- modifiers
- operands
What is the opcode
what to do
What do modifiers do?
Perform minor changes to the operation
What do operands do?
What to do with the data.
How do MIPS instructions work?
For example, instructions in the 32-bit MIPS architecture usually have a structure that conforms to the following three types: R, I and J.
MIPS: rs, rt?
rs, rt, are the source registers, whilst rd is the destination register
MIPS: shamt?
shamt gives the number of bits to shift in shift operations (lit. shift amount)
MIPS: funct?
funct provides further refinement to the instruction
MIPS: R-type instructions?
R-type instructions are arithmetic-type instructions, for example the assembly code ‘ADDU rd,rs,rt’ adds the numbers stored in the two registers rs and rt and puts the result in rd.
MIPS: I-Type instructions?
I-type are instructions that use immediate or literal values. Instead of using two registers as inputs, these instructions use one register and one data value that is explicitly specified in the instruction inself. Since there is only space in the instruction for 16-bit numbers, the number must be extended to 32 bits. Therefore there are two sets of I-type instruction; one for signed and another unsigned integers.
MIPS: J-type instructions?
J-type are jump-type instructions, where the target will correspond to the instruction address that should be executed next.
Types of instructions for the PIC?
The PIC16F84A instructions can be similarly categorised, though in this case into byte-oriented, bit-oriented, literal and control-type instructions.
Diagram for the instruction types of the PIC?
PIC: Byte-type instructions
Byte-type include arithmetic and logical instructions where one of the inputs is the data in the file register. If another input is required, the instruction will use the accumulator, W.
PIC: Bit-type instructions?
Bit-type allows individual bits within a file register to be accessed. The bit field contains three bits in order to specify which of the 8 bits in the file register should be used.