|
OpenASIP 2.2
|
#include <FUTestbenchGenerator.hh>


Public Member Functions | |
| FUTestbenchGenerator (HDB::FUEntry *fu) | |
| virtual | ~FUTestbenchGenerator () |
| virtual void | generateTestbench (std::ofstream &file) |
Public Member Functions inherited from TestbenchGenerator | |
| TestbenchGenerator () | |
| virtual | ~TestbenchGenerator () |
Private Member Functions | |
| void | parseFuPorts () |
| void | createMachineState () |
| void | createTbInstantiation () |
| void | createStimulus () |
| void | createTbCode () |
| void | writeInputPortStimulus (PortDataArray &inputs, const std::string &operation, const std::string &portName, uint32_t stimulus) |
| void | readValuesFromOutPorts (PortDataArray &outputs) |
| void | createStimulusArrays (PortDataArray &inputStimulus, std::vector< uint32_t > &loadStimulus, std::vector< std::string > &operations, PortDataArray &outputStimulus) |
| bool | isShiftOrRotOp (const std::string &operation) const |
| uint32_t | truncateStimulus (uint32_t operand, int nBits) const |
Private Attributes | |
| HDB::FUEntry * | fuEntry_ |
| HDB::FUImplementation * | fuImpl_ |
| HDB::FUArchitecture * | fuArch_ |
| MachineState * | msm_ |
| std::vector< std::string > | inputPorts_ |
| std::vector< std::string > | outputPorts_ |
| std::string | opcodePort_ |
| TTAMachine::Machine * | machine_ |
| MemorySystem * | memSystem_ |
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 54 of file FUTestbenchGenerator.hh.
| FUTestbenchGenerator::FUTestbenchGenerator | ( | HDB::FUEntry * | fu | ) |
Definition at line 67 of file FUTestbenchGenerator.cc.
|
virtual |
Definition at line 72 of file FUTestbenchGenerator.cc.
References machine_, memSystem_, and msm_.
|
private |
Create a machine architecture object model with the tested FU in it
Definition at line 104 of file FUTestbenchGenerator.cc.
References TTAMachine::Machine::addFunctionUnit(), HDB::FUArchitecture::architecture(), MachineStateBuilder::build(), fuArch_, machine_, memSystem_, and msm_.
Referenced by generateTestbench().

|
private |
Creates input and output data tables
Creates input and output data tables and control signals for the testbench. Every operation is tested STIMULUS_PER_OP times and command execution is pipelined. Only fully pipelined FUs are supported.
Definition at line 268 of file FUTestbenchGenerator.cc.
References FUState::advanceClock(), HDB::FUArchitecture::architecture(), assert, createStimulusArrays(), FUState::endClock(), fuArch_, MachineState::fuState(), inputPorts_, NullFUState::instance(), TTAMachine::HWOperation::latency(), msm_, TTAMachine::HWOperation::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), readValuesFromOutPorts(), STIMULUS_PER_OP, writeInputPortStimulus(), and TestbenchGenerator::writeTbConstants().
Referenced by generateTestbench().

|
private |
Writes input, output and control signal data to output streams
| inputStimulus | Input port data |
| loadStimulus | Load port data |
| operations | Triggered operations |
| outputStimulus | Output port data |
Definition at line 499 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), fuArch_, fuImpl_, INDENT, TestbenchGenerator::inputArrayStream(), TestbenchGenerator::loadArrayStream(), HDB::PortImplementation::loadPort(), HDB::FUImplementation::maxOpcodeWidth(), HDB::PortImplementation::name(), HDB::FUImplementation::opcode(), TestbenchGenerator::opcodeArrayStream(), HDB::FUImplementation::opcodePort(), TTAMachine::FunctionUnit::operationCount(), TestbenchGenerator::outputArrayStream(), TTAMachine::FunctionUnit::port(), HDB::FUImplementation::portImplementationByArchitectureName(), Conversion::toBinary(), TTAMachine::BaseFUPort::width(), and TestbenchGenerator::writeStimulusArray().
Referenced by createStimulus().

|
private |
Writes the testbench main process code
Definition at line 371 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), fuArch_, fuImpl_, INDENT, inputPorts_, HDB::PortImplementation::name(), HDB::FUImplementation::opcodePort(), TTAMachine::FunctionUnit::operationCount(), outputPorts_, HDB::FUImplementation::portImplementationByArchitectureName(), and TestbenchGenerator::tbCodeStream().
Referenced by generateTestbench().

|
private |
Creates component declaration, connection signals and connects FU component to testbench
Definition at line 150 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), HDB::FUPortImplementation::architecturePort(), HDB::FUImplementation::architecturePort(), HDB::FUImplementation::architecturePortCount(), TestbenchGenerator::bindingStream(), HDB::HWBlockImplementation::clkPort(), ContainerTools::containsValue(), TestbenchGenerator::declarationStream(), fuArch_, fuImpl_, HDB::HWBlockImplementation::glockPort(), INDENT, inputPorts_, TestbenchGenerator::instantiationStream(), HDB::PortImplementation::loadPort(), HDB::FUImplementation::maxOpcodeWidth(), HDB::HWBlockImplementation::moduleName(), HDB::PortImplementation::name(), HDB::FUImplementation::opcodePort(), TTAMachine::FunctionUnit::port(), HDB::HWBlockImplementation::rstPort(), TestbenchGenerator::signalStream(), and TTAMachine::BaseFUPort::width().
Referenced by generateTestbench().

|
virtual |
Implements TestbenchGenerator.
Definition at line 87 of file FUTestbenchGenerator.cc.
References HDB::FUEntry::architecture(), createMachineState(), createStimulus(), createTbCode(), createTbInstantiation(), fuArch_, fuEntry_, fuImpl_, HDB::FUEntry::implementation(), parseFuPorts(), and TestbenchGenerator::writeTestbench().

|
private |
Test if operation is shift or rotation operation
| operation | Name of the operation |
Definition at line 582 of file FUTestbenchGenerator.cc.
References StringTools::stringToLower().
Referenced by writeInputPortStimulus().

|
private |
Definition at line 118 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), fuArch_, inputPorts_, NullPortState::instance(), TTAMachine::BaseFUPort::isOpcodeSetting(), msm_, TTAMachine::Component::name(), TTAMachine::Port::name(), opcodePort_, outputPorts_, TTAMachine::FunctionUnit::port(), and MachineState::portState().
Referenced by generateTestbench().

|
private |
Reads data from output ports and saves the values to an array
| outputs | PortDataArray containing the output ports |
Definition at line 476 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), fuArch_, SimValue::intValue(), msm_, TTAMachine::Component::name(), outputPorts_, MachineState::portState(), and RegisterState::value().
Referenced by createStimulus().

|
private |
Truncates shift operand to log2(32) bits
| operand | Operand to be truncated |
Definition at line 601 of file FUTestbenchGenerator.cc.
Referenced by writeInputPortStimulus().
|
private |
Writes input data to the given port and saves the input value to an array
| inputs | PortDataArray containing input ports |
| operation | Name of the triggered operation |
| portName | Name of the port where data is written to |
| stimulus | Input data |
Definition at line 434 of file FUTestbenchGenerator.cc.
References HDB::FUArchitecture::architecture(), fuArch_, isShiftOrRotOp(), msm_, TTAMachine::Component::name(), opcodePort_, MachineState::portState(), RegisterState::setValue(), StringTools::stringToLower(), truncateStimulus(), RegisterState::value(), and SimValue::width().
Referenced by createStimulus().

|
private |
Definition at line 94 of file FUTestbenchGenerator.hh.
Referenced by createMachineState(), createStimulus(), createStimulusArrays(), createTbCode(), createTbInstantiation(), generateTestbench(), parseFuPorts(), readValuesFromOutPorts(), and writeInputPortStimulus().
|
private |
Definition at line 92 of file FUTestbenchGenerator.hh.
Referenced by generateTestbench().
|
private |
Definition at line 93 of file FUTestbenchGenerator.hh.
Referenced by createStimulusArrays(), createTbCode(), createTbInstantiation(), and generateTestbench().
|
private |
Definition at line 97 of file FUTestbenchGenerator.hh.
Referenced by createStimulus(), createTbCode(), createTbInstantiation(), and parseFuPorts().
|
private |
Definition at line 101 of file FUTestbenchGenerator.hh.
Referenced by createMachineState(), and ~FUTestbenchGenerator().
|
private |
Definition at line 102 of file FUTestbenchGenerator.hh.
Referenced by createMachineState(), and ~FUTestbenchGenerator().
|
private |
Definition at line 96 of file FUTestbenchGenerator.hh.
Referenced by createMachineState(), createStimulus(), parseFuPorts(), readValuesFromOutPorts(), writeInputPortStimulus(), and ~FUTestbenchGenerator().
|
private |
Definition at line 99 of file FUTestbenchGenerator.hh.
Referenced by parseFuPorts(), and writeInputPortStimulus().
|
private |
Definition at line 98 of file FUTestbenchGenerator.hh.
Referenced by createTbCode(), parseFuPorts(), and readValuesFromOutPorts().