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 13, 2023
1 parent 7d51155 commit f381710
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 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)
}

0 comments on commit f381710

Please sign in to comment.