# Register Renaming

The Internal Register Addresses are of the following format:

    ---
    config:
        packet:
            bitsPerRow: 8
    ---
    packet-beta
        0-3: "Unit Number"
        4-7: "Unit's Output Register"

The general idea is that every Unit has its own set of output registers that are only ever written by that Unit. Internal Register Addresses are also used as a handle for the corresponding instruction, for tracking when instructions are no longer speculative, cancelling mis-speculated instructions, and tracking when to retire instructions. Therefore, instructions that don't write any registers (such as stores) still have a Internal Register Address allocated for them.

## L2 Register File

Because each Unit doesn't necessarily have enough output registers to hold all ISA-level registers (e.g. a pathological sequence of divide instructions targetting each ISA-level register in sequence), the L2 Register File is used to hold ISA-level registers when there aren't enough registers available in the Unit that last wrote to the corresponding ISA-level register. The Register Renamer will automatically insert moves to and from the L2 Register File when a Unit runs out of registers or when ISA-level registers currently in the L2 Register File are read.

## Distributed Registers (May or may not be a good idea)

All Units' Output Registers are actually stored distributed in duplicated register files positioned at the beginning of every Unit's pipeline, this allows for faster reads from Units' Output Registers, as well as allowing register files to be more optimal for FPGAs since FPGAs tend to only support at most 2-port register files.