@@ -139,6 +139,7 @@ class SRAMWriteBus[T <: Data](
139139 * @param latency output setup multicycle, witch means how many cycles the data is ready for capture after read sampling clock edge.
140140 * @param extraHold enable a extra input hold cycle. User should keep all input for one cycle if this option is enabled.
141141 * @param extClockGate expose clock control signals to IOs to support using external clock gate when doing MBIST.
142+ * @param hasSramCtl enable sram ctl support.
142143 * @param suffix add suffix in the name of SRAM wrapper
143144 */
144145
@@ -149,7 +150,8 @@ class SRAMTemplate[T <: Data](
149150 useBitmask : Boolean = false , withClockGate : Boolean = false ,
150151 separateGateClock : Boolean = false ,
151152 hasMbist : Boolean = false , latency : Int = 1 , extraHold: Boolean = false ,
152- extClockGate : Boolean = false , suffix : Option [String ] = None
153+ extClockGate : Boolean = false , hasSramCtl : Boolean = false ,
154+ suffix : Option [String ] = None
153155)(implicit valName : sourcecode.FullName ) extends Module {
154156 val io = IO (new Bundle {
155157 val r = Flipped (new SRAMReadBus (gen, set, way))
@@ -191,6 +193,7 @@ class SRAMTemplate[T <: Data](
191193 latency = latency,
192194 bist = hasMbist,
193195 broadcast = io.broadcast,
196+ hasSramCtl = hasSramCtl,
194197 rclk,
195198 Some (wclk),
196199 suffix = suffix.getOrElse(SramHelper .getSramSuffix(valName.value)),
@@ -264,7 +267,7 @@ class SRAMTemplate[T <: Data](
264267 }
265268
266269 private val ramRdata = SramProto .read(array, singlePort, ramRaddr, ramRen)
267- when(ramWen && ! brcBd.ram_hold) {
270+ when(ramWen && ! brcBd.mbist. ram_hold) {
268271 SramProto .write(array, singlePort, ramWaddr, ramWdata, ramWmask)
269272 }
270273
@@ -338,7 +341,7 @@ class SRAMTemplate[T <: Data](
338341
339342/**
340343 * Split large SRAM into smaller ones. This class draws inspiration from coupledL2-SplittedSRAM
341- * Since the SplittedSRAM class cannot be fully compatible with the parameters of the
344+ * Since the SplittedSRAM class cannot be fully compatible with the parameters of the
342345 * FoldedSRAMTemplate class, the SplittedSRAMTemplate class is therefore defined.
343346 */
344347class SplittedSRAMTemplate [T <: Data ]
@@ -351,7 +354,8 @@ class SplittedSRAMTemplate[T <: Data]
351354 useBitmask : Boolean = false , withClockGate : Boolean = false ,
352355 separateGateClock : Boolean = false ,
353356 hasMbist : Boolean = false , latency : Int = 1 , extraHold: Boolean = false ,
354- extClockGate : Boolean = false , suffix : Option [String ] = None
357+ extClockGate : Boolean = false , hasSramCtl : Boolean = false ,
358+ suffix : Option [String ] = None
355359)(implicit valName : sourcecode.FullName ) extends Module {
356360 val io = IO (new Bundle () {
357361 val r = Flipped (new SRAMReadBus (gen, set, way))
@@ -381,7 +385,8 @@ class SplittedSRAMTemplate[T <: Data]
381385 holdRead, bypassWrite,
382386 useBitmask,withClockGate,
383387 separateGateClock, hasMbist, latency, extraHold,
384- extClockGate, Some (suffix.getOrElse(SramHelper .getSramSuffix(valName.value)))
388+ extClockGate, hasSramCtl,
389+ Some (suffix.getOrElse(SramHelper .getSramSuffix(valName.value)))
385390 ))
386391 )))
387392
@@ -399,7 +404,6 @@ class SplittedSRAMTemplate[T <: Data]
399404 if (array(i)(j)(k).extra_reset.isDefined) {
400405 array(i)(j)(k).extra_reset.get := extra_reset.get
401406 }
402-
403407 array(i)(j)(k).io.r.req.bits.apply(r_setIdx)
404408 array(i)(j)(k).io.r.req.valid := io.r.req.valid && ren
405409 array(i)(j)(k).io.w.req.valid := io.w.req.valid && wen // && needWrite
@@ -412,7 +416,7 @@ class SplittedSRAMTemplate[T <: Data]
412416 array(i)(j)(k).io.w.req.bits.apply(
413417 VecInit (io.w.req.bits.data.slice(innerWays * j, innerWays * (j+ 1 )).map(_.asUInt(innerWidth * (k+ 1 ) - 1 , innerWidth * k))),
414418 w_setIdx, waymask
415- )
419+ )
416420 }
417421
418422 }
@@ -470,7 +474,8 @@ class FoldedSRAMTemplate[T <: Data](
470474 bypassWrite : Boolean = false , useBitmask : Boolean = false ,
471475 withClockGate : Boolean = false , avoidSameAddr : Boolean = false ,
472476 separateGateClock : Boolean = false , // no effect, only supports independent RW cg, only for API compatibility
473- hasMbist : Boolean = false , latency : Int = 1 , suffix : Option [String ] = None
477+ hasMbist : Boolean = false , latency : Int = 1 ,
478+ hasSramCtl : Boolean = false , suffix : Option [String ] = None
474479)(implicit valName : sourcecode.FullName ) extends Module {
475480 val io = IO (new Bundle {
476481 val r = Flipped (new SRAMReadBus (gen, set, way))
@@ -491,7 +496,7 @@ class FoldedSRAMTemplate[T <: Data](
491496 shouldReset= shouldReset, extraReset= extraReset, holdRead= holdRead,
492497 singlePort= singlePort, bypassWrite= bypassWrite, useBitmask= useBitmask,
493498 withClockGate= withClockGate, separateGateClock= separateGateClock,
494- hasMbist= hasMbist, latency= latency, extraHold = false ,
499+ hasMbist= hasMbist, latency= latency, extraHold = false , hasSramCtl = hasSramCtl,
495500 suffix = Some (suffix.getOrElse(SramHelper .getSramSuffix(valName.value)))))
496501 if (array.extra_reset.isDefined) {
497502 array.extra_reset.get := extra_reset.get
@@ -580,14 +585,15 @@ class FoldedSRAMTemplate[T <: Data](
580585 }
581586}
582587class SRAMTemplateWithArbiter [T <: Data ](nRead : Int , gen : T , set : Int , way : Int = 1 ,
583- shouldReset : Boolean = false , hasMbist: Boolean = false , latency: Int = 1 ) extends Module {
588+ shouldReset : Boolean = false , hasMbist: Boolean = false , latency: Int = 1 ,
589+ hasSramCtl : Boolean = false ) extends Module {
584590 val io = IO (new Bundle {
585591 val r = Flipped (Vec (nRead, new SRAMReadBus (gen, set, way)))
586592 val w = Flipped (new SRAMWriteBus (gen, set, way))
587593 })
588594
589595 val ram = Module (new SRAMTemplate (gen, set, way, shouldReset = shouldReset, holdRead = false , singlePort = true ,
590- hasMbist = hasMbist, latency = latency))
596+ hasMbist = hasMbist, latency = latency, hasSramCtl = hasSramCtl ))
591597 ram.io.w <> io.w
592598
593599 val readArb = Module (new Arbiter (chiselTypeOf(io.r(0 ).req.bits), nRead))
0 commit comments