xref: /XiangShan/src/main/scala/xiangshan/Parameters.scala (revision 1e7e38e2498daaff4a2534de61a8b52f72d039be)
1/***************************************************************************************
2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
3* Copyright (c) 2020-2021 Peng Cheng Laboratory
4*
5* XiangShan is licensed under Mulan PSL v2.
6* You can use this software according to the terms and conditions of the Mulan PSL v2.
7* You may obtain a copy of Mulan PSL v2 at:
8*          http://license.coscl.org.cn/MulanPSL2
9*
10* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13*
14* See the Mulan PSL v2 for more details.
15***************************************************************************************/
16
17package xiangshan
18
19import org.chipsalliance.cde.config.{Field, Parameters}
20import chisel3._
21import chisel3.util._
22import huancun._
23import system.SoCParamsKey
24import system.CVMParamskey
25import xiangshan.backend.datapath.RdConfig._
26import xiangshan.backend.datapath.WbConfig._
27import xiangshan.backend.exu.ExeUnitParams
28import xiangshan.backend.fu.FuConfig._
29import xiangshan.backend.issue.{IntScheduler, IssueBlockParams, MemScheduler, SchdBlockParams, SchedulerType, VfScheduler, FpScheduler}
30import xiangshan.backend.regfile._
31import xiangshan.backend.BackendParams
32import xiangshan.backend.trace._
33import xiangshan.cache.DCacheParameters
34import xiangshan.frontend.{BasePredictor, BranchPredictionResp, FTB, FakePredictor, RAS, Tage, ITTage, Tage_SC, FauFTB}
35import xiangshan.frontend.icache.ICacheParameters
36import xiangshan.cache.mmu.{L2TLBParameters, TLBParameters}
37import xiangshan.frontend._
38import xiangshan.frontend.icache.ICacheParameters
39import freechips.rocketchip.diplomacy.AddressSet
40import freechips.rocketchip.tile.MaxHartIdBits
41import system.SoCParamsKey
42import huancun._
43import huancun.debug._
44import xiangshan.cache.wpu.WPUParameters
45import coupledL2._
46import coupledL2.tl2chi._
47import xiangshan.backend.datapath.WakeUpConfig
48import xiangshan.mem.prefetch.{PrefetcherParams, SMSParams}
49
50import scala.math.{max, min, pow}
51
52case object XSTileKey extends Field[Seq[XSCoreParameters]]
53
54case object XSCoreParamsKey extends Field[XSCoreParameters]
55
56case class XSCoreParameters
57(
58  HasPrefetch: Boolean = false,
59  HartId: Int = 0,
60  XLEN: Int = 64,
61  VLEN: Int = 128,
62  ELEN: Int = 64,
63  HSXLEN: Int = 64,
64  HasBitmapCheck: Boolean = false,
65  HasBitmapCheckDefault: Boolean = false,
66  HasMExtension: Boolean = true,
67  HasCExtension: Boolean = true,
68  HasHExtension: Boolean = true,
69  HasDiv: Boolean = true,
70  HasICache: Boolean = true,
71  HasDCache: Boolean = true,
72  AddrBits: Int = 64,
73  PAddrBitsMax: Int = 56,   // The bits of physical address from Sv39/Sv48/Sv57 virtual address translation.
74  VAddrBitsSv39: Int = 39,
75  GPAddrBitsSv39x4: Int = 41,
76  VAddrBitsSv48: Int = 48,
77  GPAddrBitsSv48x4: Int = 50,
78  HasFPU: Boolean = true,
79  HasVPU: Boolean = true,
80  HasCustomCSRCacheOp: Boolean = true,
81  FetchWidth: Int = 8,
82  AsidLength: Int = 16,
83  VmidLength: Int = 14,
84  EnableBPU: Boolean = true,
85  EnableBPD: Boolean = true,
86  EnableRAS: Boolean = true,
87  EnableLB: Boolean = false,
88  EnableLoop: Boolean = true,
89  EnableSC: Boolean = true,
90  EnbaleTlbDebug: Boolean = false,
91  EnableClockGate: Boolean = true,
92  EnableJal: Boolean = false,
93  EnableFauFTB: Boolean = true,
94  EnableSv48: Boolean = true,
95  UbtbGHRLength: Int = 4,
96  // HistoryLength: Int = 512,
97  EnableGHistDiff: Boolean = true,
98  EnableCommitGHistDiff: Boolean = true,
99  UbtbSize: Int = 256,
100  FtbSize: Int = 2048,
101  FtbWays: Int = 4,
102  FtbTagLength: Int = 20,
103  RasSize: Int = 16,
104  RasSpecSize: Int = 32,
105  RasCtrSize: Int = 3,
106  CacheLineSize: Int = 512,
107  TageTableInfos: Seq[Tuple3[Int,Int,Int]] =
108  //       Sets  Hist   Tag
109    Seq(( 4096,    8,    8),
110        ( 4096,   13,    8),
111        ( 4096,   32,    8),
112        ( 4096,  119,    8)),
113  ITTageTableInfos: Seq[Tuple3[Int,Int,Int]] =
114  //      Sets  Hist   Tag
115    Seq(( 256,    4,    9),
116        ( 256,    8,    9),
117        ( 512,   13,    9),
118        ( 512,   16,    9),
119        ( 512,   32,    9)),
120  SCNRows: Int = 512,
121  SCNTables: Int = 4,
122  SCCtrBits: Int = 6,
123  SCHistLens: Seq[Int] = Seq(0, 4, 10, 16),
124  numBr: Int = 2,
125  branchPredictor: (BranchPredictionResp, Parameters) => Tuple2[Seq[BasePredictor], BranchPredictionResp] =
126  (resp_in: BranchPredictionResp, p: Parameters) => {
127    val ftb = Module(new FTB()(p))
128    val uftb = Module(new FauFTB()(p))
129    val tage = Module(new Tage_SC()(p))
130    val ras = Module(new RAS()(p))
131    val ittage = Module(new ITTage()(p))
132    val preds = Seq(uftb, tage, ftb, ittage, ras)
133    preds.map(_.io := DontCare)
134
135    ftb.io.fauftb_entry_in  := uftb.io.fauftb_entry_out
136    ftb.io.fauftb_entry_hit_in := uftb.io.fauftb_entry_hit_out
137
138    uftb.io.in.bits.resp_in(0) := resp_in
139    tage.io.in.bits.resp_in(0) := uftb.io.out
140    ftb.io.in.bits.resp_in(0) := tage.io.out
141    ittage.io.in.bits.resp_in(0) := ftb.io.out
142    ras.io.in.bits.resp_in(0) := ittage.io.out
143
144    (preds, ras.io.out)
145  },
146  ICacheForceMetaECCError: Boolean = false,
147  ICacheForceDataECCError: Boolean = false,
148  IBufSize: Int = 48,
149  IBufNBank: Int = 6, // IBuffer bank amount, should divide IBufSize
150  DecodeWidth: Int = 6,
151  RenameWidth: Int = 6,
152  CommitWidth: Int = 8,
153  RobCommitWidth: Int = 8,
154  RabCommitWidth: Int = 6,
155  MaxUopSize: Int = 65,
156  EnableRenameSnapshot: Boolean = true,
157  RenameSnapshotNum: Int = 4,
158  FtqSize: Int = 64,
159  EnableLoadFastWakeUp: Boolean = true, // NOTE: not supported now, make it false
160  IntLogicRegs: Int = 32,
161  FpLogicRegs: Int = 32 + 1 + 1, // 1: I2F, 1: stride
162  VecLogicRegs: Int = 32 + 15, // 15: tmp
163  V0LogicRegs: Int = 1, // V0
164  VlLogicRegs: Int = 1, // Vl
165  V0_IDX: Int = 0,
166  Vl_IDX: Int = 0,
167  NRPhyRegs: Int = 192,
168  VirtualLoadQueueSize: Int = 72,
169  LoadQueueRARSize: Int = 72,
170  LoadQueueRAWSize: Int = 32, // NOTE: make sure that LoadQueueRAWSize is power of 2.
171  RollbackGroupSize: Int = 8,
172  LoadQueueReplaySize: Int = 72,
173  LoadUncacheBufferSize: Int = 4,
174  LoadQueueNWriteBanks: Int = 8, // NOTE: make sure that LoadQueueRARSize/LoadQueueRAWSize is divided by LoadQueueNWriteBanks
175  StoreQueueSize: Int = 56,
176  StoreQueueNWriteBanks: Int = 8, // NOTE: make sure that StoreQueueSize is divided by StoreQueueNWriteBanks
177  StoreQueueForwardWithMask: Boolean = true,
178  VlsQueueSize: Int = 8,
179  RobSize: Int = 160,
180  RabSize: Int = 256,
181  VTypeBufferSize: Int = 64, // used to reorder vtype
182  IssueQueueSize: Int = 24,
183  IssueQueueCompEntrySize: Int = 16,
184  intPreg: PregParams = IntPregParams(
185    numEntries = 224,
186    numRead = None,
187    numWrite = None,
188  ),
189  fpPreg: PregParams = FpPregParams(
190    numEntries = 192,
191    numRead = None,
192    numWrite = None,
193  ),
194  vfPreg: VfPregParams = VfPregParams(
195    numEntries = 128,
196    numRead = None,
197    numWrite = None,
198  ),
199  v0Preg: V0PregParams = V0PregParams(
200    numEntries = 22,
201    numRead = None,
202    numWrite = None,
203  ),
204  vlPreg: VlPregParams = VlPregParams(
205    numEntries = 32,
206    numRead = None,
207    numWrite = None,
208  ),
209  IntRegCacheSize: Int = 16,
210  MemRegCacheSize: Int = 12,
211  intSchdVlWbPort: Int = 0,
212  vfSchdVlWbPort: Int = 1,
213  prefetcher: Option[PrefetcherParams] = Some(SMSParams()),
214  IfuRedirectNum: Int = 1,
215  LoadPipelineWidth: Int = 3,
216  StorePipelineWidth: Int = 2,
217  VecLoadPipelineWidth: Int = 2,
218  VecStorePipelineWidth: Int = 2,
219  VecMemSrcInWidth: Int = 2,
220  VecMemInstWbWidth: Int = 1,
221  VecMemDispatchWidth: Int = 1,
222  VecMemDispatchMaxNumber: Int = 16,
223  VecMemUnitStrideMaxFlowNum: Int = 2,
224  VecMemLSQEnqIteratorNumberSeq: Seq[Int] = Seq(16, 16, 16, 16, 16, 16),
225  StoreBufferSize: Int = 16,
226  StoreBufferThreshold: Int = 7,
227  EnsbufferWidth: Int = 2,
228  LoadDependencyWidth: Int = 2,
229  // ============ VLSU ============
230  VlMergeBufferSize: Int = 16,
231  VsMergeBufferSize: Int = 16,
232  UopWritebackWidth: Int = 2,
233  VLUopWritebackWidth: Int = 2,
234  VSUopWritebackWidth: Int = 1,
235  VSegmentBufferSize: Int = 8,
236  // ==============================
237  UncacheBufferSize: Int = 4,
238  EnableLoadToLoadForward: Boolean = false,
239  EnableFastForward: Boolean = true,
240  EnableLdVioCheckAfterReset: Boolean = true,
241  EnableSoftPrefetchAfterReset: Boolean = true,
242  EnableCacheErrorAfterReset: Boolean = true,
243  EnableAccurateLoadError: Boolean = true,
244  EnableUncacheWriteOutstanding: Boolean = false,
245  EnableHardwareStoreMisalign: Boolean = true,
246  EnableHardwareLoadMisalign: Boolean = true,
247  EnableStorePrefetchAtIssue: Boolean = false,
248  EnableStorePrefetchAtCommit: Boolean = false,
249  EnableAtCommitMissTrigger: Boolean = true,
250  EnableStorePrefetchSMS: Boolean = false,
251  EnableStorePrefetchSPB: Boolean = false,
252  HasCMO: Boolean = true,
253  MMUAsidLen: Int = 16, // max is 16, 0 is not supported now
254  MMUVmidLen: Int = 14,
255  ReSelectLen: Int = 7, // load replay queue replay select counter len
256  iwpuParameters: WPUParameters = WPUParameters(
257    enWPU = false,
258    algoName = "mmru",
259    isICache = true,
260  ),
261  dwpuParameters: WPUParameters = WPUParameters(
262    enWPU = false,
263    algoName = "mmru",
264    enCfPred = false,
265    isICache = false,
266  ),
267  itlbParameters: TLBParameters = TLBParameters(
268    name = "itlb",
269    fetchi = true,
270    useDmode = false,
271    NWays = 48,
272  ),
273  itlbPortNum: Int = ICacheParameters().PortNumber + 1,
274  ipmpPortNum: Int = 2 * ICacheParameters().PortNumber + 1,
275  ldtlbParameters: TLBParameters = TLBParameters(
276    name = "ldtlb",
277    NWays = 48,
278    outReplace = false,
279    partialStaticPMP = true,
280    outsideRecvFlush = true,
281    saveLevel = false,
282    lgMaxSize = 4
283  ),
284  sttlbParameters: TLBParameters = TLBParameters(
285    name = "sttlb",
286    NWays = 48,
287    outReplace = false,
288    partialStaticPMP = true,
289    outsideRecvFlush = true,
290    saveLevel = false,
291    lgMaxSize = 4
292  ),
293  hytlbParameters: TLBParameters = TLBParameters(
294    name = "hytlb",
295    NWays = 48,
296    outReplace = false,
297    partialStaticPMP = true,
298    outsideRecvFlush = true,
299    saveLevel = false,
300    lgMaxSize = 4
301  ),
302  pftlbParameters: TLBParameters = TLBParameters(
303    name = "pftlb",
304    NWays = 48,
305    outReplace = false,
306    partialStaticPMP = true,
307    outsideRecvFlush = true,
308    saveLevel = false,
309    lgMaxSize = 4
310  ),
311  l2ToL1tlbParameters: TLBParameters = TLBParameters(
312    name = "l2tlb",
313    NWays = 48,
314    outReplace = false,
315    partialStaticPMP = true,
316    outsideRecvFlush = true,
317    saveLevel = false
318  ),
319  refillBothTlb: Boolean = false,
320  btlbParameters: TLBParameters = TLBParameters(
321    name = "btlb",
322    NWays = 48,
323  ),
324  l2tlbParameters: L2TLBParameters = L2TLBParameters(),
325  NumPerfCounters: Int = 16,
326  icacheParameters: ICacheParameters = ICacheParameters(
327    tagECC = Some("parity"),
328    dataECC = Some("parity"),
329    replacer = Some("setplru"),
330    cacheCtrlAddressOpt = Some(AddressSet(0x38022080, 0x7f))
331  ),
332  dcacheParametersOpt: Option[DCacheParameters] = Some(DCacheParameters(
333    tagECC = Some("secded"),
334    dataECC = Some("secded"),
335    replacer = Some("setplru"),
336    nMissEntries = 16,
337    nProbeEntries = 8,
338    nReleaseEntries = 18,
339    nMaxPrefetchEntry = 6,
340    enableTagEcc = true,
341    enableDataEcc = true,
342    cacheCtrlAddressOpt = Some(AddressSet(0x38022000, 0x7f))
343  )),
344  L2CacheParamsOpt: Option[L2Param] = Some(L2Param(
345    name = "l2",
346    ways = 8,
347    sets = 1024, // default 512KB L2
348    prefetch = Seq(coupledL2.prefetch.PrefetchReceiverParams(), coupledL2.prefetch.BOPParameters(),
349      coupledL2.prefetch.TPParameters()),
350  )),
351  L2NBanks: Int = 1,
352  usePTWRepeater: Boolean = false,
353  softTLB: Boolean = false, // dpi-c l1tlb debug only
354  softPTW: Boolean = false, // dpi-c l2tlb debug only
355  softPTWDelay: Int = 1,
356  hasMbist: Boolean = false,
357  wfiResume: Boolean = true,
358  hasSramCtl: Boolean = false,
359){
360  def ISABase = "rv64i"
361  def ISAExtensions = Seq(
362    // single letter extensions, in canonical order
363    "i", "m", "a", "f", "d", "c", /* "b", */ "v", "h",
364    // multi-letter extensions, sorted alphanumerically
365    "sdtrig", "sha", "shcounterenw", "shgatpa", "shlcofideleg", "shtvala", "shvsatpa", "shvstvala",
366    "shvstvecd", "smaia", "smcsrind", "smdbltrp", "smmpm", "smnpm", "smrnmi", "smstateen",
367    "ss1p13", "ssaia", "ssccptr", "sscofpmf", "sscounterenw", "sscsrind", "ssdbltrp", "ssnpm",
368    "sspm", "ssstateen", "ssstrict", "sstc", "sstvala", "sstvecd", "ssu64xl", "supm", "sv39",
369    "sv48", "svade", "svbare", "svinval", "svnapot", "svpbmt", "za64rs", "zacas", "zawrs", "zba",
370    "zbb", "zbc", "zbkb", "zbkc", "zbkx", "zbs", "zcb", "zcmop", "zfa", "zfh", "zfhmin", "zic64b",
371    "zicbom", "zicbop", "zicboz", "ziccamoa", "ziccif", "zicclsm", "ziccrse", "zicntr", "zicond",
372    "zicsr", "zifencei", "zihintntl", "zihintpause", "zihpm", "zimop", "zkn", "zknd", "zkne", "zknh",
373    "zksed", "zksh", "zkt", "zvbb", "zvfh", "zvfhmin", "zvkt", "zvl128b", "zvl32b", "zvl64b"
374  )
375
376  def vlWidth = log2Up(VLEN) + 1
377
378  /**
379   * the minimum element length of vector elements
380   */
381  val minVecElen: Int = 8
382
383  /**
384   * the maximum number of elements in vector register
385   */
386  val maxElemPerVreg: Int = VLEN / minVecElen
387
388  val allHistLens = SCHistLens ++ ITTageTableInfos.map(_._2) ++ TageTableInfos.map(_._2) :+ UbtbGHRLength
389  val HistoryLength = allHistLens.max + numBr * FtqSize + 9 // 256 for the predictor configs now
390
391  val RegCacheSize = IntRegCacheSize + MemRegCacheSize
392  val RegCacheIdxWidth = log2Up(RegCacheSize)
393
394  val intSchdParams = {
395    implicit val schdType: SchedulerType = IntScheduler()
396    SchdBlockParams(Seq(
397      IssueBlockParams(Seq(
398        ExeUnitParams("ALU0", Seq(AluCfg, MulCfg, BkuCfg), Seq(IntWB(port = 0, 0)), Seq(Seq(IntRD(0, 0)), Seq(IntRD(1, 0))), true, 2),
399        ExeUnitParams("BJU0", Seq(BrhCfg, JmpCfg), Seq(IntWB(port = 0, 1)), Seq(Seq(IntRD(6, 1)), Seq(IntRD(7, 1))), true, 2),
400      ), numEntries = IssueQueueSize, numEnq = 2, numComp = IssueQueueCompEntrySize),
401      IssueBlockParams(Seq(
402        ExeUnitParams("ALU1", Seq(AluCfg, MulCfg, BkuCfg), Seq(IntWB(port = 1, 0)), Seq(Seq(IntRD(2, 0)), Seq(IntRD(3, 0))), true, 2),
403        ExeUnitParams("BJU1", Seq(BrhCfg, JmpCfg), Seq(IntWB(port = 1, 1)), Seq(Seq(IntRD(4, 1)), Seq(IntRD(5, 1))), true, 2),
404      ), numEntries = IssueQueueSize, numEnq = 2, numComp = IssueQueueCompEntrySize),
405      IssueBlockParams(Seq(
406        ExeUnitParams("ALU2", Seq(AluCfg), Seq(IntWB(port = 2, 0)), Seq(Seq(IntRD(4, 0)), Seq(IntRD(5, 0))), true, 2),
407        ExeUnitParams("BJU2", Seq(BrhCfg, JmpCfg, I2fCfg, VSetRiWiCfg, VSetRiWvfCfg, I2vCfg), Seq(IntWB(port = 4, 0), VfWB(2, 0), V0WB(port = 2, 0), VlWB(port = intSchdVlWbPort, 0), FpWB(port = 2, 1)), Seq(Seq(IntRD(2, 1)), Seq(IntRD(3, 1)))),
408      ), numEntries = IssueQueueSize, numEnq = 2, numComp = IssueQueueCompEntrySize),
409      IssueBlockParams(Seq(
410        ExeUnitParams("ALU3", Seq(AluCfg), Seq(IntWB(port = 3, 0)), Seq(Seq(IntRD(6, 0)), Seq(IntRD(7, 0))), true, 2),
411        ExeUnitParams("BJU3", Seq(CsrCfg, FenceCfg, DivCfg), Seq(IntWB(port = 4, 1)), Seq(Seq(IntRD(0, 1)), Seq(IntRD(1, 1)))),
412      ), numEntries = IssueQueueSize, numEnq = 2, numComp = IssueQueueCompEntrySize),
413    ),
414      numPregs = intPreg.numEntries,
415      numDeqOutside = 0,
416      schdType = schdType,
417      rfDataWidth = intPreg.dataCfg.dataWidth,
418    )
419  }
420
421  val fpSchdParams = {
422    implicit val schdType: SchedulerType = FpScheduler()
423    SchdBlockParams(Seq(
424      IssueBlockParams(Seq(
425        ExeUnitParams("FEX0", Seq(FaluCfg, FcvtCfg, F2vCfg, FmacCfg), Seq(FpWB(port = 0, 0), IntWB(port = 0, 2), VfWB(port = 3, 0), V0WB(port = 3, 0)), Seq(Seq(FpRD(0, 0)), Seq(FpRD(1, 0)), Seq(FpRD(2, 0)))),
426        ExeUnitParams("FEX1", Seq(FdivCfg), Seq(FpWB(port = 3, 1)), Seq(Seq(FpRD(2, 1)), Seq(FpRD(5, 1)))),
427      ), numEntries = 18, numEnq = 2, numComp = 14),
428      IssueBlockParams(Seq(
429        ExeUnitParams("FEX2", Seq(FaluCfg, FmacCfg), Seq(FpWB(port = 1, 0), IntWB(port = 1, 2)), Seq(Seq(FpRD(3, 0)), Seq(FpRD(4, 0)), Seq(FpRD(5, 0)))),
430        ExeUnitParams("FEX3", Seq(FdivCfg), Seq(FpWB(port = 4, 1)), Seq(Seq(FpRD(8, 1)), Seq(FpRD(9, 1)))),
431      ), numEntries = 18, numEnq = 2, numComp = 14),
432      IssueBlockParams(Seq(
433        ExeUnitParams("FEX4", Seq(FaluCfg, FmacCfg), Seq(FpWB(port = 2, 0), IntWB(port = 2, 1)), Seq(Seq(FpRD(6, 0)), Seq(FpRD(7, 0)), Seq(FpRD(8, 0)))),
434      ), numEntries = 18, numEnq = 2, numComp = 14),
435    ),
436      numPregs = fpPreg.numEntries,
437      numDeqOutside = 0,
438      schdType = schdType,
439      rfDataWidth = fpPreg.dataCfg.dataWidth,
440    )
441  }
442
443  val vfSchdParams = {
444    implicit val schdType: SchedulerType = VfScheduler()
445    SchdBlockParams(Seq(
446      IssueBlockParams(Seq(
447        ExeUnitParams("VFEX0", Seq(VfmaCfg, VialuCfg, VimacCfg, VppuCfg), Seq(VfWB(port = 0, 0), V0WB(port = 0, 0)), Seq(Seq(VfRD(0, 0)), Seq(VfRD(1, 0)), Seq(VfRD(2, 0)), Seq(V0RD(0, 0)), Seq(VlRD(0, 0)))),
448        ExeUnitParams("VFEX1", Seq(VfaluCfg, VfcvtCfg, VipuCfg, VSetRvfWvfCfg), Seq(VfWB(port = 0, 1), V0WB(port = 0, 1), VlWB(port = vfSchdVlWbPort, 0), IntWB(port = 1, 1), FpWB(port = 0, 1)), Seq(Seq(VfRD(0, 1)), Seq(VfRD(1, 1)), Seq(VfRD(2, 1)), Seq(V0RD(0, 1)), Seq(VlRD(0, 1)))),
449      ), numEntries = 16, numEnq = 2, numComp = 12),
450      IssueBlockParams(Seq(
451        ExeUnitParams("VFEX2", Seq(VfmaCfg, VialuCfg), Seq(VfWB(port = 1, 0), V0WB(port = 1, 0)), Seq(Seq(VfRD(3, 0)), Seq(VfRD(4, 0)), Seq(VfRD(5, 0)), Seq(V0RD(1, 0)), Seq(VlRD(1, 0)))),
452        ExeUnitParams("VFEX3", Seq(VfaluCfg), Seq(VfWB(port = 2, 1), V0WB(port = 2, 1), FpWB(port = 1, 1)), Seq(Seq(VfRD(3, 1)), Seq(VfRD(4, 1)), Seq(VfRD(5, 1)), Seq(V0RD(1, 1)), Seq(VlRD(1, 1)))),
453      ), numEntries = 16, numEnq = 2, numComp = 12),
454      IssueBlockParams(Seq(
455        ExeUnitParams("VFEX4", Seq(VfdivCfg, VidivCfg), Seq(VfWB(port = 3, 1), V0WB(port = 3, 1)), Seq(Seq(VfRD(3, 2)), Seq(VfRD(4, 2)), Seq(VfRD(5, 2)), Seq(V0RD(1, 2)), Seq(VlRD(1, 2)))),
456      ), numEntries = 10, numEnq = 2, numComp = 6),
457    ),
458      numPregs = vfPreg.numEntries,
459      numDeqOutside = 0,
460      schdType = schdType,
461      rfDataWidth = vfPreg.dataCfg.dataWidth,
462    )
463  }
464
465  val memSchdParams = {
466    implicit val schdType: SchedulerType = MemScheduler()
467    val rfDataWidth = 64
468
469    SchdBlockParams(Seq(
470      IssueBlockParams(Seq(
471        ExeUnitParams("STA0", Seq(StaCfg, MouCfg), Seq(FakeIntWB()), Seq(Seq(IntRD(7, 2)))),
472      ), numEntries = 16, numEnq = 2, numComp = 12),
473      IssueBlockParams(Seq(
474        ExeUnitParams("STA1", Seq(StaCfg, MouCfg), Seq(FakeIntWB()), Seq(Seq(IntRD(6, 2)))),
475      ), numEntries = 16, numEnq = 2, numComp = 12),
476      IssueBlockParams(Seq(
477        ExeUnitParams("LDU0", Seq(LduCfg), Seq(IntWB(5, 0), FpWB(3, 0)), Seq(Seq(IntRD(8, 0))), true, 2),
478      ), numEntries = 16, numEnq = 2, numComp = 12),
479      IssueBlockParams(Seq(
480        ExeUnitParams("LDU1", Seq(LduCfg), Seq(IntWB(6, 0), FpWB(4, 0)), Seq(Seq(IntRD(9, 0))), true, 2),
481      ), numEntries = 16, numEnq = 2, numComp = 12),
482      IssueBlockParams(Seq(
483        ExeUnitParams("LDU2", Seq(LduCfg), Seq(IntWB(7, 0), FpWB(5, 0)), Seq(Seq(IntRD(10, 0))), true, 2),
484      ), numEntries = 16, numEnq = 2, numComp = 12),
485      IssueBlockParams(Seq(
486        ExeUnitParams("VLSU0", Seq(VlduCfg, VstuCfg, VseglduSeg, VsegstuCfg), Seq(VfWB(4, 0), V0WB(4, 0), VlWB(port = 2, 0)), Seq(Seq(VfRD(6, 0)), Seq(VfRD(7, 0)), Seq(VfRD(8, 0)), Seq(V0RD(2, 0)), Seq(VlRD(2, 0)))),
487      ), numEntries = 16, numEnq = 2, numComp = 12),
488      IssueBlockParams(Seq(
489        ExeUnitParams("VLSU1", Seq(VlduCfg, VstuCfg), Seq(VfWB(5, 0), V0WB(5, 0), VlWB(port = 3, 0)), Seq(Seq(VfRD(9, 0)), Seq(VfRD(10, 0)), Seq(VfRD(11, 0)), Seq(V0RD(3, 0)), Seq(VlRD(3, 0)))),
490      ), numEntries = 16, numEnq = 2, numComp = 12),
491      IssueBlockParams(Seq(
492        ExeUnitParams("STD0", Seq(StdCfg, MoudCfg), Seq(), Seq(Seq(IntRD(5, 2), FpRD(9, 0)))),
493      ), numEntries = 16, numEnq = 2, numComp = 12),
494      IssueBlockParams(Seq(
495        ExeUnitParams("STD1", Seq(StdCfg, MoudCfg), Seq(), Seq(Seq(IntRD(3, 2), FpRD(10, 0)))),
496      ), numEntries = 16, numEnq = 2, numComp = 12),
497    ),
498      numPregs = intPreg.numEntries max vfPreg.numEntries,
499      numDeqOutside = 0,
500      schdType = schdType,
501      rfDataWidth = rfDataWidth,
502    )
503  }
504
505  def PregIdxWidthMax = intPreg.addrWidth max vfPreg.addrWidth
506
507  def iqWakeUpParams = {
508    Seq(
509      WakeUpConfig(
510        Seq("ALU0", "ALU1", "ALU2", "ALU3", "LDU0", "LDU1", "LDU2") ->
511        Seq("ALU0", "BJU0", "ALU1", "BJU1", "ALU2", "BJU2", "ALU3", "BJU3", "LDU0", "LDU1", "LDU2", "STA0", "STA1", "STD0", "STD1")
512      ),
513      // TODO: add load -> fp slow wakeup
514      WakeUpConfig(
515        Seq("FEX0", "FEX2", "FEX4") ->
516        Seq("FEX0", "FEX1", "FEX2", "FEX3", "FEX4")
517      ),
518    ).flatten
519  }
520
521  def fakeIntPreg = FakeIntPregParams(intPreg.numEntries, intPreg.numRead, intPreg.numWrite)
522
523  val backendParams: BackendParams = backend.BackendParams(
524    Map(
525      IntScheduler() -> intSchdParams,
526      FpScheduler() -> fpSchdParams,
527      VfScheduler() -> vfSchdParams,
528      MemScheduler() -> memSchdParams,
529    ),
530    Seq(
531      intPreg,
532      fpPreg,
533      vfPreg,
534      v0Preg,
535      vlPreg,
536      fakeIntPreg
537    ),
538    iqWakeUpParams,
539  )
540
541  // Parameters for trace extension.
542  // Trace parameters is useful for XSTOP.
543  val traceParams: TraceParams = new TraceParams(
544    TraceGroupNum  = 3,
545    IaddrWidth     = GPAddrBitsSv48x4,
546    PrivWidth      = 3,
547    ItypeWidth     = 4,
548    IlastsizeWidth = 1,
549  )
550}
551
552case object DebugOptionsKey extends Field[DebugOptions]
553
554case class DebugOptions
555(
556  FPGAPlatform: Boolean = false,
557  ResetGen: Boolean = false,
558  EnableDifftest: Boolean = false,
559  AlwaysBasicDiff: Boolean = true,
560  EnableDebug: Boolean = false,
561  EnablePerfDebug: Boolean = true,
562  PerfLevel: String = "VERBOSE",
563  UseDRAMSim: Boolean = false,
564  EnableConstantin: Boolean = false,
565  EnableChiselDB: Boolean = false,
566  AlwaysBasicDB: Boolean = true,
567  EnableRollingDB: Boolean = false
568)
569
570trait HasXSParameter {
571
572  implicit val p: Parameters
573
574  def PAddrBits = p(SoCParamsKey).PAddrBits // PAddrBits is Phyical Memory addr bits
575  def PmemRanges = p(SoCParamsKey).PmemRanges
576  def KeyIDBits = p(CVMParamskey).KeyIDBits
577  final val PageOffsetWidth = 12
578  def NodeIDWidth = p(SoCParamsKey).NodeIDWidthList(p(CHIIssue)) // NodeID width among NoC
579
580  def coreParams = p(XSCoreParamsKey)
581  def env = p(DebugOptionsKey)
582
583  def ISABase = coreParams.ISABase
584  def ISAExtensions = coreParams.ISAExtensions
585  def XLEN = coreParams.XLEN
586  def VLEN = coreParams.VLEN
587  def ELEN = coreParams.ELEN
588  def HSXLEN = coreParams.HSXLEN
589  val minFLen = 32
590  val fLen = 64
591  def hartIdLen = p(MaxHartIdBits)
592  val xLen = XLEN
593
594  def HasBitmapCheck = coreParams.HasBitmapCheck
595  def HasBitmapCheckDefault = coreParams.HasBitmapCheckDefault
596  def HasMExtension = coreParams.HasMExtension
597  def HasCExtension = coreParams.HasCExtension
598  def HasHExtension = coreParams.HasHExtension
599  def EnableSv48 = coreParams.EnableSv48
600  def HasDiv = coreParams.HasDiv
601  def HasIcache = coreParams.HasICache
602  def HasDcache = coreParams.HasDCache
603  def AddrBits = coreParams.AddrBits // AddrBits is used in some cases
604  def PAddrBitsMax = coreParams.PAddrBitsMax
605  def GPAddrBitsSv39x4 = coreParams.GPAddrBitsSv39x4
606  def GPAddrBitsSv48x4 = coreParams.GPAddrBitsSv48x4
607  def GPAddrBits = {
608    if (EnableSv48)
609      coreParams.GPAddrBitsSv48x4
610    else
611      coreParams.GPAddrBitsSv39x4
612  }
613  def VAddrBits = {
614    if (HasHExtension) {
615      if (EnableSv48)
616        coreParams.GPAddrBitsSv48x4
617      else
618        coreParams.GPAddrBitsSv39x4
619    } else {
620      if (EnableSv48)
621        coreParams.VAddrBitsSv48
622      else
623        coreParams.VAddrBitsSv39
624    }
625  } // VAddrBits is Virtual Memory addr bits
626
627  def VAddrMaxBits = {
628    if(EnableSv48) {
629      coreParams.VAddrBitsSv48 max coreParams.GPAddrBitsSv48x4
630    } else {
631      coreParams.VAddrBitsSv39 max coreParams.GPAddrBitsSv39x4
632    }
633  }
634
635  def AsidLength = coreParams.AsidLength
636  def VmidLength = coreParams.VmidLength
637  def ReSelectLen = coreParams.ReSelectLen
638  def AddrBytes = AddrBits / 8 // unused
639  def DataBits = XLEN
640  def DataBytes = DataBits / 8
641  def QuadWordBits = DataBits * 2
642  def QuadWordBytes = QuadWordBits / 8
643  def VDataBytes = VLEN / 8
644  def HasFPU = coreParams.HasFPU
645  def HasVPU = coreParams.HasVPU
646  def HasCustomCSRCacheOp = coreParams.HasCustomCSRCacheOp
647  def FetchWidth = coreParams.FetchWidth
648  def PredictWidth = FetchWidth * (if (HasCExtension) 2 else 1)
649  def EnableBPU = coreParams.EnableBPU
650  def EnableBPD = coreParams.EnableBPD // enable backing predictor(like Tage) in BPUStage3
651  def EnableRAS = coreParams.EnableRAS
652  def EnableLB = coreParams.EnableLB
653  def EnableLoop = coreParams.EnableLoop
654  def EnableSC = coreParams.EnableSC
655  def EnbaleTlbDebug = coreParams.EnbaleTlbDebug
656  def HistoryLength = coreParams.HistoryLength
657  def EnableGHistDiff = coreParams.EnableGHistDiff
658  def EnableCommitGHistDiff = coreParams.EnableCommitGHistDiff
659  def EnableClockGate = coreParams.EnableClockGate
660  def UbtbGHRLength = coreParams.UbtbGHRLength
661  def UbtbSize = coreParams.UbtbSize
662  def EnableFauFTB = coreParams.EnableFauFTB
663  def FtbSize = coreParams.FtbSize
664  def FtbWays = coreParams.FtbWays
665  def FtbTagLength = coreParams.FtbTagLength
666  def RasSize = coreParams.RasSize
667  def RasSpecSize = coreParams.RasSpecSize
668  def RasCtrSize = coreParams.RasCtrSize
669
670  def getBPDComponents(resp_in: BranchPredictionResp, p: Parameters) = {
671    coreParams.branchPredictor(resp_in, p)
672  }
673  def numBr = coreParams.numBr
674  def TageTableInfos = coreParams.TageTableInfos
675  def TageBanks = coreParams.numBr
676  def SCNRows = coreParams.SCNRows
677  def SCCtrBits = coreParams.SCCtrBits
678  def SCHistLens = coreParams.SCHistLens
679  def SCNTables = coreParams.SCNTables
680
681  def SCTableInfos = Seq.fill(SCNTables)((SCNRows, SCCtrBits)) zip SCHistLens map {
682    case ((n, cb), h) => (n, cb, h)
683  }
684  def ITTageTableInfos = coreParams.ITTageTableInfos
685  type FoldedHistoryInfo = Tuple2[Int, Int]
686  def foldedGHistInfos =
687    (TageTableInfos.map{ case (nRows, h, t) =>
688      if (h > 0)
689        Set((h, min(log2Ceil(nRows/numBr), h)), (h, min(h, t)), (h, min(h, t-1)))
690      else
691        Set[FoldedHistoryInfo]()
692    }.reduce(_++_).toSet ++
693    SCTableInfos.map{ case (nRows, _, h) =>
694      if (h > 0)
695        Set((h, min(log2Ceil(nRows/TageBanks), h)))
696      else
697        Set[FoldedHistoryInfo]()
698    }.reduce(_++_).toSet ++
699    ITTageTableInfos.map{ case (nRows, h, t) =>
700      if (h > 0)
701        Set((h, min(log2Ceil(nRows), h)), (h, min(h, t)), (h, min(h, t-1)))
702      else
703        Set[FoldedHistoryInfo]()
704    }.reduce(_++_) ++
705      Set[FoldedHistoryInfo]((UbtbGHRLength, log2Ceil(UbtbSize)))
706    ).toList
707
708
709
710  def CacheLineSize = coreParams.CacheLineSize
711  def CacheLineHalfWord = CacheLineSize / 16
712  def ExtHistoryLength = HistoryLength + 64
713  def ICacheForceMetaECCError = coreParams.ICacheForceMetaECCError
714  def ICacheForceDataECCError = coreParams.ICacheForceDataECCError
715  def IBufSize = coreParams.IBufSize
716  def IBufNBank = coreParams.IBufNBank
717  def backendParams: BackendParams = coreParams.backendParams
718  def DecodeWidth = coreParams.DecodeWidth
719  def RenameWidth = coreParams.RenameWidth
720  def CommitWidth = coreParams.CommitWidth
721  def RobCommitWidth = coreParams.RobCommitWidth
722  def RabCommitWidth = coreParams.RabCommitWidth
723  def MaxUopSize = coreParams.MaxUopSize
724  def EnableRenameSnapshot = coreParams.EnableRenameSnapshot
725  def RenameSnapshotNum = coreParams.RenameSnapshotNum
726  def FtqSize = coreParams.FtqSize
727  def EnableLoadFastWakeUp = coreParams.EnableLoadFastWakeUp
728  def IntLogicRegs = coreParams.IntLogicRegs
729  def FpLogicRegs = coreParams.FpLogicRegs
730  def VecLogicRegs = coreParams.VecLogicRegs
731  def V0LogicRegs = coreParams.V0LogicRegs
732  def VlLogicRegs = coreParams.VlLogicRegs
733  def MaxLogicRegs = Set(IntLogicRegs, FpLogicRegs, VecLogicRegs, V0LogicRegs, VlLogicRegs).max
734  def LogicRegsWidth = log2Ceil(MaxLogicRegs)
735  def V0_IDX = coreParams.V0_IDX
736  def Vl_IDX = coreParams.Vl_IDX
737  def IntPhyRegs = coreParams.intPreg.numEntries
738  def FpPhyRegs = coreParams.fpPreg.numEntries
739  def VfPhyRegs = coreParams.vfPreg.numEntries
740  def V0PhyRegs = coreParams.v0Preg.numEntries
741  def VlPhyRegs = coreParams.vlPreg.numEntries
742  def MaxPhyRegs = Seq(IntPhyRegs, FpPhyRegs, VfPhyRegs, V0PhyRegs, VlPhyRegs).max
743  def IntPhyRegIdxWidth = log2Up(IntPhyRegs)
744  def FpPhyRegIdxWidth = log2Up(FpPhyRegs)
745  def VfPhyRegIdxWidth = log2Up(VfPhyRegs)
746  def V0PhyRegIdxWidth = log2Up(V0PhyRegs)
747  def VlPhyRegIdxWidth = log2Up(VlPhyRegs)
748  def PhyRegIdxWidth = Seq(IntPhyRegIdxWidth, FpPhyRegIdxWidth, VfPhyRegIdxWidth, V0PhyRegIdxWidth, VlPhyRegIdxWidth).max
749  def RobSize = coreParams.RobSize
750  def RabSize = coreParams.RabSize
751  def VTypeBufferSize = coreParams.VTypeBufferSize
752  def IntRegCacheSize = coreParams.IntRegCacheSize
753  def MemRegCacheSize = coreParams.MemRegCacheSize
754  def RegCacheSize = coreParams.RegCacheSize
755  def RegCacheIdxWidth = coreParams.RegCacheIdxWidth
756  /**
757   * the minimum element length of vector elements
758   */
759  def minVecElen: Int = coreParams.minVecElen
760
761  /**
762   * the maximum number of elements in vector register
763   */
764  def maxElemPerVreg: Int = coreParams.maxElemPerVreg
765
766  def IntRefCounterWidth = log2Ceil(RobSize)
767  def LSQEnqWidth = RenameWidth
768  def LSQLdEnqWidth = LSQEnqWidth min backendParams.numLoadDp
769  def LSQStEnqWidth = LSQEnqWidth min backendParams.numStoreDp
770  def VirtualLoadQueueSize = coreParams.VirtualLoadQueueSize
771  def LoadQueueRARSize = coreParams.LoadQueueRARSize
772  def LoadQueueRAWSize = coreParams.LoadQueueRAWSize
773  def RollbackGroupSize = coreParams.RollbackGroupSize
774  val RAWlgSelectGroupSize = log2Ceil(RollbackGroupSize)
775  val RAWTotalDelayCycles = scala.math.ceil(log2Ceil(LoadQueueRAWSize).toFloat / RAWlgSelectGroupSize).toInt + 1 - 2
776  def LoadQueueReplaySize = coreParams.LoadQueueReplaySize
777  def LoadUncacheBufferSize = coreParams.LoadUncacheBufferSize
778  def LoadQueueNWriteBanks = coreParams.LoadQueueNWriteBanks
779  def StoreQueueSize = coreParams.StoreQueueSize
780  def StoreQueueForceWriteSbufferUpper = coreParams.StoreQueueSize - 4
781  def StoreQueueForceWriteSbufferLower = StoreQueueForceWriteSbufferUpper - 5
782  def VirtualLoadQueueMaxStoreQueueSize = VirtualLoadQueueSize max StoreQueueSize
783  def StoreQueueNWriteBanks = coreParams.StoreQueueNWriteBanks
784  def StoreQueueForwardWithMask = coreParams.StoreQueueForwardWithMask
785  def VlsQueueSize = coreParams.VlsQueueSize
786
787  def MemIQSizeMax = backendParams.memSchdParams.get.issueBlockParams.map(_.numEntries).max
788  def IQSizeMax = backendParams.allSchdParams.map(_.issueBlockParams.map(_.numEntries).max).max
789
790  def NumRedirect = backendParams.numRedirect
791  def BackendRedirectNum = NumRedirect + 2 //2: ldReplay + Exception
792  def FtqRedirectAheadNum = NumRedirect
793  def IfuRedirectNum = coreParams.IfuRedirectNum
794  def LoadPipelineWidth = coreParams.LoadPipelineWidth
795  def StorePipelineWidth = coreParams.StorePipelineWidth
796  def VecLoadPipelineWidth = coreParams.VecLoadPipelineWidth
797  def VecStorePipelineWidth = coreParams.VecStorePipelineWidth
798  def VecMemSrcInWidth = coreParams.VecMemSrcInWidth
799  def VecMemInstWbWidth = coreParams.VecMemInstWbWidth
800  def VecMemDispatchWidth = coreParams.VecMemDispatchWidth
801  def VecMemDispatchMaxNumber = coreParams.VecMemDispatchMaxNumber
802  def VecMemUnitStrideMaxFlowNum = coreParams.VecMemUnitStrideMaxFlowNum
803  def VecMemLSQEnqIteratorNumberSeq = coreParams.VecMemLSQEnqIteratorNumberSeq
804  def StoreBufferSize = coreParams.StoreBufferSize
805  def StoreBufferThreshold = coreParams.StoreBufferThreshold
806  def EnsbufferWidth = coreParams.EnsbufferWidth
807  def LoadDependencyWidth = coreParams.LoadDependencyWidth
808  def VlMergeBufferSize = coreParams.VlMergeBufferSize
809  def VsMergeBufferSize = coreParams.VsMergeBufferSize
810  def UopWritebackWidth = coreParams.UopWritebackWidth
811  def VLUopWritebackWidth = coreParams.VLUopWritebackWidth
812  def VSUopWritebackWidth = coreParams.VSUopWritebackWidth
813  def VSegmentBufferSize = coreParams.VSegmentBufferSize
814  def UncacheBufferSize = coreParams.UncacheBufferSize
815  def UncacheBufferIndexWidth = log2Up(UncacheBufferSize)
816  def EnableLoadToLoadForward = coreParams.EnableLoadToLoadForward
817  def EnableFastForward = coreParams.EnableFastForward
818  def EnableLdVioCheckAfterReset = coreParams.EnableLdVioCheckAfterReset
819  def EnableSoftPrefetchAfterReset = coreParams.EnableSoftPrefetchAfterReset
820  def EnableCacheErrorAfterReset = coreParams.EnableCacheErrorAfterReset
821  def EnableAccurateLoadError = coreParams.EnableAccurateLoadError
822  def EnableUncacheWriteOutstanding = coreParams.EnableUncacheWriteOutstanding
823  def EnableHardwareStoreMisalign = coreParams.EnableHardwareStoreMisalign
824  def EnableHardwareLoadMisalign = coreParams.EnableHardwareLoadMisalign
825  def EnableStorePrefetchAtIssue = coreParams.EnableStorePrefetchAtIssue
826  def EnableStorePrefetchAtCommit = coreParams.EnableStorePrefetchAtCommit
827  def EnableAtCommitMissTrigger = coreParams.EnableAtCommitMissTrigger
828  def EnableStorePrefetchSMS = coreParams.EnableStorePrefetchSMS
829  def EnableStorePrefetchSPB = coreParams.EnableStorePrefetchSPB
830  def HasCMO = coreParams.HasCMO && p(EnableCHI)
831  require(LoadPipelineWidth == backendParams.LdExuCnt, "LoadPipelineWidth must be equal exuParameters.LduCnt!")
832  require(StorePipelineWidth == backendParams.StaCnt, "StorePipelineWidth must be equal exuParameters.StuCnt!")
833  def Enable3Load3Store = (LoadPipelineWidth == 3 && StorePipelineWidth == 3)
834  def asidLen = coreParams.MMUAsidLen
835  def vmidLen = coreParams.MMUVmidLen
836  def BTLBWidth = coreParams.LoadPipelineWidth + coreParams.StorePipelineWidth
837  def refillBothTlb = coreParams.refillBothTlb
838  def iwpuParam = coreParams.iwpuParameters
839  def dwpuParam = coreParams.dwpuParameters
840  def itlbParams = coreParams.itlbParameters
841  def ldtlbParams = coreParams.ldtlbParameters
842  def sttlbParams = coreParams.sttlbParameters
843  def hytlbParams = coreParams.hytlbParameters
844  def pftlbParams = coreParams.pftlbParameters
845  def l2ToL1Params = coreParams.l2ToL1tlbParameters
846  def btlbParams = coreParams.btlbParameters
847  def l2tlbParams = coreParams.l2tlbParameters
848  def NumPerfCounters = coreParams.NumPerfCounters
849
850  def instBytes = if (HasCExtension) 2 else 4
851  def instOffsetBits = log2Ceil(instBytes)
852
853  def icacheParameters = coreParams.icacheParameters
854  def dcacheParameters = coreParams.dcacheParametersOpt.getOrElse(DCacheParameters())
855
856  // dcache block cacheline when lr for LRSCCycles - LRSCBackOff cycles
857  // for constrained LR/SC loop
858  def LRSCCycles = 64
859  // for lr storm
860  def LRSCBackOff = 8
861
862  // cache hierarchy configurations
863  def l1BusDataWidth = 256
864
865  // load violation predict
866  def ResetTimeMax2Pow = 20 //1078576
867  def ResetTimeMin2Pow = 10 //1024
868  // wait table parameters
869  def WaitTableSize = 1024
870  def MemPredPCWidth = log2Up(WaitTableSize)
871  def LWTUse2BitCounter = true
872  // store set parameters
873  def SSITSize = WaitTableSize
874  def LFSTSize = 32
875  def SSIDWidth = log2Up(LFSTSize)
876  def LFSTWidth = 4
877  def StoreSetEnable = true // LWT will be disabled if SS is enabled
878  def LFSTEnable = true
879
880  def PCntIncrStep: Int = 6
881  def numPCntHc: Int = 12
882  def numPCntPtw: Int = 19
883
884  def numCSRPCntFrontend = 8
885  def numCSRPCntCtrl     = 8
886  def numCSRPCntLsu      = 8
887  def numCSRPCntHc       = 5
888  def printEventCoding   = true
889  def printCriticalError = false
890  def maxCommitStuck = pow(2, 21).toInt
891
892  // Vector load exception
893  def maxMergeNumPerCycle = 4
894
895  // Parameters for Sdtrig extension
896  protected def TriggerNum = 4
897  protected def TriggerChainMaxLength = 2
898
899  // Parameters for Trace extension
900  def TraceGroupNum          = coreParams.traceParams.TraceGroupNum
901  def CauseWidth             = XLEN
902  def TvalWidth              = coreParams.traceParams.IaddrWidth
903  def PrivWidth              = coreParams.traceParams.PrivWidth
904  def IaddrWidth             = coreParams.traceParams.IaddrWidth
905  def ItypeWidth             = coreParams.traceParams.ItypeWidth
906  def IretireWidthInPipe     = log2Up(RenameWidth * 2 + 1)
907  def IretireWidthCompressed = log2Up(RenameWidth * CommitWidth * 2 + 1)
908  def IlastsizeWidth         = coreParams.traceParams.IlastsizeWidth
909
910  def hasMbist               = coreParams.hasMbist
911
912  def wfiResume              = coreParams.wfiResume
913  def hasSramCtl             = coreParams.hasSramCtl
914  def hasDFT            = hasMbist || hasSramCtl
915}
916