// See LICENSE.Berkeley for license details. // See LICENSE.SiFive for license details. // This file was originally written by Matthew Naylor, University of // Cambridge, based on code already present in the groundtest repo. // // This software was partly developed by the University of Cambridge // Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 // ("CTSRD"), as part of the DARPA CRASH research programme. // // This software was partly developed by the University of Cambridge // Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249 // ("MRC2"), as part of the DARPA MRC research programme. // // This software was partly developed by the University of Cambridge // Computer Laboratory as part of the Rigorous Engineering of // Mainstream Systems (REMS) project, funded by EPSRC grant // EP/K008528/1. package freechips.rocketchip.groundtest import Chisel._ import freechips.rocketchip.config.{Field, Parameters} import freechips.rocketchip.rocket._ import freechips.rocketchip.tile._ import freechips.rocketchip.tilelink._ import freechips.rocketchip.util._ import scala.util.Random // ======= // Outline // ======= // Generate memory traces that result from random sequences of memory // operations. These traces can then be validated by an external // tool. A trace is a simply sequence of memory requests and // responses. // ========================== // Trace-generator parameters // ========================== // Compile-time parameters: // // * The id of the generator (there may be more than one in a // multi-core system). // // * The total number of generators present in the system. // // * The desired number of requests to be sent by each generator. // // * A bag of physical addresses, shared by all cores, from which an // address can be drawn when generating a fresh request. // // * A number of random 'extra addresses', local to each core, from // which an address can be drawn when generating a fresh request. // (This is a way to generate a wider range of addresses without having // to repeatedly recompile with a different address bag.) case class TraceGenParams( dcache: Option[DCacheParams] = Some(DCacheParams()), wordBits: Int, // p(XLen) addrBits: Int, // p(PAddrBits) addrBag: List[BigInt], // p(AddressBag) maxRequests: Int, memStart: BigInt, //p(ExtMem).base numGens: Int) extends GroundTestTileParams { def build(i: Int, p: Parameters): GroundTestTile = new TraceGenTile(i, this)(p) val hartId = 0 val trace = false val blockerCtrlAddr = None } trait HasTraceGenParams { implicit val p: Parameters val params: TraceGenParams val pAddrBits = params.addrBits val numGens = params.numGens val numReqsPerGen = params.maxRequests val memStart = params.memStart val memRespTimeout = 8192 val numBitsInWord = params.wordBits val numBytesInWord = numBitsInWord / 8 val numBitsInWordOffset = log2Up(numBytesInWord) val addressBag = params.addrBag val addressBagLen = addressBag.length val logAddressBagLen = log2Up(addressBagLen) val genExtraAddrs = false val logNumExtraAddrs = 1 val numExtraAddrs = 1 << logNumExtraAddrs val maxTags = 8 require(numBytesInWord * 8 == numBitsInWord) require((1 << logAddressBagLen) == addressBagLen) } // ============ // Trace format // ============ // Let denote a generator id; // denote an address (in hex); // denote a value that is stored at an address; // denote a unique request/response id; // and