//==- RISCVSchedRocket.td - Rocket Scheduling Definitions ----*- tablegen -*-=// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // ===---------------------------------------------------------------------===// // The following definitions describe the simpler per-operand machine model. // This works with MachineScheduler. See MCSchedule.h for details. // Rocket machine model for scheduling and other instruction cost heuristics. def RocketModel : SchedMachineModel { let MicroOpBufferSize = 0; // Rocket is in-order. let IssueWidth = 1; // 1 micro-op is dispatched per cycle. let LoadLatency = 3; let MispredictPenalty = 3; let UnsupportedFeatures = [HasStdExtV, HasStdExtZvamo, HasStdExtZvlsseg]; } //===----------------------------------------------------------------------===// // Define each kind of processor resource and number available. // Modeling each pipeline as a ProcResource using the BufferSize = 0 since // Rocket is in-order. let BufferSize = 0 in { def RocketUnitALU : ProcResource<1>; // Int ALU def RocketUnitIMul : ProcResource<1>; // Int Multiply def RocketUnitMem : ProcResource<1>; // Load/Store def RocketUnitB : ProcResource<1>; // Branch def RocketUnitFPALU : ProcResource<1>; // FP ALU } let BufferSize = 1 in { def RocketUnitIDiv : ProcResource<1>; // Int Division def RocketUnitFPDivSqrt : ProcResource<1>; // FP Divide/Sqrt } //===----------------------------------------------------------------------===// let SchedModel = RocketModel in { // Branching def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Integer arithmetic and logic def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Integer multiplication let Latency = 4 in { def : WriteRes; def : WriteRes; } // Integer division // Worst case latency is used. def : WriteRes { let Latency = 34; let ResourceCycles = [34]; } def : WriteRes { let Latency = 33; let ResourceCycles = [33]; } // Memory def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; let Latency = 3 in { def : WriteRes; def : WriteRes; } let Latency = 2 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Atomic memory def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } def : WriteRes; def : WriteRes; // Single precision. let Latency = 4 in { def : WriteRes; def : WriteRes; def : WriteRes; } // Double precision let Latency = 6 in { def : WriteRes; def : WriteRes; def : WriteRes; } // Conversions let Latency = 2 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } // FP multiplication let Latency = 5 in { def : WriteRes; def : WriteRes; def : WriteRes; } let Latency = 7 in { def : WriteRes; def : WriteRes; def : WriteRes; } // FP division // FP division unit on Rocket is not pipelined, so set resource cycles to latency. let Latency = 20, ResourceCycles = [20] in { def : WriteRes; def : WriteRes; } // FP square root unit on Rocket is not pipelined, so set resource cycles to latency. def : WriteRes { let Latency = 20; let ResourceCycles = [20]; } def : WriteRes { let Latency = 25; let ResourceCycles = [25]; } // Others def : WriteRes; def : WriteRes; def : InstRW<[WriteIALU], (instrs COPY)>; //===----------------------------------------------------------------------===// // Bypass and advance def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; }