Skip to content
Permalink
Browse files

apply support of tagged memory

  • Loading branch information...
wsong83 committed Mar 16, 2015
1 parent 94a9118 commit cebfde6d42b7465cab79518fad91e323a1a5af41
@@ -31,6 +31,7 @@ abstract trait CacheParameters extends UsesParameters {
val rowBytes = rowBits/8
val rowOffBits = log2Up(rowBytes)
val refillCycles = params(TLDataBits)/rowBits
val tagRowBits = rowBits * (params(TagBits) + params(CoreDataBits)) / params(CoreDataBits)
}

abstract class CacheBundle extends Bundle with CacheParameters
@@ -7,15 +7,16 @@ import Chisel._

object MemoryOpConstants extends MemoryOpConstants
trait MemoryOpConstants {
val MT_SZ = 3
val MT_X = Bits("b???")
val MT_B = Bits("b000")
val MT_H = Bits("b001")
val MT_W = Bits("b010")
val MT_D = Bits("b011")
val MT_BU = Bits("b100")
val MT_HU = Bits("b101")
val MT_WU = Bits("b110")
val MT_SZ = 4
val MT_X = Bits("b????")
val MT_B = Bits("b0000")
val MT_H = Bits("b0001")
val MT_W = Bits("b0010")
val MT_D = Bits("b0011")
val MT_BU = Bits("b0100")
val MT_HU = Bits("b0101")
val MT_WU = Bits("b0110")
val MT_T = Bits("b1111") // tag

val M_SZ = 5
val M_X = Bits("b?????");
@@ -67,6 +67,9 @@ class HTIFModuleIO extends HTIFBundle {
class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
val io = new HTIFModuleIO

// tag utilities
val tagUtil = new TagUtil(params(TagBits), params(CoreDataBits))

io.host.debug_stats_pcr := io.cpu.map(_.debug_stats_pcr).reduce(_||_)
// system is 'interesting' if any tile is 'interesting'

@@ -183,10 +186,11 @@ class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
}

var mem_req_data: Bits = null
val grant_payload_without_tag = tagUtil.removeTag(io.mem.grant.bits.payload.data)
for (i <- 0 until dataBits/short_request_bits) {
val idx = UInt(i, log2Up(dataBits/short_request_bits))
when (state === state_mem_rresp && io.mem.grant.valid) {
packet_ram(idx) := io.mem.grant.bits.payload.data((i+1)*short_request_bits-1, i*short_request_bits)
packet_ram(idx) := grant_payload_without_tag((i+1)*short_request_bits-1, i*short_request_bits)
}
mem_req_data = Cat(packet_ram(idx), mem_req_data)
}
@@ -198,7 +202,7 @@ class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
io.mem.acquire.valid := acq_q.io.deq.valid
acq_q.io.deq.ready := io.mem.acquire.ready
io.mem.acquire.bits.payload := acq_q.io.deq.bits
io.mem.acquire.bits.payload.data := mem_req_data
io.mem.acquire.bits.payload.data := tagUtil.insertTag(mem_req_data)
io.mem.acquire.bits.header.src := UInt(params(LNClients)) // By convention HTIF is the client with the largest id
io.mem.acquire.bits.header.dst := UInt(0) // DNC; Overwritten outside module
io.mem.finish.valid := (state === state_mem_finish) && mem_needs_ack

0 comments on commit cebfde6

Please sign in to comment.
You can’t perform that action at this time.