Let's talk first about the instructions because an instruction, is all the processor cares about.
The main data processing component within a processor is an ALU. The ALU is capable of carrying out some arithmetic & logical operations on data fed to it. So, an instruction may tell the ALU, what operation is to be done and on which data. Apart from alu operations, other major task performed by processor is data moving or data transfer. The data may be moved to/from memory from/to internal registers. Further the processor may want to communicate with peripheral devices.
So, in all, each operation the processor can perform needs to be identified uniquely. An instruction uniquely defines each possible operation.
The instruction, in general, has the following kind of format:
Op-code stands for operational-code which is unique identity of each instruction in the instruction set. Field is the some specific non-implicit info needed to execute a particular instruction. For any instruction set, the op-code is of fixed-length, however the field may or may not be of fixed length.
There are some kinds of instruction worth mentioning here:
- 0-address instructions: for these, the operation to be performed has needs no information to be provided form user (programmer). All operand sources & destination are implicit from op-code itself and thus, only op-code is pesent in instruction.
- 1-address instructions: an operand needs to be specified in field by programmer for such instructions. Any other operand needed for execution & destination of result is implicit in this case.
- 2-address instructions: two operand sources are specified in field in this kind of instructions.
- 3-address instructions: two operand sources & a destination must be specified in field.
- 4-address instructions: along with source operands and destination, the address of next instruction to be executed in specified in field.
The set of all the instructions the processor can execute is called its 'instruction-set'. Designing a processor usually starts with defining the instruction-set for that particular processor.
Based on instruction-set, there are two kinds of processors. One is the CISC (complex instruction set computer) and other is RISC (reduced instruction set computer).
An instruction set with variable instruction length may support two or more of the above instruction kinds.
On the other hand, for an instruction set with fixed-length instructions, the length is decided by the field that needs maximum number of arguments. e.g. if 11-bits of field data is all it takes for longest instruction, then for some instruction that requires no arguments, the field is usually all 0's in it.
Fixed-length instruction set is advantage for easy design of instruction-decode logic. Non-fixed length instructions give complex design but good code density.
Connect with Digital Byte on facebook to get updates.
Articles and stuff addressing the design issues of a digital processor . . .
Like facebook page to get updates :