Skip to content

Commit

Permalink
update: update clk_gate
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokamikami committed Apr 22, 2024
1 parent 0a50585 commit 22e8538
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Utility
9 changes: 2 additions & 7 deletions src/main/scala/huancun/BaseDirectory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import chisel3.util.random.LFSR
import freechips.rocketchip.tilelink.TLMessages
import freechips.rocketchip.util.{Pow2ClockDivider, ReplacementPolicy}
import huancun.utils._
import utility.{Code}
import utility.ClockGate
import utility.{ClockGate, Code}

trait BaseDirResult extends HuanCunBundle {
val idOH = UInt(mshrsAll.W) // which mshr the result should be sent to
Expand Down Expand Up @@ -107,13 +106,9 @@ class SubDirectory[T <: Data](
val resetIdx = RegInit((sets - 1).U)
val metaArray = Module(new SRAMTemplate(chiselTypeOf(dir_init), sets, ways, singlePort = true, input_clk_div_by_2 = clk_div_by_2))

val clkGate = Module(new ClockGate)
val clk_en = RegInit(false.B)
clk_en := ~clk_en
clkGate.io.TE := false.B
clkGate.io.E := clk_en
clkGate.io.CK := clock
val masked_clock = clkGate.io.Q
val masked_clock = ClockGate(false.B, clk_en, clock)

val tag_wen = io.tag_w.valid
val dir_wen = io.dir_w.valid
Expand Down
8 changes: 2 additions & 6 deletions src/main/scala/huancun/utils/SRAMWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package huancun.utils
import chisel3._
import chisel3.util._
import freechips.rocketchip.util.Pow2ClockDivider
import utility.ClockGate
import utility.{ClockGate}

class SRAMWrapper[T <: Data]
(
Expand Down Expand Up @@ -31,13 +31,9 @@ class SRAMWrapper[T <: Data]
gen, innerSet, 1, singlePort = true, input_clk_div_by_2 = clk_div_by_2
))

val clkGate = Module(new ClockGate)
val clk_en = RegInit(false.B)
clk_en := ~clk_en
clkGate.io.TE := false.B
clkGate.io.E := clk_en
clkGate.io.CK := clock
val masked_clock = clkGate.io.Q
val masked_clock = ClockGate(false.B, clk_en, clock)

if (clk_div_by_2) {
sram.clock := masked_clock
Expand Down

0 comments on commit 22e8538

Please sign in to comment.