16 bits <------------------> +------------------+ | | Instruction word +------------------+ may be followed by up to 4: +------------------+ | | Extension words +------------------+ .... +------------------+ | | Extension words +------------------+ depending on the need to encode more information (e.g., if some operand is in memory -> extension word encodes the address in memory)
+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ | | | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ Opcode Operand 1 Operand 2 Move: +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ |0 0 | | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ Add: +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ |1 1 | | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ Bit 3 & 4 encodes length of operand: 01 = byte 11 = word (16 bits) 10 = long word (32 bits) So: Add bytes: +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ |1 1 0 1| | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ Add words: +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ |1 1 1 1| | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ Add long words: +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+ |1 1 1 0| | | Instruction word +-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+
How to run the program:
|