- The target computer is a type of byte-addressable machine. It has 4 bytes to a word.
- The target machine has n general purpose registers, R0, R1,...., Rn-1. It also has two-address instructions of the form:
Where, op is used as an op-code and source and destination are used as a data field.
- It has the following op-codes:
ADD (add source to destination)
SUB (subtract source from destination)
MOV (move source to destination)
- The source and destination of an instruction can be specified by the combination of registers and memory location with address modes.
||Add R0, R1
||Add temp, R1
||ADD 100 (R2), R1
||ADD * 100
||ADD #3, R1
- Here, cost 1 means that it occupies only one word of memory.
- Each instruction has a cost of 1 plus added costs for the source and destination.
- Instruction cost = 1 + cost is used for source and destination mode.
1. Move register to memory R0 → M
2. Indirect indexed mode:
3. Literal Mode: