Properly connect each lane to TL node
This commit is contained in:
@@ -19,7 +19,7 @@ import "DPI-C" function void memtrace_query
|
|||||||
output bit trace_read_finished
|
output bit trace_read_finished
|
||||||
);
|
);
|
||||||
|
|
||||||
module SimMemTrace #(parameter NUM_THREADS = 4) (
|
module SimMemTrace #(parameter FILENAME = "undefined", NUM_THREADS = 4) (
|
||||||
input clock,
|
input clock,
|
||||||
input reset,
|
input reset,
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ module SimMemTrace #(parameter NUM_THREADS = 4) (
|
|||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
/* $value$plusargs("uartlog=%s", __uartlog); */
|
/* $value$plusargs("uartlog=%s", __uartlog); */
|
||||||
memtrace_init("vecadd.core1.thread4.trace");
|
memtrace_init(FILENAME);
|
||||||
end
|
end
|
||||||
|
|
||||||
// Evaluate the signals on the positive edge
|
// Evaluate the signals on the positive edge
|
||||||
|
|||||||
@@ -87,30 +87,30 @@ class MemTraceDriver(numThreads: Int = 1)(implicit p: Parameters)
|
|||||||
class TraceReq extends Bundle {
|
class TraceReq extends Bundle {
|
||||||
val valid = Bool()
|
val valid = Bool()
|
||||||
val address = UInt(64.W)
|
val address = UInt(64.W)
|
||||||
val finished = Bool()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MemTraceDriverImp(
|
class MemTraceDriverImp(
|
||||||
outer: MemTraceDriver,
|
outer: MemTraceDriver,
|
||||||
numThreads: Int
|
numThreads: Int
|
||||||
) extends LazyModuleImp(outer) {
|
) extends LazyModuleImp(outer)
|
||||||
val io = IO(new Bundle with UnitTestIO {
|
with UnitTestModule {
|
||||||
val reqs = Output(Vec(numThreads, new TraceReq))
|
|
||||||
})
|
|
||||||
val sim = Module(new SimMemTrace(filename = "vecadd.core1.thread4.trace", 4))
|
val sim = Module(new SimMemTrace(filename = "vecadd.core1.thread4.trace", 4))
|
||||||
(0 to numThreads - 1).map(i =>
|
|
||||||
// Split sim.io.trace_read.address, which is flattened across all lanes,
|
|
||||||
// back to each lane's value.
|
|
||||||
io.reqs(i).address := (sim.io.trace_read.address >> (64 * i))
|
|
||||||
)
|
|
||||||
sim.io.clock := clock
|
sim.io.clock := clock
|
||||||
sim.io.reset := reset.asBool
|
sim.io.reset := reset.asBool
|
||||||
sim.io.trace_read.ready := true.B
|
sim.io.trace_read.ready := true.B
|
||||||
|
|
||||||
|
// Split sim.io.trace_read.address, which is flattened across all lanes,
|
||||||
|
// back to each lane's value.
|
||||||
|
val reqs = Wire(Vec(numThreads, new TraceReq))
|
||||||
|
(0 to numThreads - 1).map { i =>
|
||||||
|
reqs(i).valid := (sim.io.trace_read.valid >> i)
|
||||||
|
reqs(i).address := (sim.io.trace_read.address >> (64 * i))
|
||||||
|
}
|
||||||
|
|
||||||
// Connect each sim module to its respective TL connection
|
// Connect each sim module to its respective TL connection
|
||||||
(0 to numThreads - 1).map { i =>
|
(0 to numThreads - 1).map { i =>
|
||||||
val (tl_out, edge) = outer.thread_nodes(i).out(0)
|
val (tl_out, edge) = outer.thread_nodes(i).out(0)
|
||||||
tl_out.a.valid := sim.io.trace_read.valid
|
tl_out.a.valid := reqs(i).valid
|
||||||
// TODO: placeholders, use actual value from trace
|
// TODO: placeholders, use actual value from trace
|
||||||
tl_out.a.bits := edge
|
tl_out.a.bits := edge
|
||||||
.Put(
|
.Put(
|
||||||
@@ -118,12 +118,12 @@ class MemTraceDriverImp(
|
|||||||
toAddress = 0.U,
|
toAddress = 0.U,
|
||||||
// 64 bits = 8 bytes = 2**(3) bytes
|
// 64 bits = 8 bytes = 2**(3) bytes
|
||||||
lgSize = 3.U,
|
lgSize = 3.U,
|
||||||
data = (i + 100).U
|
// data = (i + 100).U
|
||||||
|
data = reqs(i).address
|
||||||
)
|
)
|
||||||
._2
|
._2
|
||||||
// tl_out.a.bits.mask := 0xf.U
|
// tl_out.a.bits.mask := 0xf.U
|
||||||
dontTouch(tl_out.a)
|
dontTouch(tl_out.a)
|
||||||
|
|
||||||
tl_out.d.ready := true.B
|
tl_out.d.ready := true.B
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ class MemTraceDriverImp(
|
|||||||
|
|
||||||
class SimMemTrace(val filename: String, numThreads: Int)
|
class SimMemTrace(val filename: String, numThreads: Int)
|
||||||
extends BlackBox(
|
extends BlackBox(
|
||||||
Map("filename" -> filename, "numThreads" -> numThreads)
|
Map("FILENAME" -> filename, "NUM_THREADS" -> numThreads)
|
||||||
)
|
)
|
||||||
with HasBlackBoxResource {
|
with HasBlackBoxResource {
|
||||||
val io = IO(new Bundle {
|
val io = IO(new Bundle {
|
||||||
|
|||||||
Reference in New Issue
Block a user