Skip to content

Commit

Permalink
Add api to force unified buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Oct 20, 2023
1 parent 1533d8e commit 4eb0520
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/scala/channel/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ case class UserChannelParams(
p => u => u,
crossingType: ClockCrossingType = NoCrossing,
useOutputQueues: Boolean = true,
unifiedBuffer: Boolean = true,
srcSpeedup: Int = 1,
destSpeedup: Int = 1
) {
Expand Down Expand Up @@ -101,6 +102,7 @@ case class ChannelParams(
destSpeedup: Int,
channelGen: Parameters => ChannelOutwardNode => ChannelOutwardNode = { p => u => u },
useOutputQueues: Boolean,
unifiedBuffer: Boolean
) extends BaseChannelParams {
val nVirtualChannels = virtualChannelParams.size
val maxBufferSize = virtualChannelParams.map(_.bufferSize).max
Expand Down Expand Up @@ -131,7 +133,8 @@ object ChannelParams {
virtualChannelParams = user.virtualChannelParams.zipWithIndex.map { case (vP, vc) =>
VirtualChannelParams(srcId, destId, vc, vP.bufferSize, Set[FlowRoutingInfo]())
},
useOutputQueues = user.useOutputQueues
useOutputQueues = user.useOutputQueues,
unifiedBuffer = user.unifiedBuffer
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/router/EgressUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import freechips.rocketchip.util._
import constellation.channel._
import constellation.routing.{FlowRoutingBundle}

class EgressUnit(coupleSAVA: Boolean, inParams: Seq[ChannelParams], ingressParams: Seq[IngressChannelParams], cParam: EgressChannelParams)
class EgressUnit(coupleSAVA: Boolean, combineSAST: Boolean, inParams: Seq[ChannelParams], ingressParams: Seq[IngressChannelParams], cParam: EgressChannelParams)
(implicit p: Parameters) extends AbstractOutputUnit(inParams, ingressParams, cParam)(p) {

class EgressUnitIO extends AbstractOutputUnitIO(inParams, ingressParams, cParam) {
Expand All @@ -19,7 +19,7 @@ class EgressUnit(coupleSAVA: Boolean, inParams: Seq[ChannelParams], ingressParam

val channel_empty = RegInit(true.B)
val flow = Reg(new FlowRoutingBundle)
val q = Module(new Queue(new EgressFlit(cParam.payloadBits), 3, flow=true))
val q = Module(new Queue(new EgressFlit(cParam.payloadBits), 3 - (if (combineSAST) 1 else 0), flow=true))
q.io.enq.valid := io.in(0).valid
q.io.enq.bits.head := io.in(0).bits.head
q.io.enq.bits.tail := io.in(0).bits.tail
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/router/Router.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ class Router(
Module(new OutputUnit(inParams, ingressParams, u))
.suggestName(s"output_unit_${i}_to_${u.destId}")}
val egress_units = egressParams.zipWithIndex.map { case (u,i) =>
Module(new EgressUnit(routerParams.user.coupleSAVA && all_input_units.size == 1, inParams, ingressParams, u))
Module(new EgressUnit(routerParams.user.coupleSAVA && all_input_units.size == 1,
routerParams.user.combineSAST,
inParams, ingressParams, u))
.suggestName(s"egress_unit_${i+nOutputs}_to_${u.egressId}")}
val all_output_units = output_units ++ egress_units

Expand Down

0 comments on commit 4eb0520

Please sign in to comment.