//! Phase 8a: R-SPU Core Type Definitions
//!
//! Defines the standard 64-bit tagged-word architecture for the R-SPU.
//! All data words in the datapath and register file follow this format.

// --- Extraction Patterns (Correctly Masked for Width Inference) ---

def extract_data(word: signal in u64, out: signal out u64) {
    reflect {
        reflex do_extract {
            on always {
                // Prove 32-bit range to the width inference engine
                ${out} = ${word} & 4294967295;
            }
        }
    }
}

def extract_tag(word: signal in u64, out: signal out u64) {
    reflect {
        reflex do_extract_tag {
            on always {
                // Prove 4-bit range to the width inference engine
                ${out} = (${word} >> 32) & 15;
            }
        }
    }
}

def extract_provenance(word: signal in u64, out: signal out u64) {
    reflect {
        reflex do_extract_prov {
            on always {
                // Prove 4-bit range to the width inference engine
                ${out} = (${word} >> 36) & 15;
            }
        }
    }
}

module types {}
