MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / load_use_hazard

Function load_use_hazard

crates/virtual-machine/src/cpu/hazard_unit.rs:104–113  ·  view source on GitHub ↗

Returns true if `id_ex` is a load whose result is needed by the instruction currently in the IF/ID register (identified by its raw-word rs1/rs2 fields).

(id_ex: &IDEXReg, if_id_rs1: usize, if_id_rs2: usize)

Source from the content-addressed store, hash-verified

102
103// --- Data forwarding ---
104
105pub struct ForwardedValues {
106 pub rs1: u64,
107 pub rs2: u64,
108 pub frs1: u64,
109 pub frs2: u64,
110}
111
112/// The rs1/rs2/frs1/frs2 values for EX with forwarding applied: EX/MEM (newest producer)
113/// beats MEM/WB, and load results skip EX/MEM since their data only exists after MEM.
114pub fn compute_forwarding(
115 ex_mem: Option<&EXMEMReg>,
116 mem_wb: Option<&MEMWBReg>,

Callers 1

tickMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected