Core Model¶
The core model in ChampSim is split into an interface and a default implementation:
champsim::modules::core_moduleis the abstract interface that defines the contract all core implementations must fulfill. Branch predictors and BTBs interact with their parent core through this interface.O3_CPUis the default implementation ofcore_module(registered as"DEFAULT_CORE"). It provides an aggressive out-of-order execution model with configurable pipeline widths, buffer sizes, and latencies.
Configuration Parameters¶
Buffer and Queue Sizes¶
ifetch_buffer_sizeInstruction fetch buffer capacity.
dispatch_buffer_sizeDispatch buffer capacity.
decode_buffer_sizeDecode buffer capacity.
rob_sizeReorder buffer size.
lq_sizeLoad queue capacity.
sq_sizeStore queue capacity.
register_file_sizeRegister file size.
dib_hit_buffer_sizeDecoded instruction buffer (DIB) hit buffer size.
Pipeline Widths¶
fetch_width,decode_width,dispatch_width,schedule_width,execute_width,retire_widthMaximum number of instructions processed per cycle in each pipeline stage.
lq_width/sq_widthLoad and store queue widths per cycle.
l1i_bandwidth/l1d_bandwidthL1 instruction and data cache bandwidth.
dib_inorder_widthDIB in-order processing width.
Pipeline Latencies¶
decode_latency,dispatch_latency,schedule_latency,execute_latencyLatency (in cycles) for each pipeline stage.
mispredict_penaltyBranch misprediction penalty in cycles.
dib_hit_latencyLatency for a DIB hit.
Decoded Instruction Buffer (DIB)¶
dib_set,dib_way,dib_windowSet/way/window geometry of the decoded instruction buffer.
Submodules¶
Each O3_CPU instance has two submodules attached through its "children" array:
A branch predictor (
"module": "branch_predictor"), e.g.hashed_perceptron,bimodal,gshare,perceptron.A BTB (
"module": "btb"), e.g.basic_btb.
Pipeline Stages¶
The O3_CPU models a full out-of-order pipeline. Each cycle, operate() drives
the following stages:
Fetch (
fetch_instruction()): Fetch instructions from the L1I cache into theIFETCH_BUFFER.DIB Check (
check_dib()): Check the decoded instruction buffer for hits.Decode (
decode_instruction()): Move instructions from the fetch buffer throughpromote_to_decode()into theDECODE_BUFFER.Dispatch (
dispatch_instruction()): Dispatch decoded instructions into theROB.Schedule (
schedule_instruction()): Select ready instructions for execution.Execute (
execute_instruction()): Execute instructions, including memory operations viaoperate_lsq().Complete (
complete_inflight_instruction()): Complete in-flight instructions and handle memory returns (handle_memory_return()).Retire (
retire_rob()): Retire completed instructions from theROB.
Internal Buffers¶
IFETCH_BUFFERHolds fetched instructions waiting to be decoded.
DECODE_BUFFERHolds instructions being decoded.
DISPATCH_BUFFERHolds decoded instructions waiting for dispatch into the ROB.
ROBReorder buffer — tracks all in-flight instructions.
DIB_HIT_BUFFERBuffer for instructions that hit in the decoded instruction buffer.
LQLoad queue — tracks outstanding loads.
SQStore queue — tracks outstanding stores.
Key Public Methods¶
Lifecycle hooks¶
initialize(),begin_phase(),end_phase()Called by the simulation framework at appropriate lifecycle points.
operate()Main per-cycle function that drives all pipeline stages.
Statistics¶
sim_instr()/sim_cycle()/roi_instr()/roi_cycle()Return instruction and cycle counts for simulation and region-of-interest phases.
get_sim_stats()/get_roi_stats()Return full performance counter structures.
Module Interface Hooks¶
The O3_CPU class delegates to its submodules through these internal hooks:
- Branch predictor hooks:
impl_initialize_branch_predictor(),impl_predict_branch(),impl_last_branch_result()- BTB hooks:
impl_initialize_btb(),impl_update_btb(),impl_btb_prediction()