OpenASIP
2.0
|
#include <RFTestbenchGenerator.hh>
Public Member Functions | |
RFTestbenchGenerator (HDB::RFEntry *rf) | |
virtual | ~RFTestbenchGenerator () |
virtual void | generateTestbench (std::ofstream &file) |
Public Member Functions inherited from TestbenchGenerator | |
TestbenchGenerator () | |
virtual | ~TestbenchGenerator () |
Private Member Functions | |
void | createMachineState () |
void | parseRfPorts () |
void | createTbInstantiation () |
void | createStimulus () |
void | createTbCode () |
void | createStimulusArrays (PortDataArray &inputData, PortDataArray &inputOpcode, PortDataArray &inputLoad, PortDataArray &outputData, PortDataArray &outputOpcode, PortDataArray &outputLoad) |
void | writeDataArrays (std::ostringstream &stream, PortDataArray &array, int portWidth) |
int | opcodePortWidth () const |
Private Attributes | |
HDB::RFEntry * | rfEntry_ |
HDB::RFImplementation * | rfImpl_ |
HDB::RFArchitecture * | rfArch_ |
TTAMachine::RegisterFile * | machRf_ |
MachineState * | msm_ |
TTAMachine::Machine * | machine_ |
MemorySystem * | memSystem_ |
std::vector< std::string > | inputPorts_ |
std::vector< std::string > | inputLoadPorts_ |
std::vector< std::string > | inputOpcodePorts_ |
std::vector< std::string > | outputPorts_ |
std::vector< std::string > | outputLoadPorts_ |
std::vector< std::string > | outputOpcodePorts_ |
Static Private Attributes | |
static const std::string | RF_NAME_ = "testRF" |
Additional Inherited Members | |
Protected Types inherited from TestbenchGenerator | |
typedef std::map< std::string, std::vector< uint32_t > > | PortDataArray |
Protected Member Functions inherited from TestbenchGenerator | |
virtual void | writeStimulusArray (std::ostringstream &stream, std::vector< uint32_t > &dataArray, std::string portName, int portWidth) |
void | writeTbConstants (int totalCycles, int outputIgnoreCycles) |
void | writeTestbench (std::ofstream &file, HDB::HWBlockImplementation *impl) |
std::ostringstream & | declarationStream () |
std::ostringstream & | bindingStream () |
std::ostringstream & | signalStream () |
std::ostringstream & | instantiationStream () |
std::ostringstream & | inputArrayStream () |
std::ostringstream & | opcodeArrayStream () |
std::ostringstream & | loadArrayStream () |
std::ostringstream & | outputArrayStream () |
std::ostringstream & | tbCodeStream () |
Definition at line 51 of file RFTestbenchGenerator.hh.
RFTestbenchGenerator::RFTestbenchGenerator | ( | HDB::RFEntry * | rf | ) |
Definition at line 64 of file RFTestbenchGenerator.cc.
|
virtual |
|
private |
Creates machine state model with the RF under test in it
Definition at line 106 of file RFTestbenchGenerator.cc.
References TTAMachine::Machine::addRegisterFile(), MachineStateBuilder::build(), HDB::RFArchitecture::guardLatency(), HDB::RFArchitecture::hasParameterizedSize(), HDB::RFArchitecture::hasParameterizedWidth(), machine_, machRf_, HDB::RFArchitecture::maxReads(), HDB::RFArchitecture::maxWrites(), memSystem_, msm_, TTAMachine::RegisterFile::NORMAL, RF_NAME_, rfArch_, HDB::RFArchitecture::setSize(), HDB::RFArchitecture::setWidth(), HDB::RFArchitecture::size(), HDB::RFArchitecture::width(), and HDB::RFArchitecture::zeroRegister().
Referenced by generateTestbench().
|
private |
Creates input and output data tables
Creates input and output data and control signals as well for the testbench. Testbench writes to and reads from every register. If RF has multiple write or read ports maximum number of ports is used on every cycle. Ports are written and read in round robin order. Test is pipelined in such way that writing starts on the first cycle and reading starts when all the registers can be read without stall cycles.
Definition at line 339 of file RFTestbenchGenerator.cc.
References assert, createStimulusArrays(), inputLoadPorts_, inputOpcodePorts_, inputPorts_, NullRegisterFileState::instance(), HDB::RFArchitecture::latency(), msm_, outputLoadPorts_, outputOpcodePorts_, outputPorts_, HDB::RFArchitecture::readPortCount(), MachineState::registerFileState(), RegisterFileState::registerState(), RF_NAME_, rfArch_, RegisterState::setValue(), HDB::RFArchitecture::size(), SimValue::unsignedValue(), RegisterState::value(), HDB::RFArchitecture::width(), HDB::RFArchitecture::writePortCount(), and TestbenchGenerator::writeTbConstants().
Referenced by generateTestbench().
|
private |
Writes input, output and control signal data to output streams
inputData | Array containing input ports and their values |
inputOpcode | Array containing input port opcode ports and their values |
inputLoad | Array containing input port load ports and their values |
outputData | Array containing output ports and their values |
outputOpcode | Array containing output port opcode ports and their values |
outputLoad | Array containing output port load ports and their values |
Definition at line 606 of file RFTestbenchGenerator.cc.
References TestbenchGenerator::inputArrayStream(), TestbenchGenerator::loadArrayStream(), TestbenchGenerator::opcodeArrayStream(), opcodePortWidth(), TestbenchGenerator::outputArrayStream(), rfArch_, HDB::RFArchitecture::width(), and writeDataArrays().
Referenced by createStimulus().
|
private |
Writes the testbench main process code
Definition at line 542 of file RFTestbenchGenerator.cc.
References INDENT, inputLoadPorts_, inputOpcodePorts_, inputPorts_, outputLoadPorts_, outputOpcodePorts_, outputPorts_, HDB::RFArchitecture::readPortCount(), rfArch_, TestbenchGenerator::tbCodeStream(), and HDB::RFArchitecture::writePortCount().
Referenced by generateTestbench().
|
private |
Creates component declaration, connection signals and connects RF component to testbench
Definition at line 168 of file RFTestbenchGenerator.cc.
References TestbenchGenerator::bindingStream(), HDB::HWBlockImplementation::clkPort(), TestbenchGenerator::declarationStream(), HDB::HWBlockImplementation::glockPort(), INDENT, inputLoadPorts_, inputOpcodePorts_, inputPorts_, TestbenchGenerator::instantiationStream(), HDB::HWBlockImplementation::moduleName(), opcodePortWidth(), outputLoadPorts_, outputOpcodePorts_, outputPorts_, HDB::RFArchitecture::readPortCount(), rfArch_, rfImpl_, HDB::HWBlockImplementation::rstPort(), TestbenchGenerator::signalStream(), HDB::RFArchitecture::size(), HDB::RFImplementation::sizeParameter(), HDB::RFArchitecture::width(), HDB::RFImplementation::widthParameter(), and HDB::RFArchitecture::writePortCount().
Referenced by generateTestbench().
|
virtual |
Creates the testbench and writes it to the given filestream
file | Filestream where the testbench is written |
Implements TestbenchGenerator.
Definition at line 89 of file RFTestbenchGenerator.cc.
References HDB::RFEntry::architecture(), createMachineState(), createStimulus(), createTbCode(), createTbInstantiation(), HDB::RFEntry::implementation(), parseRfPorts(), rfArch_, rfEntry_, rfImpl_, and TestbenchGenerator::writeTestbench().
|
private |
Definition at line 628 of file RFTestbenchGenerator.cc.
References MathTools::requiredBits(), rfArch_, and HDB::RFArchitecture::size().
Referenced by createStimulusArrays(), and createTbInstantiation().
|
private |
Definition at line 142 of file RFTestbenchGenerator.cc.
References assert, HDB::RFPortImplementation::direction(), HDB::IN, inputLoadPorts_, inputOpcodePorts_, inputPorts_, HDB::PortImplementation::loadPort(), HDB::PortImplementation::name(), HDB::RFPortImplementation::opcodePort(), HDB::OUT, outputLoadPorts_, outputOpcodePorts_, outputPorts_, HDB::RFImplementation::port(), HDB::RFImplementation::portCount(), and rfImpl_.
Referenced by generateTestbench().
|
private |
Write one PortDataArray to output stream
stream | Output stream |
array | Array to be written |
portWidth | Width of the output port |
Definition at line 648 of file RFTestbenchGenerator.cc.
References TestbenchGenerator::writeStimulusArray().
Referenced by createStimulusArrays().
|
private |
Definition at line 97 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
private |
Definition at line 98 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
private |
Definition at line 96 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
private |
Definition at line 93 of file RFTestbenchGenerator.hh.
Referenced by createMachineState(), and ~RFTestbenchGenerator().
|
private |
Definition at line 90 of file RFTestbenchGenerator.hh.
Referenced by createMachineState().
|
private |
Definition at line 94 of file RFTestbenchGenerator.hh.
Referenced by createMachineState(), and ~RFTestbenchGenerator().
|
private |
Definition at line 92 of file RFTestbenchGenerator.hh.
Referenced by createMachineState(), createStimulus(), and ~RFTestbenchGenerator().
|
private |
Definition at line 100 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
private |
Definition at line 101 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
private |
Definition at line 99 of file RFTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseRfPorts().
|
staticprivate |
Definition at line 103 of file RFTestbenchGenerator.hh.
Referenced by createMachineState(), and createStimulus().
|
private |
Definition at line 89 of file RFTestbenchGenerator.hh.
Referenced by createMachineState(), createStimulus(), createStimulusArrays(), createTbCode(), createTbInstantiation(), generateTestbench(), and opcodePortWidth().
|
private |
Definition at line 87 of file RFTestbenchGenerator.hh.
Referenced by generateTestbench().
|
private |
Definition at line 88 of file RFTestbenchGenerator.hh.
Referenced by createTbInstantiation(), generateTestbench(), and parseRfPorts().