Skip to content

Commit 06a818a

Browse files
committed
Remove cake-pattern from examples
1 parent 26d25b8 commit 06a818a

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

generators/chipyard/src/main/scala/DigitalTop.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ class DigitalTop(implicit p: Parameters) extends ChipyardSystem
3131
with sifive.blocks.devices.spi.HasPeripherySPIFlash // Enables optionally adding the sifive SPI flash controller
3232
with sifive.blocks.devices.spi.HasPeripherySPI // Enables optionally adding the sifive SPI port
3333
with icenet.CanHavePeripheryIceNIC // Enables optionally adding the IceNIC for FireSim
34-
with chipyard.example.CanHavePeripheryInitZero // Enables optionally adding the initzero example widget
3534
with chipyard.example.CanHavePeripheryGCD // Enables optionally adding the GCD example widget
36-
with chipyard.example.CanHavePeripheryStreamingFIR // Enables optionally adding the DSPTools FIR example widget
37-
with chipyard.example.CanHavePeripheryStreamingPassthrough // Enables optionally adding the DSPTools streaming-passthrough example widget
3835
with chipyard.clocking.HasChipyardPRCI // Use Chipyard reset/clock distribution
3936
with chipyard.clocking.CanHaveClockTap // Enables optionally adding a clock tap output port
4037
with constellation.soc.CanHaveGlobalNoC // Support instantiating a global NoC interconnect

generators/chipyard/src/main/scala/example/InitZero.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package chipyard.example
22

33
import chisel3._
44
import chisel3.util._
5-
import freechips.rocketchip.subsystem.{BaseSubsystem, CacheBlockBytes, FBUS}
5+
import freechips.rocketchip.subsystem._
66
import org.chipsalliance.cde.config.{Parameters, Field, Config}
77
import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, IdRange}
88
import freechips.rocketchip.tilelink._
@@ -57,19 +57,19 @@ class InitZeroModuleImp(outer: InitZero) extends LazyModuleImp(outer) {
5757
}
5858
}
5959

60-
trait CanHavePeripheryInitZero { this: BaseSubsystem =>
61-
implicit val p: Parameters
62-
60+
case object InitZeroInjector extends SubsystemInjector((p, baseSubsystem) => {
6361
p(InitZeroKey) .map { k =>
64-
val fbus = locateTLBusWrapper(FBUS)
62+
implicit val q: Parameters = p
63+
val fbus = baseSubsystem.locateTLBusWrapper(FBUS)
6564
val initZero = fbus { LazyModule(new InitZero()(p)) }
6665
fbus.coupleFrom("init-zero") { _ := initZero.node }
6766
}
68-
}
67+
})
6968

7069

7170
// DOC include start: WithInitZero
7271
class WithInitZero(base: BigInt, size: BigInt) extends Config((site, here, up) => {
7372
case InitZeroKey => Some(InitZeroConfig(base, size))
73+
case SubsystemInjectorKey => up(SubsystemInjectorKey) + InitZeroInjector
7474
})
7575
// DOC include end: WithInitZero

generators/chipyard/src/main/scala/example/dsptools/GenericFIR.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ class TLGenericFIRChain[T<:Data:Ring] (genIn: T, genOut: T, coeffs: => Seq[T], p
196196
// DOC include end: TLGenericFIRChain chisel
197197

198198
// DOC include start: CanHavePeripheryStreamingFIR chisel
199-
trait CanHavePeripheryStreamingFIR extends BaseSubsystem {
199+
case object StreamingFIRInjector extends SubsystemInjector((p, baseSubsystem) => {
200200
val streamingFIR = p(GenericFIRKey) match {
201201
case Some(params) => {
202-
val pbus = locateTLBusWrapper(PBUS)
202+
implicit val q: Parameters = p
203+
val pbus = baseSubsystem.locateTLBusWrapper(PBUS)
203204
val domain = pbus.generateSynchronousDomain.suggestName("fir_domain")
204205
val streamingFIR = domain { LazyModule(new TLGenericFIRChain(
205206
genIn = FixedPoint(8.W, 3.BP),
@@ -211,7 +212,7 @@ trait CanHavePeripheryStreamingFIR extends BaseSubsystem {
211212
}
212213
case None => None
213214
}
214-
}
215+
})
215216
// DOC include end: CanHavePeripheryStreamingFIR chisel
216217

217218
/**
@@ -220,5 +221,6 @@ trait CanHavePeripheryStreamingFIR extends BaseSubsystem {
220221
// DOC include start: WithStreamingFIR
221222
class WithStreamingFIR extends Config((site, here, up) => {
222223
case GenericFIRKey => Some(GenericFIRParams(depth = 8))
224+
case SubsystemInjectorKey => up(SubsystemInjectorKey) + StreamingFIRInjector
223225
})
224226
// DOC include end: WithStreamingFIR

generators/chipyard/src/main/scala/example/dsptools/StreamingPassthrough.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,24 @@ class TLStreamingPassthroughChain[T<:Data:Ring](params: StreamingPassthroughPara
128128
TLReadQueue(params.depth, AddressSet(params.readAddress, 0xff))(_)
129129
))
130130

131-
trait CanHavePeripheryStreamingPassthrough { this: BaseSubsystem =>
131+
case object StreamingPassthroughInjector extends SubsystemInjector((p, baseSubsystem) => {
132132
val passthrough = p(StreamingPassthroughKey) match {
133133
case Some(params) => {
134-
val pbus = locateTLBusWrapper(PBUS)
134+
implicit val q: Parameters = p
135+
val pbus = baseSubsystem.locateTLBusWrapper(PBUS)
135136
val domain = pbus.generateSynchronousDomain.suggestName("streaming_passthrough_domain")
136137
val streamingPassthroughChain = domain { LazyModule(new TLStreamingPassthroughChain(params, UInt(32.W))) }
137138
pbus.coupleTo("streamingPassthrough") { domain { streamingPassthroughChain.mem.get := TLFIFOFixer() := TLFragmenter(pbus.beatBytes, pbus.blockBytes)} := _ }
138139
Some(streamingPassthroughChain)
139140
}
140141
case None => None
141142
}
142-
}
143+
})
143144

144145
/**
145146
* Mixin to add passthrough to rocket config
146147
*/
147148
class WithStreamingPassthrough extends Config((site, here, up) => {
148149
case StreamingPassthroughKey => Some(StreamingPassthroughParams(depth = 8))
150+
case SubsystemInjectorKey => up(SubsystemInjectorKey) + StreamingPassthroughInjector
149151
})

0 commit comments

Comments
 (0)