11.2.3 Instructions in Program Memory
The program memory is addressed in bytes. Instructions are stored as either two bytes or four bytes in program memory. The Least Significant Byte of an instruction word is always stored in a program memory location with an even address (LSb = 0). To maintain alignment with instruction boundaries, the PC increments in steps of two and the LSb will always read ‘0’ (see 11.1.1 Program Counter).
The Instructions in Program Memory figure below shows how instruction words are stored in the program memory.
The CALL
and GOTO
instructions have the absolute program memory
address embedded into the instruction. Since instructions are always stored on word
boundaries, the data contained in the instruction is a word address. The word address is
written to PC[20:1], which accesses the desired byte address in program memory. Instruction
#2 in the example shows how the instruction GOTO
0006h
is encoded in the program memory. Program branch instructions, which
encode a relative address offset, operate in the same manner. The offset value stored in a
branch instruction represents the number of single-word instructions that the PC will be
offset by. The Instruction Set Summary provides further details of the instruction set.