Skip to content

Commit

Permalink
migrate to new BundleMap API
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jul 27, 2023
1 parent b239896 commit 86bb656
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
5 changes: 1 addition & 4 deletions src/main/scala/amba/axis/Bundles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ case class AXISIdField (width: Int) extends SimpleBundleField(AXISId) (Output(
case class AXISDestField(width: Int) extends SimpleBundleField(AXISDest)(Output(UInt(width.W)), 0.U)
case class AXISKeepField(width: Int) extends SimpleBundleField(AXISKeep)(Output(UInt(width.W)), ~0.U(width.W))
case class AXISStrbField(width: Int) extends SimpleBundleField(AXISStrb)(Output(UInt(width.W)), ~0.U(width.W))
case class AXISDataField(width: Int) extends BundleField(AXISData) {
def data = Output(UInt(width.W))
def default(x: UInt): Unit = { x := DontCare }
}
case class AXISDataField(width: Int) extends BundleField[UInt](AXISData, Output(UInt(width.W)), _ := DontCare)

class AXISBundleBits(val params: AXISBundleParameters) extends BundleMap(AXISBundle.keys(params)) {
def last = if (params.hasLast) apply(AXISLast) else true.B
Expand Down
29 changes: 12 additions & 17 deletions src/main/scala/amba/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ package object amba {
}

case object AMBAProt extends ControlKey[AMBAProtBundle]("amba_prot")
case class AMBAProtField() extends BundleField(AMBAProt) {
def data = Output(new AMBAProtBundle)
def default(x: AMBAProtBundle): Unit = {
x.bufferable := false.B
x.modifiable := false.B
x.readalloc := false.B
x.writealloc := false.B
x.privileged := true.B
x.secure := true.B
x.fetch := false.B
}
}

case class AMBAProtField() extends BundleField[AMBAProtBundle](AMBAProt, Output(new AMBAProtBundle), x => {
x.bufferable := false.B
x.modifiable := false.B
x.readalloc := false.B
x.writealloc := false.B
x.privileged := true.B
x.secure := true.B
x.fetch := false.B
})

// Used to convert a TileLink corrupt signal into an AMBA user bit
case object AMBACorrupt extends DataKey[Bool]("corrupt")
case class AMBACorruptField() extends BundleField(AMBACorrupt) {
def data = Output(Bool())
def default(x: Bool): Unit = { x := false.B }
}
}
case class AMBACorruptField() extends BundleField[Bool](AMBACorrupt, Output(Bool()), x => x := false.B)
}
11 changes: 4 additions & 7 deletions src/main/scala/tilelink/RegisterRouter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ class TLRegisterRouterExtraBundle(val sourceBits: Int, val sizeBits: Int) extend
}

case object TLRegisterRouterExtra extends ControlKey[TLRegisterRouterExtraBundle]("tlrr_extra")
case class TLRegisterRouterExtraField(sourceBits: Int, sizeBits: Int) extends BundleField(TLRegisterRouterExtra) {
def data = Output(new TLRegisterRouterExtraBundle(sourceBits, sizeBits))
def default(x: TLRegisterRouterExtraBundle) = {
x.size := 0.U
x.source := 0.U
}
}
case class TLRegisterRouterExtraField(sourceBits: Int, sizeBits: Int) extends BundleField[TLRegisterRouterExtraBundle](TLRegisterRouterExtra, Output(new TLRegisterRouterExtraBundle(sourceBits, sizeBits)), x => {
x.size := 0.U
x.source := 0.U
})

/** TLRegisterNode is a specialized TL SinkNode that encapsulates MMIO registers.
* It provides functionality for describing and outputting metdata about the registers in several formats.
Expand Down
11 changes: 4 additions & 7 deletions src/main/scala/tilelink/ToAXI4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ class AXI4TLStateBundle(val sourceBits: Int) extends Bundle {
}

case object AXI4TLState extends ControlKey[AXI4TLStateBundle]("tl_state")
case class AXI4TLStateField(sourceBits: Int) extends BundleField(AXI4TLState) {
def data = Output(new AXI4TLStateBundle(sourceBits))
def default(x: AXI4TLStateBundle) = {
x.size := 0.U
x.source := 0.U
}
}
case class AXI4TLStateField(sourceBits: Int) extends BundleField[AXI4TLStateBundle](AXI4TLState, Output(new AXI4TLStateBundle(sourceBits)), x => {
x.size := 0.U
x.source := 0.U
})

/** TLtoAXI4IdMap serves as a record for the translation performed between id spaces.
*
Expand Down

0 comments on commit 86bb656

Please sign in to comment.