xref: /XiangShan/src/main/scala/xiangshan/Parameters.scala (revision 141a6449de9d8f61eb4f2f5e670af29782902672)
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 chipsalliance.rocketchip.config.{Field, Parameters}
20import chisel3._
21import chisel3.util._
22import huancun._
23import huancun.debug._
24import system.SoCParamsKey
25import xiangshan.backend.dispatch.DispatchParameters
26import xiangshan.backend.exu._
27import xiangshan.cache.DCacheParameters
28import xiangshan.cache.mmu.{L2TLBParameters, TLBParameters}
29import xiangshan.cache.prefetch._
30import xiangshan.frontend._
31import xiangshan.frontend.icache.ICacheParameters
32import xiangshan.v2backend._
33
34import scala.math.min
35
36case object XSTileKey extends Field[Seq[XSCoreParameters]]
37
38case object XSCoreParamsKey extends Field[XSCoreParameters]
39
40case class XSCoreParameters
41(
42  HasPrefetch: Boolean = false,
43  HartId: Int = 0,
44  XLEN: Int = 64,
45  VLEN: Int = 128,
46  HasMExtension: Boolean = true,
47  HasCExtension: Boolean = true,
48  HasDiv: Boolean = true,
49  HasICache: Boolean = true,
50  HasDCache: Boolean = true,
51  AddrBits: Int = 64,
52  VAddrBits: Int = 39,
53  HasFPU: Boolean = true,
54  HasVPU: Boolean = true,
55  HasCustomCSRCacheOp: Boolean = true,
56  FetchWidth: Int = 8,
57  AsidLength: Int = 16,
58  EnableBPU: Boolean = true,
59  EnableBPD: Boolean = true,
60  EnableRAS: Boolean = true,
61  EnableLB: Boolean = false,
62  EnableLoop: Boolean = true,
63  EnableSC: Boolean = true,
64  EnbaleTlbDebug: Boolean = false,
65  EnableJal: Boolean = false,
66  EnableFauFTB: Boolean = true,
67  UbtbGHRLength: Int = 4,
68  // HistoryLength: Int = 512,
69  EnableGHistDiff: Boolean = true,
70  UbtbSize: Int = 256,
71  FtbSize: Int = 2048,
72  RasSize: Int = 32,
73  CacheLineSize: Int = 512,
74  FtbWays: Int = 4,
75  TageTableInfos: Seq[Tuple3[Int,Int,Int]] =
76  //       Sets  Hist   Tag
77    // Seq(( 2048,    2,    8),
78    //     ( 2048,    9,    8),
79    //     ( 2048,   13,    8),
80    //     ( 2048,   20,    8),
81    //     ( 2048,   26,    8),
82    //     ( 2048,   44,    8),
83    //     ( 2048,   73,    8),
84    //     ( 2048,  256,    8)),
85    Seq(( 4096,    8,    8),
86        ( 4096,   13,    8),
87        ( 4096,   32,    8),
88        ( 4096,  119,    8)),
89  ITTageTableInfos: Seq[Tuple3[Int,Int,Int]] =
90  //      Sets  Hist   Tag
91    Seq(( 256,    4,    9),
92        ( 256,    8,    9),
93        ( 512,   13,    9),
94        ( 512,   16,    9),
95        ( 512,   32,    9)),
96  SCNRows: Int = 512,
97  SCNTables: Int = 4,
98  SCCtrBits: Int = 6,
99  SCHistLens: Seq[Int] = Seq(0, 4, 10, 16),
100  numBr: Int = 2,
101  branchPredictor: Function2[BranchPredictionResp, Parameters, Tuple2[Seq[BasePredictor], BranchPredictionResp]] =
102    ((resp_in: BranchPredictionResp, p: Parameters) => {
103      val ftb = Module(new FTB()(p))
104      val ubtb =Module(new FauFTB()(p))
105      // val bim = Module(new BIM()(p))
106      val tage = Module(new Tage_SC()(p))
107      val ras = Module(new RAS()(p))
108      val ittage = Module(new ITTage()(p))
109      val preds = Seq(ubtb, tage, ftb, ittage, ras)
110      preds.map(_.io := DontCare)
111
112      // ubtb.io.resp_in(0)  := resp_in
113      // bim.io.resp_in(0)   := ubtb.io.resp
114      // btb.io.resp_in(0)   := bim.io.resp
115      // tage.io.resp_in(0)  := btb.io.resp
116      // loop.io.resp_in(0)  := tage.io.resp
117      ubtb.io.in.bits.resp_in(0) := resp_in
118      tage.io.in.bits.resp_in(0) := ubtb.io.out
119      ftb.io.in.bits.resp_in(0)  := tage.io.out
120      ittage.io.in.bits.resp_in(0)  := ftb.io.out
121      ras.io.in.bits.resp_in(0) := ittage.io.out
122
123      (preds, ras.io.out)
124    }),
125  IBufSize: Int = 48,
126  DecodeWidth: Int = 6,
127  RenameWidth: Int = 6,
128  CommitWidth: Int = 6,
129  FtqSize: Int = 64,
130  EnableLoadFastWakeUp: Boolean = true, // NOTE: not supported now, make it false
131  IssQueSize: Int = 16,
132  NRPhyRegs: Int = 192,
133  IntPhyRegs: Int = 192,
134  VfPhyRegs: Int = 192,
135  LoadQueueSize: Int = 80,
136  LoadQueueNWriteBanks: Int = 8,
137  StoreQueueSize: Int = 64,
138  StoreQueueNWriteBanks: Int = 8,
139  VlsQueueSize: Int = 8,
140  RobSize: Int = 256,
141  dpParams: DispatchParameters = DispatchParameters(
142    IntDqSize = 16,
143    FpDqSize = 16,
144    LsDqSize = 16,
145    IntDqDeqWidth = 6,
146    FpDqDeqWidth = 6,
147    LsDqDeqWidth = 6,
148  ),
149  intPreg: PregParams = IntPregParams(
150    numEntries = 160,
151    numRead = 14,
152    numWrite = 8,
153  ),
154  vfPreg: VfPregParams = VfPregParams(
155    numEntries = 160,
156    numRead = 14,
157    numWrite = 8,
158  ),
159//  exuParameters: ExuParameters = ExuParameters(
160//    JmpCnt = 1,
161//    AluCnt = 4,
162//    MulCnt = 0,
163//    MduCnt = 2,
164//    FmacCnt = 4,
165//    FmiscCnt = 2,
166//    FmiscDivSqrtCnt = 0,
167//    LduCnt = 2,
168//    StuCnt = 2
169//  ),
170  LoadPipelineWidth: Int = 2,
171  StorePipelineWidth: Int = 2,
172  VecMemSrcInWidth: Int = 2,
173  VecMemInstWbWidth: Int = 1,
174  VecMemDispatchWidth: Int = 1,
175  StoreBufferSize: Int = 16,
176  StoreBufferThreshold: Int = 7,
177  EnsbufferWidth: Int = 2,
178  UncacheBufferSize: Int = 4,
179  EnableLoadToLoadForward: Boolean = true,
180  EnableFastForward: Boolean = false,
181  EnableLdVioCheckAfterReset: Boolean = true,
182  EnableSoftPrefetchAfterReset: Boolean = true,
183  EnableCacheErrorAfterReset: Boolean = true,
184  EnableDCacheWPU: Boolean = false,
185  EnableAccurateLoadError: Boolean = true,
186  EnableUncacheWriteOutstanding: Boolean = true,
187  MMUAsidLen: Int = 16, // max is 16, 0 is not supported now
188  ReSelectLen: Int = 6, // load replay queue replay select counter len
189  itlbParameters: TLBParameters = TLBParameters(
190    name = "itlb",
191    fetchi = true,
192    useDmode = false,
193    normalNWays = 32,
194    normalReplacer = Some("plru"),
195    superNWays = 4,
196    superReplacer = Some("plru")
197  ),
198  ldtlbParameters: TLBParameters = TLBParameters(
199    name = "ldtlb",
200    normalNSets = 64,
201    normalNWays = 1,
202    normalAssociative = "sa",
203    normalReplacer = Some("setplru"),
204    superNWays = 16,
205    normalAsVictim = true,
206    outReplace = false,
207    partialStaticPMP = true,
208    outsideRecvFlush = true,
209    saveLevel = true
210  ),
211  sttlbParameters: TLBParameters = TLBParameters(
212    name = "sttlb",
213    normalNSets = 64,
214    normalNWays = 1,
215    normalAssociative = "sa",
216    normalReplacer = Some("setplru"),
217    superNWays = 16,
218    normalAsVictim = true,
219    outReplace = false,
220    partialStaticPMP = true,
221    outsideRecvFlush = true,
222    saveLevel = true
223  ),
224  refillBothTlb: Boolean = false,
225  btlbParameters: TLBParameters = TLBParameters(
226    name = "btlb",
227    normalNSets = 1,
228    normalNWays = 64,
229    superNWays = 4,
230  ),
231  l2tlbParameters: L2TLBParameters = L2TLBParameters(),
232  NumPerfCounters: Int = 16,
233  icacheParameters: ICacheParameters = ICacheParameters(
234    tagECC = Some("parity"),
235    dataECC = Some("parity"),
236    replacer = Some("setplru"),
237    nMissEntries = 2,
238    nProbeEntries = 2,
239    nPrefetchEntries = 2,
240    hasPrefetch = true,
241  ),
242  dcacheParametersOpt: Option[DCacheParameters] = Some(DCacheParameters(
243    tagECC = Some("secded"),
244    dataECC = Some("secded"),
245    replacer = Some("setplru"),
246    nMissEntries = 16,
247    nProbeEntries = 8,
248    nReleaseEntries = 18
249  )),
250  L2CacheParamsOpt: Option[HCCacheParameters] = Some(HCCacheParameters(
251    name = "l2",
252    level = 2,
253    ways = 8,
254    sets = 1024, // default 512KB L2
255    prefetch = Some(huancun.prefetch.BOPParameters())
256  )),
257  L2NBanks: Int = 1,
258  usePTWRepeater: Boolean = false,
259  softPTW: Boolean = false, // dpi-c debug only
260  softPTWDelay: Int = 1
261){
262  val allHistLens = SCHistLens ++ ITTageTableInfos.map(_._2) ++ TageTableInfos.map(_._2) :+ UbtbGHRLength
263  val HistoryLength = allHistLens.max + numBr * FtqSize + 9 // 256 for the predictor configs now
264
265  def intSchdParams = {
266    implicit val schdType: SchedulerType = IntScheduler()
267    val pregBits = intPreg.addrWidth
268    val numRfRead = intPreg.numRead
269    val numRfWrite = intPreg.numWrite
270    SchdBlockParams(Seq(
271      IssueBlockParams(Seq(
272        ExeUnitParams(Seq(AluCfg, MulCfg, BkuCfg), Seq(IntWB(port = 0, 0))),
273        ExeUnitParams(Seq(AluCfg, MulCfg, BkuCfg), Seq(IntWB(port = 1, 0))),
274      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 2),
275      IssueBlockParams(Seq(
276        ExeUnitParams(Seq(DivCfg), Seq(IntWB(port = 2, 0))),
277        ExeUnitParams(Seq(DivCfg), Seq(IntWB(port = 3, 0))),
278      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 2),
279      IssueBlockParams(Seq(
280        ExeUnitParams(Seq(BrhCfg, JmpCfg, CsrCfg, FenceCfg), Seq(IntWB(port = 4, 0))),
281        ExeUnitParams(Seq(BrhCfg), Seq()),
282      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 2),
283      IssueBlockParams(Seq(
284        ExeUnitParams(Seq(I2fCfg), Seq(VecWB(port = 6, Int.MaxValue))),
285      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 2)
286    ),
287      numPregs = intPreg.numEntries,
288      numRfReadWrite = Some((numRfRead, numRfWrite)),
289      numDeqOutside = 0,
290      schdType = schdType,
291      rfDataWidth = intPreg.dataCfg.dataWidth,
292      numUopIn = dpParams.IntDqDeqWidth,
293    )
294  }
295  def vfSchdParams = {
296    implicit val schdType: SchedulerType = VfScheduler()
297    val pregBits = vfPreg.addrWidth
298    val numRfRead = vfPreg.numRead
299    val numRfWrite = vfPreg.numWrite
300    SchdBlockParams(Seq(
301      IssueBlockParams(Seq(
302        ExeUnitParams(Seq(VipuCfg), Seq(VecWB(port = 0, 0))),
303        ExeUnitParams(Seq(VipuCfg), Seq(VecWB(port = 1, 0))),
304      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 4),
305      IssueBlockParams(Seq(
306        ExeUnitParams(Seq(VfpuCfg, F2fCfg), Seq(VecWB(port = 2, 0))),
307        ExeUnitParams(Seq(VfpuCfg, F2fCfg), Seq(VecWB(port = 3, 0))),
308      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = numRfWrite, numEnq = 4),
309    ),
310      numPregs = vfPreg.numEntries,
311      numRfReadWrite = Some((numRfRead, numRfWrite)),
312      numDeqOutside = 0,
313      schdType = schdType,
314      rfDataWidth = vfPreg.dataCfg.dataWidth,
315      numUopIn = dpParams.FpDqDeqWidth,
316    )
317  }
318  def memSchdParams = {
319    implicit val schdType: SchedulerType = MemScheduler()
320    val pregBits = vfPreg.addrWidth max intPreg.addrWidth
321    val rfDataWidth = 64
322
323    SchdBlockParams(Seq(
324      IssueBlockParams(Seq(
325        ExeUnitParams(Seq(LduCfg), WBSeq(IntWB(5, 0), VecWB(4, 0))),
326        ExeUnitParams(Seq(LduCfg), WBSeq(IntWB(6, 0), VecWB(5, 0))),
327      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = 16, numEnq = 2),
328      IssueBlockParams(Seq(
329        ExeUnitParams(Seq(StaCfg), WBSeq()),
330        ExeUnitParams(Seq(StaCfg), WBSeq()),
331      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = 16, numEnq = 2),
332      IssueBlockParams(Seq(
333        ExeUnitParams(Seq(StdCfg), WBSeq()),
334        ExeUnitParams(Seq(StdCfg), WBSeq()),
335      ), numEntries = 8, pregBits = pregBits, numWakeupFromWB = 16, numEnq = 2),
336    ),
337      numPregs = intPreg.numEntries max vfPreg.numEntries,
338      numRfReadWrite = None,
339      numDeqOutside = 0,
340      schdType = schdType,
341      rfDataWidth = rfDataWidth,
342      numUopIn = dpParams.LsDqDeqWidth,
343    )
344  }
345
346  def backendParams: BackendParams = BackendParams(Map(
347    IntScheduler() -> intSchdParams,
348    VfScheduler() -> vfSchdParams,
349    MemScheduler() -> memSchdParams,
350  ), Seq(
351    intPreg,
352    vfPreg,
353  ))
354}
355
356case object DebugOptionsKey extends Field[DebugOptions]
357
358case class DebugOptions
359(
360  FPGAPlatform: Boolean = false,
361  EnableDifftest: Boolean = false,
362  AlwaysBasicDiff: Boolean = true,
363  EnableDebug: Boolean = false,
364  EnablePerfDebug: Boolean = true,
365  UseDRAMSim: Boolean = false,
366  EnableTopDown: Boolean = false
367)
368
369trait HasXSParameter {
370
371  implicit val p: Parameters
372
373  val PAddrBits = p(SoCParamsKey).PAddrBits // PAddrBits is Phyical Memory addr bits
374
375  val coreParams = p(XSCoreParamsKey)
376  val env = p(DebugOptionsKey)
377
378  val XLEN = coreParams.XLEN
379  val VLEN = coreParams.VLEN
380  val minFLen = 32
381  val fLen = 64
382  def xLen = XLEN
383
384  val HasMExtension = coreParams.HasMExtension
385  val HasCExtension = coreParams.HasCExtension
386  val HasDiv = coreParams.HasDiv
387  val HasIcache = coreParams.HasICache
388  val HasDcache = coreParams.HasDCache
389  val AddrBits = coreParams.AddrBits // AddrBits is used in some cases
390  val VAddrBits = coreParams.VAddrBits // VAddrBits is Virtual Memory addr bits
391  val AsidLength = coreParams.AsidLength
392  val ReSelectLen = coreParams.ReSelectLen
393  val AddrBytes = AddrBits / 8 // unused
394  val DataBits = XLEN
395  val DataBytes = DataBits / 8
396  val HasFPU = coreParams.HasFPU
397  val HasVPU = coreParams.HasVPU
398  val HasCustomCSRCacheOp = coreParams.HasCustomCSRCacheOp
399  val FetchWidth = coreParams.FetchWidth
400  val PredictWidth = FetchWidth * (if (HasCExtension) 2 else 1)
401  val EnableBPU = coreParams.EnableBPU
402  val EnableBPD = coreParams.EnableBPD // enable backing predictor(like Tage) in BPUStage3
403  val EnableRAS = coreParams.EnableRAS
404  val EnableLB = coreParams.EnableLB
405  val EnableLoop = coreParams.EnableLoop
406  val EnableSC = coreParams.EnableSC
407  val EnbaleTlbDebug = coreParams.EnbaleTlbDebug
408  val HistoryLength = coreParams.HistoryLength
409  val EnableGHistDiff = coreParams.EnableGHistDiff
410  val UbtbGHRLength = coreParams.UbtbGHRLength
411  val UbtbSize = coreParams.UbtbSize
412  val EnableFauFTB = coreParams.EnableFauFTB
413  val FtbSize = coreParams.FtbSize
414  val FtbWays = coreParams.FtbWays
415  val RasSize = coreParams.RasSize
416
417  def getBPDComponents(resp_in: BranchPredictionResp, p: Parameters) = {
418    coreParams.branchPredictor(resp_in, p)
419  }
420  val numBr = coreParams.numBr
421  val TageTableInfos = coreParams.TageTableInfos
422  val TageBanks = coreParams.numBr
423  val SCNRows = coreParams.SCNRows
424  val SCCtrBits = coreParams.SCCtrBits
425  val SCHistLens = coreParams.SCHistLens
426  val SCNTables = coreParams.SCNTables
427
428  val SCTableInfos = Seq.fill(SCNTables)((SCNRows, SCCtrBits)) zip SCHistLens map {
429    case ((n, cb), h) => (n, cb, h)
430  }
431  val ITTageTableInfos = coreParams.ITTageTableInfos
432  type FoldedHistoryInfo = Tuple2[Int, Int]
433  val foldedGHistInfos =
434    (TageTableInfos.map{ case (nRows, h, t) =>
435      if (h > 0)
436        Set((h, min(log2Ceil(nRows/numBr), h)), (h, min(h, t)), (h, min(h, t-1)))
437      else
438        Set[FoldedHistoryInfo]()
439    }.reduce(_++_).toSet ++
440    SCTableInfos.map{ case (nRows, _, h) =>
441      if (h > 0)
442        Set((h, min(log2Ceil(nRows/TageBanks), h)))
443      else
444        Set[FoldedHistoryInfo]()
445    }.reduce(_++_).toSet ++
446    ITTageTableInfos.map{ case (nRows, h, t) =>
447      if (h > 0)
448        Set((h, min(log2Ceil(nRows), h)), (h, min(h, t)), (h, min(h, t-1)))
449      else
450        Set[FoldedHistoryInfo]()
451    }.reduce(_++_) ++
452      Set[FoldedHistoryInfo]((UbtbGHRLength, log2Ceil(UbtbSize)))
453    ).toList
454
455
456
457  val CacheLineSize = coreParams.CacheLineSize
458  val CacheLineHalfWord = CacheLineSize / 16
459  val ExtHistoryLength = HistoryLength + 64
460  val IBufSize = coreParams.IBufSize
461  val DecodeWidth = coreParams.DecodeWidth
462  val RenameWidth = coreParams.RenameWidth
463  val CommitWidth = coreParams.CommitWidth
464  val FtqSize = coreParams.FtqSize
465  val IssQueSize = coreParams.IssQueSize
466  val EnableLoadFastWakeUp = coreParams.EnableLoadFastWakeUp
467  val NRPhyRegs = coreParams.NRPhyRegs
468  val PhyRegIdxWidth = log2Up(NRPhyRegs)
469  val IntPhyRegs = coreParams.IntPhyRegs
470  val VfPhyRegs = coreParams.VfPhyRegs
471  val IntPregIdxWidth = log2Up(IntPhyRegs)
472  val VfPregIdxWidth = log2Up(VfPhyRegs)
473  val RobSize = coreParams.RobSize
474  val IntRefCounterWidth = log2Ceil(RobSize)
475  val LoadQueueSize = coreParams.LoadQueueSize
476  val LoadQueueNWriteBanks = coreParams.LoadQueueNWriteBanks
477  val StoreQueueSize = coreParams.StoreQueueSize
478  val StoreQueueNWriteBanks = coreParams.StoreQueueNWriteBanks
479  val VlsQueueSize = coreParams.VlsQueueSize
480  val dpParams = coreParams.dpParams
481
482  def backendParams: BackendParams = coreParams.backendParams
483//  val exuParameters = coreParams.exuParameters
484//  val NRMemReadPorts = exuParameters.LduCnt + 2 * exuParameters.StuCnt
485//  val NRIntReadPorts = 2 * exuParameters.AluCnt + NRMemReadPorts
486//  val NRIntWritePorts = exuParameters.AluCnt + exuParameters.MduCnt + exuParameters.LduCnt
487//  val NRFpReadPorts = 3 * exuParameters.FmacCnt + exuParameters.StuCnt
488//  val NRFpWritePorts = exuParameters.FpExuCnt + exuParameters.LduCnt
489  val LoadPipelineWidth = coreParams.LoadPipelineWidth
490  val StorePipelineWidth = coreParams.StorePipelineWidth
491  val VecMemSrcInWidth = coreParams.VecMemSrcInWidth
492  val VecMemInstWbWidth = coreParams.VecMemInstWbWidth
493  val VecMemDispatchWidth = coreParams.VecMemDispatchWidth
494  val StoreBufferSize = coreParams.StoreBufferSize
495  val StoreBufferThreshold = coreParams.StoreBufferThreshold
496  val EnsbufferWidth = coreParams.EnsbufferWidth
497  val UncacheBufferSize = coreParams.UncacheBufferSize
498  val EnableLoadToLoadForward = coreParams.EnableLoadToLoadForward
499  val EnableFastForward = coreParams.EnableFastForward
500  val EnableLdVioCheckAfterReset = coreParams.EnableLdVioCheckAfterReset
501  val EnableSoftPrefetchAfterReset = coreParams.EnableSoftPrefetchAfterReset
502  val EnableCacheErrorAfterReset = coreParams.EnableCacheErrorAfterReset
503  val EnableDCacheWPU = coreParams.EnableDCacheWPU
504  val EnableAccurateLoadError = coreParams.EnableAccurateLoadError
505  val EnableUncacheWriteOutstanding = coreParams.EnableUncacheWriteOutstanding
506  val asidLen = coreParams.MMUAsidLen
507  val BTLBWidth = coreParams.LoadPipelineWidth + coreParams.StorePipelineWidth
508  val refillBothTlb = coreParams.refillBothTlb
509  val itlbParams = coreParams.itlbParameters
510  val ldtlbParams = coreParams.ldtlbParameters
511  val sttlbParams = coreParams.sttlbParameters
512  val btlbParams = coreParams.btlbParameters
513  val l2tlbParams = coreParams.l2tlbParameters
514  val NumPerfCounters = coreParams.NumPerfCounters
515
516//  val NumRs = (exuParameters.JmpCnt+1)/2 + (exuParameters.AluCnt+1)/2 + (exuParameters.MulCnt+1)/2 +
517//              (exuParameters.MduCnt+1)/2 + (exuParameters.FmacCnt+1)/2 +  + (exuParameters.FmiscCnt+1)/2 +
518//              (exuParameters.FmiscDivSqrtCnt+1)/2 + (exuParameters.LduCnt+1)/2 +
519//              (exuParameters.StuCnt+1)/2 + (exuParameters.StuCnt+1)/2
520
521  val instBytes = if (HasCExtension) 2 else 4
522  val instOffsetBits = log2Ceil(instBytes)
523
524  val icacheParameters = coreParams.icacheParameters
525  val dcacheParameters = coreParams.dcacheParametersOpt.getOrElse(DCacheParameters())
526
527  // dcache block cacheline when lr for LRSCCycles - LRSCBackOff cycles
528  // for constrained LR/SC loop
529  val LRSCCycles = 64
530  // for lr storm
531  val LRSCBackOff = 8
532
533  // cache hierarchy configurations
534  val l1BusDataWidth = 256
535
536  // load violation predict
537  val ResetTimeMax2Pow = 20 //1078576
538  val ResetTimeMin2Pow = 10 //1024
539  // wait table parameters
540  val WaitTableSize = 1024
541  val MemPredPCWidth = log2Up(WaitTableSize)
542  val LWTUse2BitCounter = true
543  // store set parameters
544  val SSITSize = WaitTableSize
545  val LFSTSize = 32
546  val SSIDWidth = log2Up(LFSTSize)
547  val LFSTWidth = 4
548  val StoreSetEnable = true // LWT will be disabled if SS is enabled
549
550//  val loadExuConfigs = coreParams.loadExuConfigs
551//  val storeExuConfigs = coreParams.storeExuConfigs
552//
553//  val intExuConfigs = coreParams.intExuConfigs
554//
555//  val fpExuConfigs = coreParams.fpExuConfigs
556//
557//  val exuConfigs = coreParams.exuConfigs
558
559  val PCntIncrStep: Int = 6
560  val numPCntHc: Int = 25
561  val numPCntPtw: Int = 19
562
563  val numCSRPCntFrontend = 8
564  val numCSRPCntCtrl     = 8
565  val numCSRPCntLsu      = 8
566  val numCSRPCntHc       = 5
567}
568