1
0

add convenient constructors for NASTI channels

This commit is contained in:
Howard Mao 2015-09-10 17:32:40 -07:00
parent ede1ada053
commit 8a8d52da4f
2 changed files with 74 additions and 6 deletions

View File

@ -113,6 +113,75 @@ class NASTIReadDataChannel extends NASTIResponseChannel with HasNASTIData {
val user = UInt(width = nastiRUserBits)
}
object NASTIWriteAddressChannel {
def apply(id: UInt, addr: UInt, size: UInt, len: UInt) = {
val aw = Wire(new NASTIWriteAddressChannel)
aw.id := id
aw.addr := addr
aw.len := len
aw.size := size
aw.burst := UInt("b01")
aw.lock := Bool(false)
aw.cache := UInt("b0000")
aw.prot := UInt("b000")
aw.qos := UInt("b0000")
aw.region := UInt("b0000")
aw.user := UInt(0)
aw
}
}
object NASTIReadAddressChannel {
def apply(id: UInt, addr: UInt, size: UInt, len: UInt) = {
val ar = Wire(new NASTIReadAddressChannel)
ar.id := id
ar.addr := addr
ar.len := len
ar.size := size
ar.burst := UInt("b01")
ar.lock := Bool(false)
ar.cache := UInt(0)
ar.prot := UInt(0)
ar.qos := UInt(0)
ar.region := UInt(0)
ar.user := UInt(0)
ar
}
}
object NASTIWriteDataChannel {
def apply(strb: UInt, data: UInt, last: Bool) = {
val w = Wire(new NASTIWriteDataChannel)
w.strb := strb
w.data := data
w.last := last
w.user := UInt(0)
w
}
}
object NASTIReadDataChannel {
def apply(id: UInt, data: UInt, last: Bool, resp: UInt = UInt(0)) = {
val r = Wire(new NASTIReadDataChannel)
r.id := id
r.data := data
r.last := last
r.resp := resp
r.user := UInt(0)
r
}
}
object NASTIWriteResponseChannel {
def apply(id: UInt, resp: UInt = UInt(0)) = {
val b = Wire(new NASTIWriteResponseChannel)
b.id := id
b.resp := resp
b.user := UInt(0)
b
}
}
class MemIONASTISlaveIOConverter(cacheBlockOffsetBits: Int) extends MIFModule with NASTIParameters {
val io = new Bundle {
val nasti = new NASTISlaveIO

View File

@ -121,10 +121,10 @@ class SMIIONASTIReadIOConverter(val dataWidth: Int, val addrWidth: Int)
io.smi.resp.ready := (state === s_read)
io.r.valid := (state === s_resp)
io.r.bits.resp := Bits(0)
io.r.bits.data := buffer.toBits
io.r.bits.id := id
io.r.bits.last := (nBeats === UInt(0))
io.r.bits := NASTIReadDataChannel(
id = id,
data = buffer.toBits,
last = (nBeats === UInt(0)))
when (io.ar.fire()) {
when (io.ar.bits.size < UInt(byteOffBits)) {
@ -207,8 +207,7 @@ class SMIIONASTIWriteIOConverter(val dataWidth: Int, val addrWidth: Int)
io.smi.req.bits.data := data(dataWidth - 1, 0)
io.smi.resp.ready := (state === s_ack)
io.b.valid := (state === s_resp)
io.b.bits.resp := Bits(0)
io.b.bits.id := id
io.b.bits := NASTIWriteResponseChannel(id)
val jump = PriorityMux(strb(maxWordsPerBeat - 1, 1),
(1 until maxWordsPerBeat).map(UInt(_)))