Parameters.scala 17.2 KB
Newer Older
L
Lemover 已提交
1 2
/***************************************************************************************
* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
Y
Yinan Xu 已提交
3
* Copyright (c) 2020-2021 Peng Cheng Laboratory
L
Lemover 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16
*
* XiangShan is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*          http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
***************************************************************************************/

17 18 19 20 21 22 23
package xiangshan

import chipsalliance.rocketchip.config.{Field, Parameters}
import chisel3._
import chisel3.util._
import xiangshan.backend.exu._
import xiangshan.backend.dispatch.DispatchParameters
24
import xiangshan.cache.DCacheParameters
25
import xiangshan.cache.prefetch._
L
Lingrui98 已提交
26
import xiangshan.frontend.{BasePredictor, BranchPredictionResp, FTB, FakePredictor, RAS, Tage, ITTage, Tage_SC, FauFTB}
27
import xiangshan.frontend.icache.ICacheParameters
28
import xiangshan.cache.mmu.{L2TLBParameters, TLBParameters}
29
import freechips.rocketchip.diplomacy.AddressSet
30
import system.SoCParamsKey
31 32
import huancun._
import huancun.debug._
L
LinJiawei 已提交
33 34
import xiangshan.mem.prefetch.{PrefetcherParams, SMSParams}

35
import scala.math.min
J
Jiawei Lin 已提交
36 37 38

case object XSTileKey extends Field[Seq[XSCoreParameters]]

39 40 41 42 43 44 45
case object XSCoreParamsKey extends Field[XSCoreParameters]

case class XSCoreParameters
(
  HasPrefetch: Boolean = false,
  HartId: Int = 0,
  XLEN: Int = 64,
46
  VLEN: Int = 128,
47 48 49 50 51 52 53 54
  HasMExtension: Boolean = true,
  HasCExtension: Boolean = true,
  HasDiv: Boolean = true,
  HasICache: Boolean = true,
  HasDCache: Boolean = true,
  AddrBits: Int = 64,
  VAddrBits: Int = 39,
  HasFPU: Boolean = true,
Z
Ziyue Zhang 已提交
55
  HasVPU: Boolean = true,
Z
zhanglinjuan 已提交
56
  HasCustomCSRCacheOp: Boolean = true,
57
  FetchWidth: Int = 8,
58
  AsidLength: Int = 16,
59 60 61 62 63
  EnableBPU: Boolean = true,
  EnableBPD: Boolean = true,
  EnableRAS: Boolean = true,
  EnableLB: Boolean = false,
  EnableLoop: Boolean = true,
64
  EnableSC: Boolean = true,
65 66
  EnbaleTlbDebug: Boolean = false,
  EnableJal: Boolean = false,
67
  EnableFauFTB: Boolean = true,
68
  UbtbGHRLength: Int = 4,
69
  // HistoryLength: Int = 512,
70
  EnableGHistDiff: Boolean = true,
71
  UbtbSize: Int = 256,
72
  FtbSize: Int = 2048,
73
  RasSize: Int = 32,
74
  CacheLineSize: Int = 512,
75
  FtbWays: Int = 4,
76 77
  TageTableInfos: Seq[Tuple3[Int,Int,Int]] =
  //       Sets  Hist   Tag
L
Lingrui98 已提交
78 79 80 81 82 83 84 85 86 87 88 89
    // Seq(( 2048,    2,    8),
    //     ( 2048,    9,    8),
    //     ( 2048,   13,    8),
    //     ( 2048,   20,    8),
    //     ( 2048,   26,    8),
    //     ( 2048,   44,    8),
    //     ( 2048,   73,    8),
    //     ( 2048,  256,    8)),
    Seq(( 4096,    8,    8),
        ( 4096,   13,    8),
        ( 4096,   32,    8),
        ( 4096,  119,    8)),
90 91
  ITTageTableInfos: Seq[Tuple3[Int,Int,Int]] =
  //      Sets  Hist   Tag
L
Lingrui98 已提交
92
    Seq(( 256,    4,    9),
93
        ( 256,    8,    9),
L
Lingrui98 已提交
94
        ( 512,   13,    9),
95
        ( 512,   16,    9),
96
        ( 512,   32,    9)),
97 98
  SCNRows: Int = 512,
  SCNTables: Int = 4,
99
  SCCtrBits: Int = 6,
100
  SCHistLens: Seq[Int] = Seq(0, 4, 10, 16),
101
  numBr: Int = 2,
102 103
  branchPredictor: Function2[BranchPredictionResp, Parameters, Tuple2[Seq[BasePredictor], BranchPredictionResp]] =
    ((resp_in: BranchPredictionResp, p: Parameters) => {
Z
zoujr 已提交
104
      val ftb = Module(new FTB()(p))
L
Lingrui98 已提交
105
      val ubtb =Module(new FauFTB()(p))
106
      // val bim = Module(new BIM()(p))
107
      val tage = Module(new Tage_SC()(p))
L
Lingrui98 已提交
108
      val ras = Module(new RAS()(p))
109
      val ittage = Module(new ITTage()(p))
110
      val preds = Seq(ubtb, tage, ftb, ittage, ras)
Z
zoujr 已提交
111 112 113 114 115 116 117
      preds.map(_.io := DontCare)

      // ubtb.io.resp_in(0)  := resp_in
      // bim.io.resp_in(0)   := ubtb.io.resp
      // btb.io.resp_in(0)   := bim.io.resp
      // tage.io.resp_in(0)  := btb.io.resp
      // loop.io.resp_in(0)  := tage.io.resp
118
      ubtb.io.in.bits.resp_in(0) := resp_in
L
Lingrui98 已提交
119 120 121 122
      tage.io.in.bits.resp_in(0) := ubtb.io.out
      ftb.io.in.bits.resp_in(0)  := tage.io.out
      ittage.io.in.bits.resp_in(0)  := ftb.io.out
      ras.io.in.bits.resp_in(0) := ittage.io.out
Y
Yinan Xu 已提交
123

L
Lingrui98 已提交
124
      (preds, ras.io.out)
Z
zoujr 已提交
125
    }),
126 127 128 129
  IBufSize: Int = 48,
  DecodeWidth: Int = 6,
  RenameWidth: Int = 6,
  CommitWidth: Int = 6,
130
  MaxUopSize: Int = 37,
L
Lingrui98 已提交
131
  FtqSize: Int = 64,
132 133
  EnableLoadFastWakeUp: Boolean = true, // NOTE: not supported now, make it false
  IssQueSize: Int = 16,
134
  IntLogicRegs: Int = 33,
135
  FpLogicRegs: Int = 33,
136
  VecLogicRegs: Int = 39,
137
  NRPhyRegs: Int = 192,
X
Xuan Hu 已提交
138 139
  IntPhyRegs: Int = 192,
  VfPhyRegs: Int = 192,
140
  LoadQueueSize: Int = 80,
141
  LoadQueueNWriteBanks: Int = 8,
142
  StoreQueueSize: Int = 64,
143
  StoreQueueNWriteBanks: Int = 8,
W
William Wang 已提交
144
  VlsQueueSize: Int = 8,
145
  RobSize: Int = 256,
F
fdy 已提交
146
  RabSize: Int = 256,
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
  dpParams: DispatchParameters = DispatchParameters(
    IntDqSize = 16,
    FpDqSize = 16,
    LsDqSize = 16,
    IntDqDeqWidth = 4,
    FpDqDeqWidth = 4,
    LsDqDeqWidth = 4
  ),
  exuParameters: ExuParameters = ExuParameters(
    JmpCnt = 1,
    AluCnt = 4,
    MulCnt = 0,
    MduCnt = 2,
    FmacCnt = 4,
    FmiscCnt = 2,
    FmiscDivSqrtCnt = 0,
    LduCnt = 2,
    StuCnt = 2
  ),
L
LinJiawei 已提交
166
  prefetcher: Option[PrefetcherParams] = Some(SMSParams()),
167 168
  LoadPipelineWidth: Int = 2,
  StorePipelineWidth: Int = 2,
W
William Wang 已提交
169 170 171
  VecMemSrcInWidth: Int = 2,
  VecMemInstWbWidth: Int = 1,
  VecMemDispatchWidth: Int = 1,
172
  StoreBufferSize: Int = 16,
173
  StoreBufferThreshold: Int = 7,
174
  EnsbufferWidth: Int = 2,
175
  UncacheBufferSize: Int = 4,
176
  EnableLoadToLoadForward: Boolean = true,
W
William Wang 已提交
177
  EnableFastForward: Boolean = false,
178
  EnableLdVioCheckAfterReset: Boolean = true,
179 180
  EnableSoftPrefetchAfterReset: Boolean = true,
  EnableCacheErrorAfterReset: Boolean = true,
181
  EnableDCacheWPU: Boolean = false,
182
  EnableAccurateLoadError: Boolean = true,
183
  EnableUncacheWriteOutstanding: Boolean = false,
184
  MMUAsidLen: Int = 16, // max is 16, 0 is not supported now
W
William Wang 已提交
185
  ReSelectLen: Int = 6, // load replay queue replay select counter len
186 187 188 189
  itlbParameters: TLBParameters = TLBParameters(
    name = "itlb",
    fetchi = true,
    useDmode = false,
190
    normalNWays = 32,
191
    normalReplacer = Some("plru"),
192
    superNWays = 4,
193
    superReplacer = Some("plru")
194 195 196
  ),
  ldtlbParameters: TLBParameters = TLBParameters(
    name = "ldtlb",
197
    normalNSets = 64,
198 199 200
    normalNWays = 1,
    normalAssociative = "sa",
    normalReplacer = Some("setplru"),
201
    superNWays = 16,
202
    normalAsVictim = true,
203
    outReplace = false,
204
    partialStaticPMP = true,
205
    outsideRecvFlush = true,
206
    saveLevel = true
207 208 209
  ),
  sttlbParameters: TLBParameters = TLBParameters(
    name = "sttlb",
210
    normalNSets = 64,
211 212 213
    normalNWays = 1,
    normalAssociative = "sa",
    normalReplacer = Some("setplru"),
214
    superNWays = 16,
215
    normalAsVictim = true,
216
    outReplace = false,
217
    partialStaticPMP = true,
218
    outsideRecvFlush = true,
219
    saveLevel = true
220
  ),
221 222 223 224 225 226 227 228 229 230 231 232 233
  pftlbParameters: TLBParameters = TLBParameters(
    name = "pftlb",
    normalNSets = 64,
    normalNWays = 1,
    normalAssociative = "sa",
    normalReplacer = Some("setplru"),
    superNWays = 16,
    normalAsVictim = true,
    outReplace = false,
    partialStaticPMP = true,
    outsideRecvFlush = true,
    saveLevel = true
  ),
234
  refillBothTlb: Boolean = false,
235 236 237 238 239 240
  btlbParameters: TLBParameters = TLBParameters(
    name = "btlb",
    normalNSets = 1,
    normalNWays = 64,
    superNWays = 4,
  ),
241
  l2tlbParameters: L2TLBParameters = L2TLBParameters(),
242
  NumPerfCounters: Int = 16,
243 244 245 246
  icacheParameters: ICacheParameters = ICacheParameters(
    tagECC = Some("parity"),
    dataECC = Some("parity"),
    replacer = Some("setplru"),
247
    nMissEntries = 2,
248
    nProbeEntries = 2,
249 250
    nPrefetchEntries = 2,
    hasPrefetch = true,
251
  ),
J
Jiawei Lin 已提交
252
  dcacheParametersOpt: Option[DCacheParameters] = Some(DCacheParameters(
253 254 255 256
    tagECC = Some("secded"),
    dataECC = Some("secded"),
    replacer = Some("setplru"),
    nMissEntries = 16,
W
William Wang 已提交
257 258
    nProbeEntries = 8,
    nReleaseEntries = 18
J
Jiawei Lin 已提交
259 260
  )),
  L2CacheParamsOpt: Option[HCCacheParameters] = Some(HCCacheParameters(
261 262 263 264
    name = "l2",
    level = 2,
    ways = 8,
    sets = 1024, // default 512KB L2
L
LinJiawei 已提交
265
    prefetch = Some(huancun.prefetch.PrefetchReceiverParams())
J
Jiawei Lin 已提交
266
  )),
J
Jiawei Lin 已提交
267
  L2NBanks: Int = 1,
268
  usePTWRepeater: Boolean = false,
H
Haoyuan Feng 已提交
269 270
  softTLB: Boolean = false, // dpi-c l1tlb debug only
  softPTW: Boolean = false, // dpi-c l2tlb debug only
271
  softPTWDelay: Int = 1
272
){
273 274 275
  val allHistLens = SCHistLens ++ ITTageTableInfos.map(_._2) ++ TageTableInfos.map(_._2) :+ UbtbGHRLength
  val HistoryLength = allHistLens.max + numBr * FtqSize + 9 // 256 for the predictor configs now

276
  val loadExuConfigs = Seq.fill(exuParameters.LduCnt)(LdExeUnitCfg)
277
  val storeExuConfigs = Seq.fill(exuParameters.StuCnt)(StaExeUnitCfg) ++ Seq.fill(exuParameters.StuCnt)(StdExeUnitCfg)
278

279
  val intExuConfigs = (Seq.fill(exuParameters.AluCnt)(AluExeUnitCfg) ++
280
    Seq.fill(exuParameters.MduCnt)(MulDivExeUnitCfg) :+ JumpCSRExeUnitCfg)
281 282 283 284 285 286 287 288 289 290 291 292

  val fpExuConfigs =
    Seq.fill(exuParameters.FmacCnt)(FmacExeUnitCfg) ++
      Seq.fill(exuParameters.FmiscCnt)(FmiscExeUnitCfg)

  val exuConfigs: Seq[ExuConfig] = intExuConfigs ++ fpExuConfigs ++ loadExuConfigs ++ storeExuConfigs
}

case object DebugOptionsKey extends Field[DebugOptions]

case class DebugOptions
(
293 294
  FPGAPlatform: Boolean = false,
  EnableDifftest: Boolean = false,
295
  AlwaysBasicDiff: Boolean = true,
296
  EnableDebug: Boolean = false,
297
  EnablePerfDebug: Boolean = true,
298 299
  UseDRAMSim: Boolean = false,
  EnableTopDown: Boolean = false
300 301 302 303 304 305
)

trait HasXSParameter {

  implicit val p: Parameters

306 307
  val PAddrBits = p(SoCParamsKey).PAddrBits // PAddrBits is Phyical Memory addr bits

308 309 310 311
  val coreParams = p(XSCoreParamsKey)
  val env = p(DebugOptionsKey)

  val XLEN = coreParams.XLEN
312
  val VLEN = coreParams.VLEN
313 314 315 316 317 318 319 320 321 322 323
  val minFLen = 32
  val fLen = 64
  def xLen = XLEN

  val HasMExtension = coreParams.HasMExtension
  val HasCExtension = coreParams.HasCExtension
  val HasDiv = coreParams.HasDiv
  val HasIcache = coreParams.HasICache
  val HasDcache = coreParams.HasDCache
  val AddrBits = coreParams.AddrBits // AddrBits is used in some cases
  val VAddrBits = coreParams.VAddrBits // VAddrBits is Virtual Memory addr bits
324
  val AsidLength = coreParams.AsidLength
325
  val ReSelectLen = coreParams.ReSelectLen
326 327 328 329
  val AddrBytes = AddrBits / 8 // unused
  val DataBits = XLEN
  val DataBytes = DataBits / 8
  val HasFPU = coreParams.HasFPU
Z
Ziyue Zhang 已提交
330
  val HasVPU = coreParams.HasVPU
Z
zhanglinjuan 已提交
331
  val HasCustomCSRCacheOp = coreParams.HasCustomCSRCacheOp
332 333 334 335 336 337 338 339 340 341
  val FetchWidth = coreParams.FetchWidth
  val PredictWidth = FetchWidth * (if (HasCExtension) 2 else 1)
  val EnableBPU = coreParams.EnableBPU
  val EnableBPD = coreParams.EnableBPD // enable backing predictor(like Tage) in BPUStage3
  val EnableRAS = coreParams.EnableRAS
  val EnableLB = coreParams.EnableLB
  val EnableLoop = coreParams.EnableLoop
  val EnableSC = coreParams.EnableSC
  val EnbaleTlbDebug = coreParams.EnbaleTlbDebug
  val HistoryLength = coreParams.HistoryLength
342
  val EnableGHistDiff = coreParams.EnableGHistDiff
343
  val UbtbGHRLength = coreParams.UbtbGHRLength
344
  val UbtbSize = coreParams.UbtbSize
345
  val EnableFauFTB = coreParams.EnableFauFTB
346 347
  val FtbSize = coreParams.FtbSize
  val FtbWays = coreParams.FtbWays
348
  val RasSize = coreParams.RasSize
Z
zoujr 已提交
349

350 351
  def getBPDComponents(resp_in: BranchPredictionResp, p: Parameters) = {
    coreParams.branchPredictor(resp_in, p)
Z
zoujr 已提交
352
  }
353 354
  val numBr = coreParams.numBr
  val TageTableInfos = coreParams.TageTableInfos
L
Lingrui98 已提交
355
  val TageBanks = coreParams.numBr
356 357
  val SCNRows = coreParams.SCNRows
  val SCCtrBits = coreParams.SCCtrBits
L
Lingrui98 已提交
358 359
  val SCHistLens = coreParams.SCHistLens
  val SCNTables = coreParams.SCNTables
360

L
Lingrui98 已提交
361 362
  val SCTableInfos = Seq.fill(SCNTables)((SCNRows, SCCtrBits)) zip SCHistLens map {
    case ((n, cb), h) => (n, cb, h)
363 364 365 366
  }
  val ITTageTableInfos = coreParams.ITTageTableInfos
  type FoldedHistoryInfo = Tuple2[Int, Int]
  val foldedGHistInfos =
367
    (TageTableInfos.map{ case (nRows, h, t) =>
368
      if (h > 0)
369
        Set((h, min(log2Ceil(nRows/numBr), h)), (h, min(h, t)), (h, min(h, t-1)))
370 371
      else
        Set[FoldedHistoryInfo]()
372
    }.reduce(_++_).toSet ++
L
Lingrui98 已提交
373
    SCTableInfos.map{ case (nRows, _, h) =>
374
      if (h > 0)
L
Lingrui98 已提交
375
        Set((h, min(log2Ceil(nRows/TageBanks), h)))
376 377
      else
        Set[FoldedHistoryInfo]()
L
Lingrui98 已提交
378
    }.reduce(_++_).toSet ++
379 380 381 382 383
    ITTageTableInfos.map{ case (nRows, h, t) =>
      if (h > 0)
        Set((h, min(log2Ceil(nRows), h)), (h, min(h, t)), (h, min(h, t-1)))
      else
        Set[FoldedHistoryInfo]()
384 385 386
    }.reduce(_++_) ++
      Set[FoldedHistoryInfo]((UbtbGHRLength, log2Ceil(UbtbSize)))
    ).toList
387

388

Z
zoujr 已提交
389

390 391 392 393 394 395 396
  val CacheLineSize = coreParams.CacheLineSize
  val CacheLineHalfWord = CacheLineSize / 16
  val ExtHistoryLength = HistoryLength + 64
  val IBufSize = coreParams.IBufSize
  val DecodeWidth = coreParams.DecodeWidth
  val RenameWidth = coreParams.RenameWidth
  val CommitWidth = coreParams.CommitWidth
397
  val MaxUopSize = coreParams.MaxUopSize
398 399 400
  val FtqSize = coreParams.FtqSize
  val IssQueSize = coreParams.IssQueSize
  val EnableLoadFastWakeUp = coreParams.EnableLoadFastWakeUp
401 402 403
  val IntLogicRegs = coreParams.IntLogicRegs
  val FpLogicRegs = coreParams.FpLogicRegs
  val VecLogicRegs = coreParams.VecLogicRegs
404 405
  val NRPhyRegs = coreParams.NRPhyRegs
  val PhyRegIdxWidth = log2Up(NRPhyRegs)
X
Xuan Hu 已提交
406 407 408 409
  val IntPhyRegs = coreParams.IntPhyRegs
  val VfPhyRegs = coreParams.VfPhyRegs
  val IntPregIdxWidth = log2Up(IntPhyRegs)
  val VfPregIdxWidth = log2Up(VfPhyRegs)
Y
Yinan Xu 已提交
410
  val RobSize = coreParams.RobSize
411
  val RabSize = coreParams.RabSize
412
  val IntRefCounterWidth = log2Ceil(RobSize)
413
  val LoadQueueSize = coreParams.LoadQueueSize
414
  val LoadQueueNWriteBanks = coreParams.LoadQueueNWriteBanks
415
  val StoreQueueSize = coreParams.StoreQueueSize
416
  val StoreQueueNWriteBanks = coreParams.StoreQueueNWriteBanks
W
William Wang 已提交
417
  val VlsQueueSize = coreParams.VlsQueueSize
418 419 420
  val dpParams = coreParams.dpParams
  val exuParameters = coreParams.exuParameters
  val NRMemReadPorts = exuParameters.LduCnt + 2 * exuParameters.StuCnt
421 422 423 424
  val NRIntReadPorts = 2 * exuParameters.AluCnt + NRMemReadPorts
  val NRIntWritePorts = exuParameters.AluCnt + exuParameters.MduCnt + exuParameters.LduCnt
  val NRFpReadPorts = 3 * exuParameters.FmacCnt + exuParameters.StuCnt
  val NRFpWritePorts = exuParameters.FpExuCnt + exuParameters.LduCnt
425 426
  val LoadPipelineWidth = coreParams.LoadPipelineWidth
  val StorePipelineWidth = coreParams.StorePipelineWidth
W
William Wang 已提交
427 428 429
  val VecMemSrcInWidth = coreParams.VecMemSrcInWidth
  val VecMemInstWbWidth = coreParams.VecMemInstWbWidth
  val VecMemDispatchWidth = coreParams.VecMemDispatchWidth
430
  val StoreBufferSize = coreParams.StoreBufferSize
431
  val StoreBufferThreshold = coreParams.StoreBufferThreshold
432
  val EnsbufferWidth = coreParams.EnsbufferWidth
433
  val UncacheBufferSize = coreParams.UncacheBufferSize
434
  val EnableLoadToLoadForward = coreParams.EnableLoadToLoadForward
435
  val EnableFastForward = coreParams.EnableFastForward
W
William Wang 已提交
436
  val EnableLdVioCheckAfterReset = coreParams.EnableLdVioCheckAfterReset
437 438
  val EnableSoftPrefetchAfterReset = coreParams.EnableSoftPrefetchAfterReset
  val EnableCacheErrorAfterReset = coreParams.EnableCacheErrorAfterReset
439
  val EnableDCacheWPU = coreParams.EnableDCacheWPU
440
  val EnableAccurateLoadError = coreParams.EnableAccurateLoadError
441
  val EnableUncacheWriteOutstanding = coreParams.EnableUncacheWriteOutstanding
442
  val asidLen = coreParams.MMUAsidLen
443
  val BTLBWidth = coreParams.LoadPipelineWidth + coreParams.StorePipelineWidth
444
  val refillBothTlb = coreParams.refillBothTlb
445 446 447
  val itlbParams = coreParams.itlbParameters
  val ldtlbParams = coreParams.ldtlbParameters
  val sttlbParams = coreParams.sttlbParameters
448
  val pftlbParams = coreParams.pftlbParameters
449
  val btlbParams = coreParams.btlbParameters
450
  val l2tlbParams = coreParams.l2tlbParameters
451 452
  val NumPerfCounters = coreParams.NumPerfCounters

453 454
  val NumRs = (exuParameters.JmpCnt+1)/2 + (exuParameters.AluCnt+1)/2 + (exuParameters.MulCnt+1)/2 +
              (exuParameters.MduCnt+1)/2 + (exuParameters.FmacCnt+1)/2 +  + (exuParameters.FmiscCnt+1)/2 +
455
              (exuParameters.FmiscDivSqrtCnt+1)/2 + (exuParameters.LduCnt+1)/2 +
456
              (exuParameters.StuCnt+1)/2 + (exuParameters.StuCnt+1)/2
457

458 459 460
  val instBytes = if (HasCExtension) 2 else 4
  val instOffsetBits = log2Ceil(instBytes)

461
  val icacheParameters = coreParams.icacheParameters
J
Jiawei Lin 已提交
462
  val dcacheParameters = coreParams.dcacheParametersOpt.getOrElse(DCacheParameters())
463

464
  // dcache block cacheline when lr for LRSCCycles - LRSCBackOff cycles
465
  // for constrained LR/SC loop
466 467 468
  val LRSCCycles = 64
  // for lr storm
  val LRSCBackOff = 8
469 470 471 472

  // cache hierarchy configurations
  val l1BusDataWidth = 256

473 474 475 476 477 478 479 480 481 482 483 484 485
  // load violation predict
  val ResetTimeMax2Pow = 20 //1078576
  val ResetTimeMin2Pow = 10 //1024
  // wait table parameters
  val WaitTableSize = 1024
  val MemPredPCWidth = log2Up(WaitTableSize)
  val LWTUse2BitCounter = true
  // store set parameters
  val SSITSize = WaitTableSize
  val LFSTSize = 32
  val SSIDWidth = log2Up(LFSTSize)
  val LFSTWidth = 4
  val StoreSetEnable = true // LWT will be disabled if SS is enabled
486

487 488 489 490
  val loadExuConfigs = coreParams.loadExuConfigs
  val storeExuConfigs = coreParams.storeExuConfigs

  val intExuConfigs = coreParams.intExuConfigs
491

492
  val fpExuConfigs = coreParams.fpExuConfigs
493

494
  val exuConfigs = coreParams.exuConfigs
495

496 497 498 499 500 501 502 503
  val PCntIncrStep: Int = 6
  val numPCntHc: Int = 25
  val numPCntPtw: Int = 19

  val numCSRPCntFrontend = 8
  val numCSRPCntCtrl     = 8
  val numCSRPCntLsu      = 8
  val numCSRPCntHc       = 5
504
}