// 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 groundtest import Chisel._ import uncore.tilelink._ import uncore.constants._ import uncore.devices.NTiles import junctions._ import rocket._ import scala.util.Random import cde.{Parameters, Field} // ======= // 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 object AddressBag extends Field[List[Int]] trait HasTraceGenParams { implicit val p: Parameters val numGens = p(NTiles) val numBitsInId = log2Up(numGens) val numReqsPerGen = p(MaxGenerateRequests) val memRespTimeout = 1024 val numBitsInWord = p(WordBits) val numBytesInWord = numBitsInWord / 8 val numBitsInWordOffset = log2Up(numBytesInWord) val addressBag = p(AddressBag) val addressBagLen = addressBag.length val logAddressBagLen = log2Up(addressBagLen) val genExtraAddrs = false val logNumExtraAddrs = 1 val numExtraAddrs = 1 << logNumExtraAddrs 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