Magic‐1 Microcode Architecture: Loading Process - retrotruestory/M1DEV GitHub Wiki

Based on the provided source files, here's how the Magic-1's microcode system works:

Magic-1 Microcode Architecture

1. Microinstruction Format

The microcode uses 56-bit wide instructions with the following fields:

typedef struct {
    unsigned next:8;        // Next microinstruction address
    unsigned latch:4;       // Register latch control
    unsigned lmar:1;        // Latch MAR
    unsigned lmdrlo:1;      // Latch MDR low byte
    unsigned lmdrhi:1;      // Latch MDR high byte 
    unsigned emdrlo:1;      // Drive MDR low byte
    unsigned emdrhi:1;      // Drive MDR high byte
    unsigned priv:1;        // Privileged instruction
    unsigned lmode:1;       // Latch mode bit
    unsigned lpaging:1;     // Latch paging enable
    unsigned misc:4;        // Miscellaneous control
    unsigned e_l:4;         // Left bus enable
    unsigned e_r:2;         // Right bus enable
    unsigned immval:2;      // Immediate value
    unsigned aluop:2;       // ALU operation
    unsigned carry:1;       // Carry control
    unsigned l_size:1;      // Latch size
    unsigned br_sense:1;    // Branch sense
    unsigned user_ptb:1;    // User page table base
    unsigned code_ptb:1;    // Code/data selection
} mcode_rec_t;

2. Loading Process

  1. The microcode is stored in 5 PROMs (512x8 bits each):
// Each PROM holds different fields of the 56-bit microinstruction
prom0.hex - Contains MSBs (next field)
prom1.hex - Contains next set of control bits
prom2.hex - Contains middle control bits  
prom3.hex - Contains additional control bits
prom4.hex - Contains LSBs
  1. Microcode initialization:
// The microcode ROM is addressed by:
- Direct opcode (bottom 256 locations)
- Microcode sequencing (upper 256 locations)

3. Instruction Execution

  1. Initial decode:
// Opcode directly indexes into microcode ROM
next_address = instruction[15:8];  
  1. Microsequencing:
// Next address comes from:
- Microinstruction next field
- Priority encoder output
- Direct opcode mapping
  1. Control signals:
// Each cycle generates:
- Bus control signals
- Register control signals
- ALU control
- Memory control
- Branch control

4. Key Features

  • 512 microinstructions total
  • 256 opcodes directly mapped
  • 256 microcode sequences
  • Hardware page table support
  • Privilege levels
  • Multiple addressing modes

The microcode provides the fundamental control layer between the instruction set architecture and hardware implementation.