An instruction format is the layout of an instruction word: which bits form which field. The CPU's decoder relies on it to pull each instruction apart.
Tiny8 has one format, 8 bits wide:
- bits 7–4: the opcode, what to do;
- bits 3–0: the address field, which memory word to use, or where to jump.
So every Tiny8 instruction is exactly two hex digits: opcode, then address. ADD E is 3E.
Sizing a format uses one fact: n bits give 2ⁿ patterns.
- Opcode bits for k instructions: the smallest n with 2ⁿ ≥ k. Round up.
- Address bits for N words: the smallest n with 2ⁿ ≥ N.
- The instruction width is the sum of its fields.
Other machines have several formats, with fields for registers or constants. A three-register format might be opcode | Rd | Rs | Rt, where each register field needs enough bits to name every register in the register file.