//==- RISCVSchedXiangShanNanHu.td - XS-NanHu Scheduling Defs -*- 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 // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // XiangShan is a high-performance open-source RISC-V processor developed by // the Institute of Computing Technology (ICT), Chinese Academy of Sciences. // Source: https://github.com/OpenXiangShan/XiangShan // Documentation: https://github.com/OpenXiangShan/XiangShan-doc // XiangShan-NanHu is the second generation of XiangShan processor series. // Overview: https://xiangshan-doc.readthedocs.io/zh-cn/latest/integration/overview/ def XiangShanNanHuModel : SchedMachineModel { let MicroOpBufferSize = 256; let LoopMicroOpBufferSize = 48; // Instruction queue size let IssueWidth = 6; // 6-way decode and dispatch let LoadLatency = 4; let MispredictPenalty = 11; // Based on estimate of pipeline depth. let CompleteModel = 0; let UnsupportedFeatures = [HasStdExtZcmt, HasStdExtZkr, HasVInstructions, HasVInstructionsI64]; } let SchedModel = XiangShanNanHuModel in { // The reservation stations are distributed and grouped as 32-entry or 16-entry smaller ones. let BufferSize = 16 in { def XS2ALU : ProcResource<4>; def XS2MDU : ProcResource<2>; def XS2MISC : ProcResource<1>; def XS2FMAC : ProcResource<4>; def XS2FMISC : ProcResource<2>; // Load/Store queues are ignored. def XS2LD : ProcResource<2>; def XS2ST : ProcResource<2>; } // Branching def : WriteRes; def : WriteRes; def : WriteRes; // Integer arithmetic and logic let Latency = 1 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } // Integer multiplication let Latency = 3 in { def : WriteRes; def : WriteRes; } // Integer division/remainder // SRT16 algorithm let Latency = 20, ReleaseAtCycles = [20] in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } // Zb* let Latency = 1 in { // Zba def : WriteRes; def : WriteRes; // Zbb def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Zbkb def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Zbs def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } let Latency = 3 in { // Zbb def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; // Zbkc def : WriteRes; // Zbkx def : WriteRes; } // Memory def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; let Latency = 5 in { def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } // XiangShan-NanHu uses FuDian FPU instead of Berkeley HardFloat. // Documentation: https://github.com/OpenXiangShan/fudian let Latency = 3 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; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; def : WriteRes; } // FP multiplication let Latency = 3 in { def : WriteRes; def : WriteRes; } let Latency = 5 in { def : WriteRes; def : WriteRes; } // FP division def : WriteRes { let Latency = 11; } def : WriteRes { let Latency = 18; } def : WriteRes { let Latency = 17; } def : WriteRes { let Latency = 31; } // Others def : WriteRes; def : WriteRes; def : InstRW<[WriteIALU], (instrs COPY)>; // Bypass and advance class XS2LoadToALUBypass : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; 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; // Cascade FMA def : ReadAdvance; def : ReadAdvance; // Cascade FMA 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; // Zb* // Zba def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; // Zbb def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : ReadAdvance; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; // Zbkc def : ReadAdvance; // Zbs def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; // Zbkb def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; def : XS2LoadToALUBypass; // Zbkx def : ReadAdvance; //===----------------------------------------------------------------------===// // Unsupported extensions defm : UnsupportedSchedV; defm : UnsupportedSchedZfa; defm : UnsupportedSchedZfh; defm : UnsupportedSchedSFB; defm : UnsupportedSchedZabha; defm : UnsupportedSchedXsfvcp; defm : UnsupportedSchedZvk; }