OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
ProGe::NetlistGenerator Class Reference

#include <NetlistGenerator.hh>

Collaboration diagram for ProGe::NetlistGenerator:
Collaboration graph

Public Member Functions

 NetlistGenerator (const ProGeContext &context, ICDecoderGeneratorPlugin &plugin)
 
virtual ~NetlistGenerator ()
 
NetlistBlockgenerate (const ProGeOptions &options, int imemWidthInMAUs, TCEString entityNameStr, std::ostream &warningStream)
 
NetlistPortnetlistPort (const TTAMachine::Port &port, Direction dir=IN) const
 
NetlistBlocknetlistBlock (const TTAMachine::Unit &unit) const
 
NetlistPortloadPort (const NetlistPort &port) const
 
bool hasOpcodePort (const NetlistPort &port) const
 
NetlistPortrfOpcodePort (const NetlistPort &port) const
 
NetlistPortrfGuardPort (const NetlistBlock &rfBlock) const
 
NetlistPortfuOpcodePort (const NetlistBlock &fuBlock) const
 
NetlistPortfuGuardPort (const NetlistPort &fuPort) const
 
NetlistPortclkPort (const NetlistBlock &block) const
 
NetlistPortrstPort (const NetlistBlock &block) const
 
bool hasGlockPort (const NetlistBlock &block) const
 
NetlistPortglockPort (const NetlistBlock &block) const
 
bool hasGlockReqPort (const NetlistBlock &block) const
 
NetlistPortglockReqPort (const NetlistBlock &block) const
 
NetlistPortimmediateUnitWritePort (const TTAMachine::ImmediateUnit &iu) const
 
NetlistPortgcuReturnAddressInPort () const
 
NetlistPortgcuReturnAddressOutPort () const
 
NetlistBlockttaCore () const
 
NetlistBlockinstructionDecoder () const
 
NetlistBlockinstructionDecompressor () const
 
NetlistBlockinstructionFetch () const
 
HDB::FUEntryfuEntry (const std::string &fuName) const
 
HDB::RFEntryrfEntry (const std::string &rfName) const
 
const ProGeContextcontext () const
 
void mapGlobalLockRequestPort (const NetlistBlock &block, NetlistPort &glockReqPort)
 

Static Public Attributes

static const std::string DECODER_INSTR_WORD_PORT
 Instruction word port name in instruction decoder.
 
static const std::string DECODER_RESET_PORT = RESET_PORT_NAME
 Reset port name in instruction decoder.
 
static const std::string DECODER_CLOCK_PORT = CLOCK_PORT_NAME
 Clock port name in instruction decoder.
 
static const std::string DECODER_RA_LOAD_PORT
 RA load port name in instruction decoder.
 
static const std::string DECODER_PC_LOAD_PORT
 PC load port name in instruction decoder.
 
static const std::string DECODER_PC_OPCODE_PORT
 PC opcode port name in instruction decoder.
 
static const std::string DECODER_LOCK_REQ_OUT_PORT
 Lock request out port name in instruction decoder.
 
static const std::string DECODER_LOCK_REQ_IN_PORT
 Lock request in port name in instruction decoder.
 
static const std::string DECODER_LOCK_STATUS_PORT
 
static const std::string DECOMP_LOCK_REQ_IN_PORT
 Lock request in port name in decompressor.
 
static const std::string DECOMP_GLOCK_PORT
 Global lock out port name in decompressor.
 
static const std::string DECOMP_INSTR_WORD_PORT
 Instruction word port name in decompressor.
 
static const std::string ADDR_WIDTH
 
static const std::string FETCHBLOCK_PORT_NAME = "fetchblock"
 

Private Types

typedef std::multimap< const TTAMachine::Port *, NetlistPort * > PortCorrespondenceMap
 Multimap type to map ADF ports to NetlistPorts.
 
typedef std::map< const TTAMachine::Unit *, NetlistBlock * > UnitCorrespondenceMap
 Map type to map ADF Units to NetlistBlocks.
 
typedef std::map< const NetlistPort *, NetlistPort * > PortRelationMap
 Map type for NetlistPorts.
 
typedef std::map< const NetlistBlock *, NetlistPort * > PortPurposeMap
 Map type for NetlistPorts.
 
typedef std::map< const TTAMachine::ImmediateUnit *, NetlistPort * > IUPortMap
 Map type for port of immediate units.
 
typedef std::map< std::string, HDB::FUEntry * > FUEntryMap
 Map type for FUImplementation.
 
typedef std::map< std::string, HDB::RFEntry * > RFEntryMap
 Map type for RFImplementation.
 

Private Member Functions

void addGCUToNetlist (NetlistBlock &toplevelBlock, int imemWidthInMAUs)
 
void addFUToNetlist (const IDF::FUImplementationLocation &location, NetlistBlock &netlistBlock, std::ostream &warningStream)
 
GeneratableFUNetlistBlockaddGeneratableFUsToNetlist (const IDF::FUGenerated &fug, NetlistBlock &netlistBlock)
 
void addFUExternalPortsToNetlist (const HDB::FUImplementation &fuImplementation, NetlistBlock &coreBlock, NetlistBlock &fuBlock, const TTAMachine::FunctionUnit &adfFU)
 
void addRFToNetlist (const ProGeOptions &options, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock)
 
void addIUToNetlist (const ProGeOptions &options, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock)
 
void addBaseRFToNetlist (const ProGeOptions &options, const TTAMachine::BaseRegisterFile &regFile, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock, const std::string &blockNamePrefix)
 
void mapNetlistPort (const TTAMachine::Port &adfPort, NetlistPort &netlistPort)
 
void mapNetlistBlock (const TTAMachine::Unit &unit, NetlistBlock &netlistBlock)
 
bool netlistPortIsMapped (const TTAMachine::Port &adfPort)
 
void mapLoadPort (const NetlistPort &port, NetlistPort &loadPort)
 
void mapRFOpcodePort (const NetlistPort &port, NetlistPort &opcodePort)
 
void mapClockPort (const NetlistBlock &block, NetlistPort &clkPort)
 
void mapResetPort (const NetlistBlock &block, NetlistPort &resetPort)
 
void mapGlobalLockPort (const NetlistBlock &block, NetlistPort &glockPort)
 
void mapRFGuardPort (const NetlistBlock &block, NetlistPort &guardPort)
 
void mapFUGuardPort (const NetlistPort &dataPort, NetlistPort &guardPort)
 
void mapFUOpcodePort (const NetlistBlock &block, NetlistPort &opcodePort)
 
void mapImmediateUnitWritePort (const TTAMachine::ImmediateUnit &iu, NetlistPort &port)
 
bool isParameterizable (const std::string &paramName, const HDB::FUEntry *fuEntry) const
 
unsigned int calculateAddressWidth (TTAMachine::FunctionUnit const *fu) const
 
TCEString checkInstanceName (const TCEString &baseInstanceName, const TCEString &moduleName) const
 
bool isLSU (const TTAMachine::FunctionUnit &fu) const
 

Static Private Member Functions

static bool isLSUDataPort (const TTAMachine::FunctionUnit &adfFU, const std::string &portName)
 
static Signal inferLSUSignal (const std::string &portName)
 
static int opcodePortWidth (const HDB::FUEntry &fu, std::ostream &warningStream)
 
static int opcodePortWidth (const TTAMachine::ControlUnit &gcu)
 
static TTAMachine::FUPortfindCorrespondingPort (const TTAMachine::FunctionUnit &fuToSearch, const TTAMachine::FunctionUnit &origFU, const std::string &portName)
 
static int instructionMemoryAddressWidth (const TTAMachine::Machine &machine)
 
static int instructionMemoryWidth (const TTAMachine::Machine &machine)
 
static TTAMachine::AddressSpaceinstructionMemory (const TTAMachine::Machine &machine)
 
static Direction translateDirection (HDB::Direction direction)
 

Private Attributes

const ProGeContextcontext_
 
ICDecoderGeneratorPluginplugin_
 The generator plugin.
 
PortCorrespondenceMap portCorrespondenceMap_
 Maps the ADF ports to the netlist ports.
 
UnitCorrespondenceMap unitCorrespondenceMap_
 Maps the ADF units to the netlist blocks.
 
PortRelationMap loadPortMap_
 Maps loads ports.
 
PortRelationMap rfOpcodePortMap_
 Maps opcode ports.
 
PortPurposeMap clkPorts_
 Maps clock ports.
 
PortPurposeMap rstPorts_
 Maps reset ports.
 
PortPurposeMap rfGuardPorts_
 Maps RF guard ports.
 
PortPurposeMap glockPorts_
 Maps global lock ports.
 
PortPurposeMap glockReqPorts_
 Maps global lock request ports.
 
PortRelationMap fuGuardPortMap_
 Maps FU guard ports.
 
PortPurposeMap fuOpcodePorts_
 Maps FU opcode ports.
 
IUPortMap iuPortMap_
 Maps the created netlist ports to immediate units.
 
NetlistBlockcoreBlock_
 The TTA core block.
 
NetlistBlockinstructionDecoder_
 The instruction decoder block.
 
NetlistBlockinstructionDecompressor_
 The instruction decompressor block.
 
NetlistBlockinstructionFetch_
 The instruction fetch block.
 
FUEntryMap fuEntryMap_
 Maps FU implementations for different FU's.
 
RFEntryMap rfEntryMap_
 Maps RF implementations for different RF's.
 
NetlistPortraInPort_
 Return address in port in GCU (ifetch).
 
NetlistPortraOutPort_
 Returns address out port in GCU (ifetch).
 

Friends

class GeneratableFUNetlistBlock
 

Detailed Description

Generates a netlist of processor building blocks. [DEPRECATED]

Definition at line 84 of file NetlistGenerator.hh.

Member Typedef Documentation

◆ FUEntryMap

typedef std::map<std::string, HDB::FUEntry*> ProGe::NetlistGenerator::FUEntryMap
private

Map type for FUImplementation.

Definition at line 174 of file NetlistGenerator.hh.

◆ IUPortMap

Map type for port of immediate units.

Definition at line 172 of file NetlistGenerator.hh.

◆ PortCorrespondenceMap

Multimap type to map ADF ports to NetlistPorts.

Definition at line 162 of file NetlistGenerator.hh.

◆ PortPurposeMap

Map type for NetlistPorts.

Definition at line 169 of file NetlistGenerator.hh.

◆ PortRelationMap

Map type for NetlistPorts.

Definition at line 167 of file NetlistGenerator.hh.

◆ RFEntryMap

typedef std::map<std::string, HDB::RFEntry*> ProGe::NetlistGenerator::RFEntryMap
private

Map type for RFImplementation.

Definition at line 176 of file NetlistGenerator.hh.

◆ UnitCorrespondenceMap

Map type to map ADF Units to NetlistBlocks.

Definition at line 165 of file NetlistGenerator.hh.

Constructor & Destructor Documentation

◆ NetlistGenerator()

ProGe::NetlistGenerator::NetlistGenerator ( const ProGeContext context,
ICDecoderGeneratorPlugin plugin 
)

Definition at line 159 of file NetlistGenerator.cc.

161 : context_(context), plugin_(plugin), coreBlock_(NULL),
163 instructionFetch_(NULL), raInPort_(NULL), raOutPort_(NULL) {}
ICDecoderGeneratorPlugin & plugin_
The generator plugin.
const ProGeContext & context_
NetlistBlock * coreBlock_
The TTA core block.
NetlistPort * raOutPort_
Returns address out port in GCU (ifetch).
NetlistBlock * instructionDecompressor_
The instruction decompressor block.
NetlistBlock * instructionDecoder_
The instruction decoder block.
NetlistPort * raInPort_
Return address in port in GCU (ifetch).
const ProGeContext & context() const
NetlistBlock * instructionFetch_
The instruction fetch block.

◆ ~NetlistGenerator()

ProGe::NetlistGenerator::~NetlistGenerator ( )
virtual

The destructor.

Definition at line 168 of file NetlistGenerator.cc.

168 {
171 }
static void deleteAllValues(MapType &aMap)
FUEntryMap fuEntryMap_
Maps FU implementations for different FU's.
RFEntryMap rfEntryMap_
Maps RF implementations for different RF's.

References MapTools::deleteAllValues(), fuEntryMap_, and rfEntryMap_.

Here is the call graph for this function:

Member Function Documentation

◆ addBaseRFToNetlist()

void ProGe::NetlistGenerator::addBaseRFToNetlist ( const ProGeOptions options,
const TTAMachine::BaseRegisterFile regFile,
const IDF::RFImplementationLocation location,
NetlistBlock targetBlock,
const std::string &  blockNamePrefix 
)
private

Adds the RF or IU identified by the given RFImplementationLocation instance to the netlist.

Parameters
regFileThe corresponding RF (or IU) in ADF.
locationThe RFImplementationLocation instance.
netlistThe netlist.
blockNamePrefixPrefix to be added to the block name.
Exceptions
IOExceptionIf the HDB that contains the implementation cannot be accessed.
InvalidDataIf the RF entry in HDB does not have an implementation or architecture or if the HDB does not have the entry defined in the RFImplementationLocation instance at all.

Definition at line 1351 of file NetlistGenerator.cc.

1355 {
1356 RFEntry* entry = NULL;
1357 try {
1358 HDBManager& manager =
1359 HDBRegistry::instance().hdb(location.hdbFile());
1360 entry = manager.rfByEntryID(location.id());
1361 } catch (const KeyNotFound& e) {
1362 throw InvalidData(__FILE__, __LINE__, __func__, e.errorMessage());
1363 }
1364
1365 if (!entry->hasImplementation() || !entry->hasArchitecture()) {
1366 format text("RF entry %1% does not have an implementation or "
1367 "architecture "
1368 "defined in HDB %2%.");
1369 text % location.id() % location.hdbFile();
1370 throw InvalidData(__FILE__, __LINE__, __func__, text.str());
1371 }
1372
1373 rfEntryMap_.insert(std::make_pair(location.unitName(), entry));
1375 RFArchitecture& architecture = entry->architecture();
1376 TCEString instanceName = blockNamePrefix + location.unitName();
1377 TCEString moduleName = implementation.moduleName();
1378 instanceName = checkInstanceName(instanceName, moduleName);
1379 NetlistBlock* block = new NetlistBlock(moduleName, instanceName);
1380 targetBlock.addSubBlock(block);
1381 mapNetlistBlock(regFile, *block);
1382
1383 // Add parameters (generics) to the block.
1384 for (int i = 0; i < implementation.parameterCount(); i++) {
1385 RFImplementation::Parameter param = implementation.parameter(i);
1386
1387 // Check if parameter matches size or width parameter reference
1388 // and set/override its parameter value according to
1389 // architecture.
1390 if (param.name == implementation.sizeParameter()) {
1391 block->setParameter(implementation.sizeParameter(), "integer",
1393 } else if (param.name == implementation.widthParameter()) {
1394 block->setParameter(implementation.widthParameter(), "integer",
1395 Conversion::toString(regFile.width()));
1396 } else if (param.value == "") {
1397 format errorMsg(
1398 "Unable to resolve the value of parameter %1% of RF "
1399 "entry %2%.");
1400 errorMsg % param.name % location.id();
1401 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg.str());
1402 } else {
1403 block->setParameter(param.name, param.type, param.value);
1404 }
1405 }
1406
1407 // add ports
1408 for (int i = 0; i < implementation.portCount(); i++) {
1409 RFPortImplementation& port = implementation.port(i);
1410 NetlistPort* newInputPort = NULL;
1411 NetlistPort* newOutputPort = NULL;
1412 if (!implementation.widthParameter().empty()) {
1413 switch (port.direction()) {
1414 case HDB::BIDIR:
1415 newInputPort = new NetlistPort(port.name()+"_in",
1416 implementation.widthParameter(), regFile.width(),
1417 BIT_VECTOR, IN, *block);
1418 newOutputPort = new NetlistPort(port.name()+"_out",
1419 implementation.widthParameter(), regFile.width(),
1420 BIT_VECTOR, OUT, *block);
1421 break;
1422 case HDB::IN:
1423 newInputPort = new NetlistPort(port.name(),
1424 implementation.widthParameter(), regFile.width(),
1425 BIT_VECTOR, IN,
1426 *block);
1427 break;
1428 case HDB::OUT:
1429 newOutputPort = new NetlistPort(port.name(),
1430 implementation.widthParameter(), regFile.width(),
1431 BIT_VECTOR, OUT, *block);
1432 break;
1433 }
1434 } else {
1435 switch (port.direction()) {
1436 case HDB::BIDIR:
1437 newInputPort = new NetlistPort(port.name(),
1438 Conversion::toString(architecture.width()),
1439 BIT_VECTOR, IN, *block);
1440 newOutputPort = new NetlistPort(port.name(),
1441 Conversion::toString(architecture.width()),
1442 BIT_VECTOR, OUT, *block);
1443 break;
1444 case HDB::IN:
1445 newInputPort = new NetlistPort(port.name(),
1446 Conversion::toString(architecture.width()),
1447 BIT_VECTOR, IN, *block);
1448 break;
1449 case HDB::OUT:
1450 newOutputPort = new NetlistPort(port.name(),
1451 Conversion::toString(architecture.width()),
1452 BIT_VECTOR, OUT, *block);
1453 break;
1454 }
1455 }
1456 assert(newInputPort || newOutputPort);
1457
1458 RFPort* rfPort = NULL;
1459 // map the port if it is not input port of IU (not visible in
1460 // ADF)
1461 if (dynamic_cast<const ImmediateUnit*>(&regFile) == NULL ||
1462 port.direction() != HDB::IN) {
1463
1464 bool mapped = false;
1465 for (int i = 0; i < regFile.portCount(); i++) {
1466 rfPort = regFile.port(i);
1467 if (portCorrespondenceMap_.count(rfPort) == 0) {
1468 if ((port.direction() == HDB::IN &&
1469 rfPort->inputSocket() != NULL &&
1470 rfPort->outputSocket() == NULL) ||
1471 (port.direction() == HDB::OUT &&
1472 rfPort->outputSocket() != NULL &&
1473 rfPort->inputSocket() == NULL) ||
1474 (port.direction() == HDB::BIDIR &&
1475 rfPort->outputSocket() != NULL &&
1476 rfPort->inputSocket() != NULL)) {
1477 mapped = true;
1478 break;
1479 }
1480 }
1481 }
1482
1483 if (!mapped) {
1484 format text("Unable to map port '%1%' of RF entry '%2%' in "
1485 "HDB '%3%' "
1486 "to any port in %4% '%5%'.");
1487 text % port.name() % location.id() % location.hdbFile();
1488 if (dynamic_cast<const ImmediateUnit*>(&regFile) != NULL) {
1489 text % "immediate unit";
1490 } else {
1491 text % "register file";
1492 }
1493 text % regFile.name();
1494 throw InvalidData(__FILE__, __LINE__, __func__, text.str());
1495 }
1496 }
1497
1498 // if the given BaseRegisterFile is ImmediateUnit, keep track of
1499 // the
1500 // data ports that does not appear in ADF
1501 const ImmediateUnit* iu =
1502 dynamic_cast<const ImmediateUnit*>(&regFile);
1503 if (iu != NULL && newInputPort) {
1504 mapImmediateUnitWritePort(*iu, *newInputPort);
1505 }
1506
1507 // add load port
1508 NetlistPort* loadPort =
1509 new NetlistPort(port.loadPort(), "1", BIT, IN, *block);
1510
1511
1512 // Map data (unless it is IU's write port) and load port
1513 if (rfPort != NULL) {
1514 if (newInputPort)
1515 mapNetlistPort(*rfPort, *newInputPort);
1516 if (newOutputPort)
1517 mapNetlistPort(*rfPort, *newOutputPort);
1518 }
1519 if (newInputPort)
1520 mapLoadPort(*newInputPort, *loadPort);
1521 if (newOutputPort)
1522 mapLoadPort(*newOutputPort, *loadPort);
1523
1524 // add opcode port
1525 NetlistPort* opcodePort = NULL;
1526 if (!port.opcodePort().empty()) {
1527 opcodePort = new NetlistPort(port.opcodePort(),
1530 BIT_VECTOR, IN, *block);
1531 if (newInputPort)
1532 mapRFOpcodePort(*newInputPort, *opcodePort);
1533 if (newOutputPort)
1534 mapRFOpcodePort(*newOutputPort, *opcodePort);
1535 } else if (regFile.numberOfRegisters() == 1) {
1536 // Special case for single register RFs which do not need
1537 // opcode
1538 // port. For legacy support the opcode port is left out if
1539 // opcode
1540 // port field is empty in HDB.
1541 // Do nothing.
1542 } else {
1543 format text("RF entry '%1%' in HDB '%2%' does not have "
1544 "opcode port required for RFs of size > 1.");
1545 text % location.id() % location.hdbFile();
1546 throw InvalidData(__FILE__, __LINE__, __func__, text.str());
1547 }
1548 }
1549
1550 // add guard port
1551 if (architecture.hasGuardSupport()) {
1552 string guardPortName = implementation.guardPort();
1553 string size;
1554 if (!implementation.sizeParameter().empty()) {
1555 size = implementation.sizeParameter();
1556 } else {
1557 size = Conversion::toString(architecture.size());
1558 }
1559 NetlistPort* guardPort = new NetlistPort(guardPortName, size,
1560 regFile.numberOfRegisters(), BIT_VECTOR, OUT, *block);
1561 mapRFGuardPort(*block, *guardPort);
1562 }
1563
1564 // Add external ports
1565 string component_type("");
1566 if (dynamic_cast<const ImmediateUnit*>(&regFile) != NULL) {
1567 component_type = IU_NAME_PREFIX;
1568 } else {
1569 component_type = RF_NAME_PREFIX;
1570 }
1571 for (int i = 0; i < implementation.externalPortCount(); i++) {
1572 RFExternalPort& externalPort = implementation.externalPort(i);
1573 // if external port uses parameter, it must be added as netlist
1574 // parameter too and create new width formula for the top-level
1575 // port
1576 // by replacing parameter names with the corresponding names in
1577 // netlist.
1578 string tlPortWidth = externalPort.widthFormula();
1579 for (int i = 0; i < externalPort.parameterDependencyCount(); i++) {
1580 string hdbParamName = externalPort.parameterDependency(i);
1581 Parameter param = block->parameter(hdbParamName);
1582 string nlParamName =
1583 component_type + location.unitName() + "_" + hdbParamName;
1584 if (!targetBlock.netlist().hasParameter(nlParamName)) {
1585 targetBlock.netlist().setParameter(
1586 nlParamName, param.type(), param.value());
1587 }
1588 block->setParameter(param.name(), param.type(), nlParamName);
1589 size_t replaceStart = tlPortWidth.find(param.name(), 0);
1590 if (replaceStart == std::string::npos) {
1591 throw InvalidData(__FILE__, __LINE__, __func__,
1592 (boost::format("RF external port parameter "
1593 "dependencies do not "
1594 "seem "
1595 "to be right: Tried to find "
1596 "parameter named '%s'"
1597 " from external port width formula "
1598 "'%s' in unit "
1599 "'%s'") %
1600 param.name() % tlPortWidth % nlParamName)
1601 .str());
1602 }
1603 size_t replaceLength = param.name().length();
1604 tlPortWidth = tlPortWidth.replace(
1605 replaceStart, replaceLength, nlParamName);
1606 }
1607
1608 NetlistPort* extPort = new NetlistPort(externalPort.name(),
1609 externalPort.widthFormula(), BIT_VECTOR,
1610 translateDirection(externalPort.direction()), *block);
1611 // connect the external port to top level
1612 string tlPortName = component_type + location.unitName() + "_" +
1613 externalPort.name();
1614 NetlistPort* tlPort =
1615 new NetlistPort(tlPortName, tlPortWidth, BIT_VECTOR,
1616 translateDirection(externalPort.direction()), targetBlock);
1617 targetBlock.netlist().connect(*tlPort, *extPort);
1618 }
1619
1620 // add clock port
1621 NetlistPort* clockPort =
1622 new NetlistPort(implementation.clkPort(), "1", BIT, IN, *block);
1623 mapClockPort(*block, *clockPort);
1624 // connect clock port
1625 NetlistPort& tlClockPort = clkPort(targetBlock);
1626 targetBlock.netlist().connect(tlClockPort, *clockPort);
1627
1628 // add reset port
1629 NetlistPort* resetPort =
1630 new NetlistPort(implementation.rstPort(), "1", BIT, IN, *block);
1631 mapResetPort(*block, *resetPort);
1632 // connect reset port
1633 NetlistPort& tlResetPort = rstPort(targetBlock);
1634 targetBlock.netlist().connect(tlResetPort, *resetPort);
1635
1636 // add glock port
1637 if (implementation.glockPort() != "") {
1638 NetlistPort* glockPort = new NetlistPort(
1639 implementation.glockPort(), "1", BIT, IN, *block);
1640 mapGlobalLockPort(*block, *glockPort);
1641 }
1642 }
#define __func__
#define assert(condition)
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
const string RF_NAME_PREFIX
const string IU_NAME_PREFIX
static std::string toString(const T &source)
std::string errorMessage() const
Definition Exception.cc:123
std::string widthFormula() const
std::string parameterDependency(int index) const
int parameterDependencyCount() const
std::string name() const
Direction direction() const
RFEntry * rfByEntryID(RowID id) const
static HDBRegistry & instance()
CachedHDBManager & hdb(const std::string fileName)
std::string loadPort() const
bool hasGuardSupport() const
virtual bool hasImplementation() const
Definition RFEntry.cc:74
RFArchitecture & architecture() const
Definition RFEntry.cc:145
virtual bool hasArchitecture() const
Definition RFEntry.cc:117
RFImplementation & implementation() const
Definition RFEntry.cc:102
std::string opcodePortWidthFormula() const
static int requiredBits(unsigned long int number)
void mapLoadPort(const NetlistPort &port, NetlistPort &loadPort)
NetlistPort & rstPort(const NetlistBlock &block) const
void mapRFOpcodePort(const NetlistPort &port, NetlistPort &opcodePort)
TCEString checkInstanceName(const TCEString &baseInstanceName, const TCEString &moduleName) const
NetlistPort & loadPort(const NetlistPort &port) const
void mapGlobalLockPort(const NetlistBlock &block, NetlistPort &glockPort)
void mapNetlistPort(const TTAMachine::Port &adfPort, NetlistPort &netlistPort)
void mapNetlistBlock(const TTAMachine::Unit &unit, NetlistBlock &netlistBlock)
void mapRFGuardPort(const NetlistBlock &block, NetlistPort &guardPort)
void mapResetPort(const NetlistBlock &block, NetlistPort &resetPort)
void mapImmediateUnitWritePort(const TTAMachine::ImmediateUnit &iu, NetlistPort &port)
void mapClockPort(const NetlistBlock &block, NetlistPort &clkPort)
PortCorrespondenceMap portCorrespondenceMap_
Maps the ADF ports to the netlist ports.
NetlistPort & glockPort(const NetlistBlock &block) const
NetlistPort & clkPort(const NetlistBlock &block) const
static Direction translateDirection(HDB::Direction direction)
virtual int numberOfRegisters() const
virtual int width() const
virtual RFPort * port(const std::string &name) const
virtual TCEString name() const
virtual Socket * outputSocket() const
Definition Port.cc:281
virtual Socket * inputSocket() const
Definition Port.cc:261
virtual int portCount() const
Definition Unit.cc:135
@ OUT
Output port.
Definition HDBTypes.hh:42
@ BIDIR
Bidirectional port.
Definition HDBTypes.hh:43
@ IN
Input port.
Definition HDBTypes.hh:41
@ BIT
One bit.
Definition ProGeTypes.hh:47
@ BIT_VECTOR
Several bits.
Definition ProGeTypes.hh:48
@ OUT
Output port.
Definition ProGeTypes.hh:54
@ IN
Input port.
Definition ProGeTypes.hh:53
std::string value
Value of the parameter.
Definition HDBTypes.hh:49
std::string type
Type of the parameter.
Definition HDBTypes.hh:48
std::string name
Name of the parameter.
Definition HDBTypes.hh:47

References __func__, ProGe::NetlistBlock::addSubBlock(), HDB::RFEntry::architecture(), assert, HDB::BIDIR, ProGe::BIT, ProGe::BIT_VECTOR, checkInstanceName(), clkPort(), ProGe::Netlist::connect(), HDB::ExternalPort::direction(), HDB::RFPortImplementation::direction(), Exception::errorMessage(), glockPort(), HDB::RFEntry::hasArchitecture(), HDB::RFArchitecture::hasGuardSupport(), HDB::RFEntry::hasImplementation(), ProGe::Netlist::hasParameter(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), HDB::RFEntry::implementation(), implementation, HDB::IN, ProGe::IN, TTAMachine::Port::inputSocket(), HDB::HDBRegistry::instance(), IU_NAME_PREFIX, HDB::PortImplementation::loadPort(), loadPort(), mapClockPort(), mapGlobalLockPort(), mapImmediateUnitWritePort(), mapLoadPort(), mapNetlistBlock(), mapNetlistPort(), mapResetPort(), mapRFGuardPort(), mapRFOpcodePort(), HDB::ExternalPort::name(), HDB::Parameter::name, HDB::PortImplementation::name(), ProGe::Parameter::name(), TTAMachine::Component::name(), ProGe::NetlistBlock::netlist(), TTAMachine::BaseRegisterFile::numberOfRegisters(), HDB::RFPortImplementation::opcodePort(), HDB::RFPortImplementation::opcodePortWidthFormula(), HDB::OUT, ProGe::OUT, TTAMachine::Port::outputSocket(), ProGe::NetlistBlock::parameter(), HDB::ExternalPort::parameterDependency(), HDB::ExternalPort::parameterDependencyCount(), TTAMachine::BaseRegisterFile::port(), portCorrespondenceMap_, TTAMachine::Unit::portCount(), TCEString::replace(), MathTools::requiredBits(), RF_NAME_PREFIX, HDB::HDBManager::rfByEntryID(), rfEntryMap_, rstPort(), ProGe::Netlist::setParameter(), ProGe::NetlistBlock::setParameter(), HDB::RFArchitecture::size(), Conversion::toString(), translateDirection(), HDB::Parameter::type, ProGe::Parameter::type(), IDF::UnitImplementationLocation::unitName(), HDB::Parameter::value, ProGe::Parameter::value(), HDB::RFArchitecture::width(), TTAMachine::BaseRegisterFile::width(), and HDB::ExternalPort::widthFormula().

Referenced by addIUToNetlist(), and addRFToNetlist().

◆ addFUExternalPortsToNetlist()

void ProGe::NetlistGenerator::addFUExternalPortsToNetlist ( const HDB::FUImplementation fuImplementation,
NetlistBlock coreBlock,
NetlistBlock fuBlock,
const TTAMachine::FunctionUnit adfFU 
)
private

Adds external ports defined in HDB into netlist.

Also attempts to recognize LSU memory bus ports and assign them into corresponding NetlistGroup. Recognition is now done by seeking external ports having specific patterns (see inferLSUSignal()).

Definition at line 1189 of file NetlistGenerator.cc.

1191 {
1192
1193 // external ports recognized as LSU' data memory ports.
1194 set<std::pair<NetlistPort*, NetlistPort*>> lsuPorts;
1195 // Other unrecognized ports.
1196 set<std::pair<NetlistPort*, NetlistPort*>> otherPorts;
1197
1198 // for each external port, a port is added to top-level block too
1199 for (int i = 0; i < fuImplementation.externalPortCount(); i++) {
1200 FUExternalPort& externalPort = fuImplementation.externalPort(i);
1201 // if external port uses parameter, it must be added as netlist
1202 // parameter too and create new width formula for the top-level
1203 // port
1204 // by replacing parameter names with the corresponding names in
1205 // netlist.
1206 string tlPortWidth = externalPort.widthFormula();
1207 for (int i = 0; i < externalPort.parameterDependencyCount(); i++) {
1208 string paramName = externalPort.parameterDependency(i);
1209 Parameter param = fuBlock.parameter(paramName);
1210 string nlParamName = fuBlock.instanceName() + "_" + paramName;
1211 if (!coreBlock.netlist().hasParameter(nlParamName)) {
1212 coreBlock.netlist().setParameter(
1213 nlParamName, param.type(), param.value());
1214 }
1215 fuBlock.setParameter(param.name(), param.type(), nlParamName);
1216 size_t replaceStart = tlPortWidth.find(param.name(), 0);
1217 if (replaceStart == std::string::npos) {
1218 throw InvalidData(__FILE__, __LINE__, __func__,
1219 (boost::format("FU external port parameter "
1220 "dependencies do not "
1221 "seem "
1222 "to be right: Tried to find "
1223 "parameter named '%s'"
1224 " from external port width formula "
1225 "'%s' in unit "
1226 "'%s'") %
1227 param.name() % tlPortWidth % nlParamName)
1228 .str());
1229 }
1230 size_t replaceLength = param.name().length();
1231 tlPortWidth = tlPortWidth.replace(
1232 replaceStart, replaceLength, nlParamName);
1233 }
1234
1235 NetlistPort* extPort = new NetlistPort(externalPort.name(),
1236 externalPort.widthFormula(), BIT_VECTOR,
1237 translateDirection(externalPort.direction()), fuBlock);
1238 string tlPortName =
1239 fuBlock.instanceName() + "_" + externalPort.name();
1240 if (isLSUDataPort(adfFU, externalPort.name())) {
1241 NetlistPort* tlPort = new NetlistPort(tlPortName, tlPortWidth,
1242 BIT_VECTOR, translateDirection(externalPort.direction()),
1243 coreBlock, inferLSUSignal(externalPort.name()));
1244 lsuPorts.insert(std::make_pair(extPort, tlPort));
1245 } else {
1246 NetlistPort* tlPort = new NetlistPort(tlPortName, tlPortWidth,
1247 BIT_VECTOR, translateDirection(externalPort.direction()),
1248 coreBlock);
1249 coreBlock.netlist().connect(*extPort, *tlPort);
1250 }
1251 }
1252
1253 // Handle LSU data ports.
1254 TCEString asName("");
1255 if (adfFU.hasAddressSpace()) {
1256 asName = adfFU.addressSpace()->name();
1257 }
1258
1259 NetlistPortGroup* dmemPortGroup = nullptr;
1260 for (auto portPair : lsuPorts) {
1261 dmemPortGroup =
1262 dmemPortGroup
1263 ? dmemPortGroup
1264 : (new MemoryBusInterface(
1266 dmemPortGroup->addPort(*portPair.second);
1267 coreBlock.netlist().connect(*portPair.first, *portPair.second);
1268 }
1269 if (dmemPortGroup != nullptr) {
1270 coreBlock.addPortGroup(dmemPortGroup);
1271 dmemPortGroup = nullptr;
1272 }
1273 }
FUExternalPort & externalPort(int index) const
static bool isLSUDataPort(const TTAMachine::FunctionUnit &adfFU, const std::string &portName)
static Signal inferLSUSignal(const std::string &portName)
virtual AddressSpace * addressSpace() const
virtual bool hasAddressSpace() const
@ BITMASKED_SRAM_PORT
Signal group type for one port SRAM having read and write capability and bitmask for writing.

References __func__, ProGe::NetlistPortGroup::addPort(), ProGe::NetlistBlock::addPortGroup(), TTAMachine::FunctionUnit::addressSpace(), ProGe::BIT_VECTOR, ProGe::BITMASKED_SRAM_PORT, ProGe::Netlist::connect(), HDB::ExternalPort::direction(), HDB::FUImplementation::externalPort(), HDB::FUImplementation::externalPortCount(), TTAMachine::FunctionUnit::hasAddressSpace(), ProGe::Netlist::hasParameter(), inferLSUSignal(), ProGe::BaseNetlistBlock::instanceName(), isLSUDataPort(), HDB::ExternalPort::name(), ProGe::Parameter::name(), TTAMachine::Component::name(), ProGe::NetlistBlock::netlist(), ProGe::NetlistBlock::parameter(), HDB::ExternalPort::parameterDependency(), HDB::ExternalPort::parameterDependencyCount(), TCEString::replace(), ProGe::Netlist::setParameter(), ProGe::NetlistBlock::setParameter(), translateDirection(), ProGe::Parameter::type(), ProGe::Parameter::value(), and HDB::ExternalPort::widthFormula().

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ addFUToNetlist()

void ProGe::NetlistGenerator::addFUToNetlist ( const IDF::FUImplementationLocation location,
NetlistBlock coreBlock,
std::ostream &  warningStream 
)
private

Adds the FU identified by the given FUImplementationLocation instance to the netlist.

Parameters
locationThe FUImplementationLocation instance.
netlistThe netlist block under where FU is added.
Exceptions
IOExceptionIf the HDB that contains the implementation cannot be accessed.
InvalidDataIf the MachineImplementation instance is erroneous or if HDB erroneous.

Definition at line 974 of file NetlistGenerator.cc.

976 {
977 string hdbFile = location.hdbFile();
978 int id = location.id();
979 FUEntry* entry = NULL;
980
981 try {
982 HDBManager& manager = HDBRegistry::instance().hdb(hdbFile);
983 entry = manager.fuByEntryID(id);
984 } catch (const KeyNotFound& e) {
985 throw InvalidData(__FILE__, __LINE__, __func__, e.errorMessage());
986 }
987
988 if (!entry->hasImplementation() || !entry->hasArchitecture()) {
989 string errorMsg;
990 if (!entry->hasImplementation()) {
991 errorMsg = "FU entry " + Conversion::toString(id) +
992 " does not "
993 "have an implementation in HDB " +
994 hdbFile + ".";
995 } else {
996 errorMsg = "FU entry " + Conversion::toString(id) +
997 " does not "
998 "have architecture definition in HDB " +
999 hdbFile + ".";
1000 }
1001 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
1002 }
1003
1005 location.unitName())) {
1006 string errorMsg = "ADF does not have FU '" + location.unitName() +
1007 "' which is referred to in the IDF.";
1008 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
1009 }
1010
1011 fuEntryMap_.insert(std::make_pair(location.unitName(), entry));
1012 FUImplementation& fuImplementation = entry->implementation();
1013 FUArchitecture& architecture = entry->architecture();
1014 const FunctionUnit* adfFU =
1016 TCEString instanceName = FU_NAME_PREFIX + location.unitName();
1017 TCEString moduleName = fuImplementation.moduleName();
1018 instanceName = checkInstanceName(instanceName, moduleName);
1019 NetlistBlock* block = new NetlistBlock(moduleName, instanceName);
1020 coreBlock.addSubBlock(block);
1021 mapNetlistBlock(*adfFU, *block);
1022
1023 format architecturesDontMatch("Architectures of FU entry %1% in "
1024 "%2% and FU '%3%' don't match.");
1025
1026 // add parameters
1027 for (int i = 0; i < fuImplementation.parameterCount(); i++) {
1028 FUImplementation::Parameter parameter =
1029 fuImplementation.parameter(i);
1030 string paramName = parameter.name;
1031 string paramType = parameter.type;
1032 string paramValue = parameter.value;
1033 if (paramValue == "" || isParameterizable(paramName, entry)) {
1034 bool parameterResolved = false;
1035 // find the port which uses this parameter
1036 for (int j = 0; j < fuImplementation.architecturePortCount();
1037 j++) {
1038 FUPortImplementation& port =
1039 fuImplementation.architecturePort(j);
1040
1041 // Special case if the FU is an LSU and it has
1042 // parametrizable
1043 // address width. This sets the ADF port width according
1044 // to
1045 // address space width in ADF
1046 if (adfFU->hasAddressSpace() && isLSU(*adfFU)) {
1047 FUPort& adfPort = findCorrespondingPort(*adfFU,
1048 architecture.architecture(),
1049 port.architecturePort());
1050 // Assume address port is the triggering port
1051 if (adfPort.isTriggering() &&
1052 port.widthFormula() == paramName) {
1053 int ASWidth = calculateAddressWidth(adfFU);
1054 block->setParameter(paramName, paramType,
1055 Conversion::toString(ASWidth));
1056 // Fix the FU port width
1057 adfPort.setWidth(ASWidth);
1058 parameterResolved = true;
1059 break;
1060 }
1061 }
1062 if (port.widthFormula() == paramName) {
1063 try {
1064 FUPort& adfPort = findCorrespondingPort(*adfFU,
1065 architecture.architecture(),
1066 port.architecturePort());
1067 block->setParameter(paramName, paramType,
1068 Conversion::toString(adfPort.width()));
1069 parameterResolved = true;
1070 break;
1071 } catch (const InstanceNotFound&) {
1072 architecturesDontMatch % id % hdbFile %
1073 adfFU->name();
1074 throw InvalidData(__FILE__, __LINE__, __func__,
1075 architecturesDontMatch.str());
1076 }
1077 }
1078 }
1079
1080 if (!parameterResolved) {
1081 format errorMsg("Unable to resolve the value of "
1082 "parameter %1% of FU "
1083 "entry %2%.");
1084 errorMsg % paramName % id;
1085 throw InvalidData(
1086 __FILE__, __LINE__, __func__, errorMsg.str());
1087 }
1088
1089 } else {
1090 block->setParameter(paramName, paramType, paramValue);
1091 }
1092 }
1093
1094 // add ports to the netlist block
1095 for (int i = 0; i < fuImplementation.architecturePortCount(); i++) {
1096
1097 FUPortImplementation& port = fuImplementation.architecturePort(i);
1098
1099 // add architectural port
1100 string architecturePort = port.architecturePort();
1101
1102 FUPort* adfPort;
1103 try {
1104 adfPort = &findCorrespondingPort(
1105 *adfFU, architecture.architecture(), architecturePort);
1106 } catch (const InstanceNotFound&) {
1107 architecturesDontMatch % id % hdbFile % adfFU->name();
1108 throw InvalidData(
1109 __FILE__, __LINE__, __func__, architecturesDontMatch.str());
1110 }
1111 NetlistPort* newPort = new NetlistPort(port.name(),
1112 port.widthFormula(), adfPort->width(), BIT_VECTOR,
1114 architecture.portDirection(architecturePort)),
1115 *block);
1116 mapNetlistPort(*adfPort, *newPort);
1117
1118 // add load port
1119 if (port.loadPort() != "") {
1120 NetlistPort* loadPort =
1121 new NetlistPort(port.loadPort(), "1", 1, BIT, IN, *block);
1122 mapLoadPort(*newPort, *loadPort);
1123 }
1124
1125 // add guard port
1126 if (port.guardPort() != "") {
1127 NetlistPort* guardPort =
1128 new NetlistPort(port.guardPort(), "1", 1, BIT, OUT, *block);
1129 mapFUGuardPort(*newPort, *guardPort);
1130 }
1131 }
1132
1133 // add opcode port
1134 if (fuImplementation.opcodePort() != "") {
1135 NetlistPort* opcodePort = new NetlistPort(
1136 fuImplementation.opcodePort(),
1137 Conversion::toString(opcodePortWidth(*entry, warningStream)),
1138 opcodePortWidth(*entry, warningStream), BIT_VECTOR, IN, *block);
1139 mapFUOpcodePort(*block, *opcodePort);
1140 }
1141
1142 // add external ports
1144 fuImplementation, coreBlock, *block, *adfFU);
1145
1146 // add clock port
1147 if (fuImplementation.clkPort() != "") {
1148 NetlistPort* clkPort = new NetlistPort(
1149 fuImplementation.clkPort(), "1", 1, BIT, IN, *block);
1150 mapClockPort(*block, *clkPort);
1151 // connect clock port
1152 NetlistPort& tlClkPort = this->clkPort(coreBlock);
1153 coreBlock.netlist().connect(*clkPort, tlClkPort);
1154 }
1155
1156 // add reset port
1157 if (fuImplementation.rstPort() != "") {
1158 NetlistPort* rstPort = new NetlistPort(
1159 fuImplementation.rstPort(), "1", 1, BIT, IN, *block);
1160 mapResetPort(*block, *rstPort);
1161 // connect reset port
1162 NetlistPort& tlRstPort = this->rstPort(coreBlock);
1163 coreBlock.netlist().connect(*rstPort, tlRstPort);
1164 }
1165
1166 // add global lock port
1167 if (fuImplementation.glockPort() != "") {
1168 NetlistPort* glockPort = new NetlistPort(
1169 fuImplementation.glockPort(), "1", 1, BIT, IN, *block);
1170 mapGlobalLockPort(*block, *glockPort);
1171 }
1172
1173 // add global lock request port
1174 if (fuImplementation.glockReqPort() != "") {
1175 NetlistPort* glockReqPort = new NetlistPort(
1176 fuImplementation.glockReqPort(), "1", 1, BIT, OUT, *block);
1178 }
1179 }
const string FU_NAME_PREFIX
HDB::Direction portDirection(const std::string &port) const
TTAMachine::FunctionUnit & architecture() const
FUImplementation & implementation() const
Definition FUEntry.cc:86
virtual bool hasImplementation() const
Definition FUEntry.cc:74
FUArchitecture & architecture() const
Definition FUEntry.cc:129
virtual bool hasArchitecture() const
Definition FUEntry.cc:117
FUPortImplementation & architecturePort(int index) const
Parameter parameter(int index) const
std::string glockReqPort() const
std::string opcodePort() const
std::string architecturePort() const
FUEntry * fuByEntryID(RowID id) const
void addFUExternalPortsToNetlist(const HDB::FUImplementation &fuImplementation, NetlistBlock &coreBlock, NetlistBlock &fuBlock, const TTAMachine::FunctionUnit &adfFU)
bool isParameterizable(const std::string &paramName, const HDB::FUEntry *fuEntry) const
void mapFUOpcodePort(const NetlistBlock &block, NetlistPort &opcodePort)
unsigned int calculateAddressWidth(TTAMachine::FunctionUnit const *fu) const
bool isLSU(const TTAMachine::FunctionUnit &fu) const
NetlistPort & glockReqPort(const NetlistBlock &block) const
void mapGlobalLockRequestPort(const NetlistBlock &block, NetlistPort &glockReqPort)
void mapFUGuardPort(const NetlistPort &dataPort, NetlistPort &guardPort)
static int opcodePortWidth(const HDB::FUEntry &fu, std::ostream &warningStream)
static TTAMachine::FUPort & findCorrespondingPort(const TTAMachine::FunctionUnit &fuToSearch, const TTAMachine::FunctionUnit &origFU, const std::string &portName)
const TTAMachine::Machine & adf() const
virtual int width() const
void setWidth(int width)
virtual bool isTriggering() const
Definition FUPort.cc:182
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380

References __func__, addFUExternalPortsToNetlist(), ProGe::NetlistBlock::addSubBlock(), ProGe::ProGeContext::adf(), HDB::FUArchitecture::architecture(), HDB::FUEntry::architecture(), HDB::FUPortImplementation::architecturePort(), HDB::FUImplementation::architecturePort(), HDB::FUImplementation::architecturePortCount(), ProGe::BIT, ProGe::BIT_VECTOR, calculateAddressWidth(), checkInstanceName(), HDB::HWBlockImplementation::clkPort(), clkPort(), ProGe::Netlist::connect(), context_, Exception::errorMessage(), findCorrespondingPort(), FU_NAME_PREFIX, HDB::HDBManager::fuByEntryID(), fuEntryMap_, TTAMachine::Machine::functionUnitNavigator(), HDB::HWBlockImplementation::glockPort(), glockPort(), HDB::FUImplementation::glockReqPort(), glockReqPort(), HDB::FUPortImplementation::guardPort(), TTAMachine::FunctionUnit::hasAddressSpace(), HDB::FUEntry::hasArchitecture(), HDB::FUEntry::hasImplementation(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), HDB::FUEntry::implementation(), ProGe::IN, HDB::HDBRegistry::instance(), isLSU(), isParameterizable(), TTAMachine::FUPort::isTriggering(), TTAMachine::Machine::Navigator< ComponentType >::item(), HDB::PortImplementation::loadPort(), loadPort(), mapClockPort(), mapFUGuardPort(), mapFUOpcodePort(), mapGlobalLockPort(), mapGlobalLockRequestPort(), mapLoadPort(), mapNetlistBlock(), mapNetlistPort(), mapResetPort(), HDB::HWBlockImplementation::moduleName(), HDB::Parameter::name, HDB::PortImplementation::name(), TTAMachine::Component::name(), ProGe::NetlistBlock::netlist(), HDB::FUImplementation::opcodePort(), opcodePortWidth(), ProGe::OUT, HDB::FUImplementation::parameter(), HDB::FUImplementation::parameterCount(), HDB::FUArchitecture::portDirection(), HDB::HWBlockImplementation::rstPort(), rstPort(), ProGe::NetlistBlock::setParameter(), TTAMachine::BaseFUPort::setWidth(), Conversion::toString(), translateDirection(), HDB::Parameter::type, IDF::UnitImplementationLocation::unitName(), HDB::Parameter::value, TTAMachine::BaseFUPort::width(), and HDB::FUPortImplementation::widthFormula().

Referenced by generate().

◆ addGCUToNetlist()

void ProGe::NetlistGenerator::addGCUToNetlist ( NetlistBlock toplevelBlock,
int  imemWidthInMAUs 
)
private

Adds the global control unit to the netlist as sub-block of the given top-level block.

Parameters
toplevelBlockThe top-level block of the netlist.
imemWidthInMAUsWidth of the instruction memory in MAUs.

Definition at line 692 of file NetlistGenerator.cc.

693 {
694 if (imemWidthInMAUs != 4 && context_.adf().isRISCVMachine()) {
695 throw InvalidData(__FILE__, __LINE__, __func__,
696 "Imem width fixed to 4 MAUs for RISC-V machines");
697 } else if (imemWidthInMAUs != 1 && !context_.adf().isRISCVMachine()) {
698 throw InvalidData(__FILE__, __LINE__, __func__,
699 "Imem width is currently fixed to 1 MAU");
700 }
701 Netlist& netlist = toplevelBlock.netlist();
702
703 Parameter coreIdParam("core_id", "integer", "0", "0");
704 toplevelBlock.addParameter(coreIdParam);
705
706 NetlistPort* tlClkPort =
707 new InBitPort(CLOCK_PORT_NAME, toplevelBlock, SignalType::CLOCK);
708 NetlistPort* tlRstPort = new InBitPort(RESET_PORT_NAME, toplevelBlock,
710
711 // Instruction fetch bus //
712 NetlistPort* tlBusyPort = new InBitPort(BUSY_PORT_NAME,
714 NetlistPort* tlReadEnablePort = new OutBitPort(READ_ENABLE_PORT_NAME,
716 NetlistPort* tlAddressPort = new OutPort(ADDRESS_PORT_NAME,
718 NetlistPort* tlDataPort = new InPort(DATA_PORT_NAME, IMEMWIDTHFORMULA,
720 NetlistPortGroup* toplevelInstructionLine =
721 new NetlistPortGroup(SignalGroupType::INSTRUCTION_LINE, tlBusyPort,
722 tlReadEnablePort, tlAddressPort, tlDataPort);
723 toplevelBlock.addPortGroup(toplevelInstructionLine);
724
725 NetlistPort* tlLockStatusPort = new NetlistPort(LOCK_STATUS_PORT_NAME,
726 "1", BIT, OUT, toplevelBlock, SignalType::CORE_HALT_STATUS);
727
728 mapClockPort(toplevelBlock, *tlClkPort);
729 mapResetPort(toplevelBlock, *tlRstPort);
730
731 // add ifetch block
733 instructionFetch_ = new NetlistBlock(
734 context_.coreEntityName() + "_" + IFETCH_BLOCK_NAME, "inst_fetch");
735 toplevelBlock.addSubBlock(instructionFetch_);
736 NetlistPort* ifetchClkPort =
737 new NetlistPort(CLOCK_PORT_NAME, "1", BIT, IN, *instructionFetch_);
738 NetlistPort* ifetchRstPort =
739 new NetlistPort(RESET_PORT_NAME, "1", BIT, IN, *instructionFetch_);
740 NetlistPort* ifetchRAOutPort = new NetlistPort(RA_OUT_PORT_NAME,
742 raOutPort_ = ifetchRAOutPort;
743 NetlistPort* ifetchRAInPort = new NetlistPort(
745 raInPort_ = ifetchRAInPort;
746
747 NetlistPort* ifetchBusyPort = new InBitPort(BUSY_PORT_NAME,
749 NetlistPort* ifetchReadEnablePort =
750 new OutBitPort(READ_ENABLE_PORT_NAME,
752 NetlistPort* ifetchAddressPort = new OutPort(ADDRESS_PORT_NAME,
754 NetlistPort* ifetchDataPort = new InPort(DATA_PORT_NAME,
756 NetlistPortGroup* ifetchInstructionLine = new NetlistPortGroup(
757 SignalGroupType::INSTRUCTION_LINE, ifetchBusyPort,
758 ifetchReadEnablePort, ifetchAddressPort, ifetchDataPort);
759 instructionFetch_->addPortGroup(ifetchInstructionLine);
760
761 NetlistPort* ifetchPCInPort = new NetlistPort(
763 NetlistPort* ifetchPCLoadPort = new NetlistPort(
765 NetlistPort* ifetchRALoadPort = new NetlistPort(
767 NetlistPort* ifetchPCOpcodePort = new NetlistPort(PC_OPCODE_PORT_NAME,
770 NetlistPort* ifetchFetchPort =
771 new NetlistPort(FETCH_PORT_NAME, "1", BIT, IN, *instructionFetch_);
772 NetlistPort* ifetchGlockPort = new NetlistPort(
774 NetlistPort* ifetchFetchBlockPort =
777
778 // connect ifetch to toplevel
779 netlist.connect(*tlClkPort, *ifetchClkPort);
780 netlist.connect(*tlRstPort, *ifetchRstPort);
781
782 netlist.connect(*toplevelInstructionLine, *ifetchInstructionLine);
783
784 if (gcu->operationPortCount() > 0) {
785 mapNetlistPort(*gcu->triggerPort(), *ifetchPCInPort);
786 }
787
788 // Add non-standard GCU ports to the block.
789 for (int i = 0; i < gcu->portCount(); i++) {
790 Port* port = gcu->port(i);
791 if (gcu->returnAddressPort()->name() == port->name()) {
792 continue;
793 }
794 if (!netlistPortIsMapped(*port)) {
795 Direction dir;
796 if (port->isInput()) {
797 dir = IN;
798 } else if (port->isOutput()) {
799 dir = OUT;
800 } else {
801 assert(false && "Unconneced ADF port.");
802 }
803 // Data port
804 NetlistPort* dataPort = new NetlistPort(port->name() + "_data",
807 mapNetlistPort(*port, *dataPort);
808
809 // Load port if port is input
810 if (port->isInput()) {
811 NetlistPort* loadPort =
812 new NetlistPort(port->name() + "_load", "1", BIT, dir,
814 mapLoadPort(*dataPort, *loadPort);
815 }
816 }
817 }
818
819 // add decompressor block
820 NetlistBlock* decompressorBlock = new NetlistBlock(
822 "decomp");
823 instructionDecompressor_ = decompressorBlock;
824 toplevelBlock.addSubBlock(decompressorBlock);
825 NetlistPort* decFetchPort =
826 new NetlistPort(FETCH_PORT_NAME, "1", BIT, OUT, *decompressorBlock);
827 NetlistPort* decLockPort =
828 new NetlistPort(LOCK_PORT_NAME, "1", BIT, IN, *decompressorBlock);
829 NetlistPort* decFetchBlockPort = new NetlistPort(FETCHBLOCK_PORT_NAME,
830 IMEMWIDTHFORMULA, BIT_VECTOR, IN, *decompressorBlock);
831 NetlistPort* decClkPort =
832 new NetlistPort(CLOCK_PORT_NAME, "1", BIT, IN, *decompressorBlock);
833 NetlistPort* decRstPort =
834 new NetlistPort(RESET_PORT_NAME, "1", BIT, IN, *decompressorBlock);
835 NetlistPort* decIWordPort = new NetlistPort(INSTRUCTIONWORD_PORT_NAME,
836 INSTRUCTIONWIDTH, BIT_VECTOR, OUT, *decompressorBlock);
837 NetlistPort* decGlockPort = new NetlistPort(
838 GLOBAL_LOCK_PORT_NAME, "1", BIT, OUT, *decompressorBlock);
839 NetlistPort* decLockReqPort = new NetlistPort(
840 LOCK_REQUEST_PORT_NAME, "1", BIT, IN, *decompressorBlock);
841
842 // connect ifetch to decompressor
843 netlist.connect(*ifetchFetchPort, *decFetchPort);
844 netlist.connect(*ifetchGlockPort, *decLockPort);
845 netlist.connect(*ifetchFetchBlockPort, *decFetchBlockPort);
846
847 // connect toplevel to decompressor
848 netlist.connect(*tlClkPort, *decClkPort);
849 netlist.connect(*tlRstPort, *decRstPort);
850
851 // add decoder block
852 NetlistBlock* decoderBlock = new NetlistBlock(
854 "inst_decoder");
855 toplevelBlock.addSubBlock(decoderBlock);
856 instructionDecoder_ = decoderBlock;
857 NetlistPort* decodIWordPort = new NetlistPort(DECODER_INSTR_WORD_PORT,
858 INSTRUCTIONWIDTH, BIT_VECTOR, IN, *decoderBlock);
859 NetlistPort* decodPCLoadPort =
860 new NetlistPort(DECODER_PC_LOAD_PORT, "1", BIT, OUT, *decoderBlock);
861 NetlistPort* decodRALoadPort =
862 new NetlistPort(DECODER_RA_LOAD_PORT, "1", BIT, OUT, *decoderBlock);
863 NetlistPort* decodPCOpcodePort = new NetlistPort(DECODER_PC_OPCODE_PORT,
865 BIT_VECTOR, OUT, *decoderBlock);
866 NetlistPort* decodLockPort = new NetlistPort(
867 DECODER_LOCK_REQ_IN_PORT, "1", BIT, IN, *decoderBlock);
868 NetlistPort* decodLockReqPort = new NetlistPort(
869 DECODER_LOCK_REQ_OUT_PORT, "1", BIT, OUT, *decoderBlock);
870 NetlistPort* decodClkPort =
871 new NetlistPort(DECODER_CLOCK_PORT, "1", BIT, IN, *decoderBlock);
872 NetlistPort* decodRstPort =
873 new NetlistPort(DECODER_RESET_PORT, "1", BIT, IN, *decoderBlock);
874 NetlistPort* decodLockedPort = new NetlistPort(
875 DECODER_LOCK_STATUS_PORT, "1", BIT, OUT, *decoderBlock);
876
877 // connect decoder to decompressor
878 netlist.connect(*decIWordPort, *decodIWordPort);
879 netlist.connect(*decGlockPort, *decodLockPort);
880 netlist.connect(*decLockReqPort, *decodLockReqPort);
881
882 // connect decoder to top-level
883 netlist.connect(*decodClkPort, *tlClkPort);
884 netlist.connect(*decodRstPort, *tlRstPort);
885
886 // connect decoder to ifetch
887 netlist.connect(*decodPCLoadPort, *ifetchPCLoadPort);
888 netlist.connect(*decodRALoadPort, *ifetchRALoadPort);
889 netlist.connect(*decodPCOpcodePort, *ifetchPCOpcodePort);
890
891 // connect lock status signal port
892 netlist.connect(*tlLockStatusPort, *decodLockedPort);
893
894 Netlist::connectClocks(toplevelBlock);
895 Netlist::connectResets(toplevelBlock);
896 }
const string IMEMADDRWIDTH
const string RA_OUT_PORT_NAME
const string RA_IN_PORT_NAME
const string FETCH_PORT_NAME
const string INSTRUCTIONWIDTH
const string DATA_PORT_NAME
const string GLOBAL_LOCK_PORT_NAME
const string PC_IN_PORT_NAME
const string LOCK_PORT_NAME
const string DECODER_BLOCK_NAME
const string INSTRUCTIONWORD_PORT_NAME
const string PC_OPCODE_PORT_NAME
const string PC_LOAD_PORT_NAME
const string IMEMWIDTHFORMULA
const string LOCK_REQUEST_PORT_NAME
const string ADDRESS_PORT_NAME
const string IFETCH_BLOCK_NAME
const string CLOCK_PORT_NAME
const string RESET_PORT_NAME
const string DECOMPRESSOR_BLOCK_NAME
const string LOCK_STATUS_PORT_NAME
const string RA_LOAD_PORT_NAME
const string READ_ENABLE_PORT_NAME
const string BUSY_PORT_NAME
void addSubBlock(BaseNetlistBlock *subBlock, const std::string &instanceName="")
void addPortGroup(NetlistPortGroup *portGroup)
static const std::string DECODER_LOCK_REQ_OUT_PORT
Lock request out port name in instruction decoder.
static const std::string DECODER_PC_LOAD_PORT
PC load port name in instruction decoder.
static const std::string FETCHBLOCK_PORT_NAME
static const std::string DECODER_PC_OPCODE_PORT
PC opcode port name in instruction decoder.
static const std::string DECODER_CLOCK_PORT
Clock port name in instruction decoder.
static const std::string DECODER_INSTR_WORD_PORT
Instruction word port name in instruction decoder.
static const std::string DECODER_RA_LOAD_PORT
RA load port name in instruction decoder.
static const std::string DECODER_LOCK_REQ_IN_PORT
Lock request in port name in instruction decoder.
bool netlistPortIsMapped(const TTAMachine::Port &adfPort)
static const std::string DECODER_LOCK_STATUS_PORT
static const std::string DECODER_RESET_PORT
Reset port name in instruction decoder.
static void connectResets(NetlistBlock &block)
Definition Netlist.cc:511
static void connectClocks(NetlistBlock &block)
Definition Netlist.cc:483
const std::string & coreEntityName() const
SpecialRegisterPort * returnAddressPort() const
virtual BaseFUPort * triggerPort() const
virtual int operationPortCount() const
virtual BaseFUPort * port(const std::string &name) const
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
bool isRISCVMachine() const
Definition Machine.cc:1057
virtual bool isInput() const
Definition Port.cc:298
virtual bool isOutput() const
Definition Port.cc:308
virtual int width() const =0
virtual std::string name() const
Definition Port.cc:141
Direction
Direction of port.
Definition HDBTypes.hh:40
@ INSTRUCTION_LINE
Signal group type for serial TTA instruction bus.
@ READ_REQUEST
Signal to make read request.
@ ADDRESS
Signal holds address.
@ READ_REQUEST_READY
Signal to tell that requested data can be read.
@ FETCHBLOCK
Signal is TTA instruction block block containing (compressed) instruction.
@ RESET
Reset signal.
@ CLOCK
Clock signal.
@ CORE_HALT_STATUS
Signal that tell if core is halted.

References __func__, ProGe::NetlistBlock::addParameter(), ProGe::NetlistBlock::addPortGroup(), ProGe::ADDRESS, ADDRESS_PORT_NAME, ProGe::NetlistBlock::addSubBlock(), ProGe::ProGeContext::adf(), assert, ProGe::BIT, ProGe::BIT_VECTOR, BUSY_PORT_NAME, ProGe::CLOCK, CLOCK_PORT_NAME, ProGe::Netlist::connect(), ProGe::Netlist::connectClocks(), ProGe::Netlist::connectResets(), context_, TTAMachine::Machine::controlUnit(), ProGe::CORE_HALT_STATUS, ProGe::ProGeContext::coreEntityName(), DATA_PORT_NAME, DECODER_BLOCK_NAME, DECODER_CLOCK_PORT, DECODER_INSTR_WORD_PORT, DECODER_LOCK_REQ_IN_PORT, DECODER_LOCK_REQ_OUT_PORT, DECODER_LOCK_STATUS_PORT, DECODER_PC_LOAD_PORT, DECODER_PC_OPCODE_PORT, DECODER_RA_LOAD_PORT, DECODER_RESET_PORT, DECOMPRESSOR_BLOCK_NAME, FETCH_PORT_NAME, ProGe::FETCHBLOCK, FETCHBLOCK_PORT_NAME, GLOBAL_LOCK_PORT_NAME, IFETCH_BLOCK_NAME, IMEMADDRWIDTH, IMEMWIDTHFORMULA, ProGe::IN, ProGe::INSTRUCTION_LINE, instructionDecoder_, instructionDecompressor_, instructionFetch_, INSTRUCTIONWIDTH, INSTRUCTIONWORD_PORT_NAME, TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), TTAMachine::Machine::isRISCVMachine(), loadPort(), LOCK_PORT_NAME, LOCK_REQUEST_PORT_NAME, LOCK_STATUS_PORT_NAME, ProGe::LOW, mapClockPort(), mapLoadPort(), mapNetlistPort(), mapResetPort(), TTAMachine::Port::name(), ProGe::NetlistBlock::netlist(), netlistPortIsMapped(), opcodePortWidth(), TTAMachine::FunctionUnit::operationPortCount(), ProGe::OUT, PC_IN_PORT_NAME, PC_LOAD_PORT_NAME, PC_OPCODE_PORT_NAME, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), RA_IN_PORT_NAME, RA_LOAD_PORT_NAME, RA_OUT_PORT_NAME, raInPort_, raOutPort_, READ_ENABLE_PORT_NAME, ProGe::READ_REQUEST, ProGe::READ_REQUEST_READY, ProGe::RESET, RESET_PORT_NAME, TTAMachine::ControlUnit::returnAddressPort(), Conversion::toString(), TTAMachine::FunctionUnit::triggerPort(), and TTAMachine::Port::width().

Referenced by generate().

Here is the call graph for this function:

◆ addGeneratableFUsToNetlist()

GeneratableFUNetlistBlock * ProGe::NetlistGenerator::addGeneratableFUsToNetlist ( const IDF::FUGenerated fug,
NetlistBlock netlistBlock 
)
private

Definition at line 898 of file NetlistGenerator.cc.

899 {
900
901 std::string fuName = "fu_" + fug.name();
902 std::transform(fuName.begin(), fuName.end(), fuName.begin(), ::tolower);
903
905 fuName, fuName + "_generated", *this);
906 coreBlock.addSubBlock(block);
907
908 FunctionUnit* fu =
910
911 mapNetlistBlock(*fu, *block);
912
913 // add clock port
914 NetlistPort* clkPort = new NetlistPort("clk", "1", 1, BIT, IN, *block);
915 mapClockPort(*block, *clkPort);
916 // connect clock port
917 NetlistPort& tlClkPort = this->clkPort(coreBlock);
918 coreBlock.netlist().connect(*clkPort, tlClkPort);
919
920 // add reset port
921 NetlistPort* rstPort = new NetlistPort("rstx", "1", 1, BIT, IN, *block);
922 mapResetPort(*block, *rstPort);
923 // connect reset port
924 NetlistPort& tlRstPort = this->rstPort(coreBlock);
925 coreBlock.netlist().connect(*rstPort, tlRstPort);
926
927 // add global lock port
928 NetlistPort* glockPort =
929 new NetlistPort("glock_in", "1", 1, BIT, IN, *block);
931
932 // opcode port.
933 int opcodeWidth = static_cast<int>(std::ceil(
934 std::log2(fu->operationCount())));
935 if (fu->operationCount() > 1) {
936 NetlistPort* opcodePort = new NetlistPort("operation_in",
937 std::to_string(opcodeWidth), BIT_VECTOR, IN, *block);
938 mapFUOpcodePort(*block, *opcodePort);
939 }
940
941 // global lock request port
942 NetlistPort* glockReqPort = new NetlistPort(
943 "glockreq_out", "1", 1, BIT, OUT, *block);
945
946 // operand ports.
947 for (int i = 0; i < fu->portCount(); ++i) {
948 FUPort* adfPort = dynamic_cast<FUPort*>(fu->port(i));
949
950 if (adfPort->isInput()) {
951 block->addInOperand(adfPort, i);
952 } else {
953 block->addOutOperand(adfPort);
954 }
955 }
956
957 return block;
958 }
std::string name() const
friend class GeneratableFUNetlistBlock
virtual int operationCount() const

References ProGe::GeneratableFUNetlistBlock::addInOperand(), ProGe::GeneratableFUNetlistBlock::addOutOperand(), ProGe::NetlistBlock::addSubBlock(), ProGe::ProGeContext::adf(), ProGe::BIT, ProGe::BIT_VECTOR, clkPort(), ProGe::Netlist::connect(), context_, TTAMachine::Machine::functionUnitNavigator(), GeneratableFUNetlistBlock, glockPort(), glockReqPort(), ProGe::IN, TTAMachine::Port::isInput(), TTAMachine::Machine::Navigator< ComponentType >::item(), mapClockPort(), mapFUOpcodePort(), mapGlobalLockPort(), mapGlobalLockRequestPort(), mapNetlistBlock(), mapResetPort(), IDF::FUGenerated::name(), ProGe::NetlistBlock::netlist(), TTAMachine::FunctionUnit::operationCount(), ProGe::OUT, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), and rstPort().

Referenced by generate().

Here is the call graph for this function:

◆ addIUToNetlist()

void ProGe::NetlistGenerator::addIUToNetlist ( const ProGeOptions options,
const IDF::RFImplementationLocation location,
NetlistBlock netlistBlock 
)
private

Adds the IU identified by the given RFImplementationLocation instance to the netlist.

Parameters
locationThe RFImplementationLocation instance.
netlistThe netlist.
Exceptions
IOExceptionIf the HDB that contains the implementation cannot be accessed.
InvalidDataIf the MachineImplementation instance or HDB is erroneous.

Definition at line 1318 of file NetlistGenerator.cc.

1320 {
1322 location.unitName())) {
1323 string errorMsg = "ADF does not contain immediate unit '" +
1324 location.unitName() + "' referred to in IDF.";
1325 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
1326 }
1327 ImmediateUnit* iu =
1329 addBaseRFToNetlist(options, *iu, location, netlistBlock,
1331 }
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
NetlistBlock & netlistBlock(const TTAMachine::Unit &unit) const
void addBaseRFToNetlist(const ProGeOptions &options, const TTAMachine::BaseRegisterFile &regFile, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock, const std::string &blockNamePrefix)
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416

References __func__, addBaseRFToNetlist(), ProGe::ProGeContext::adf(), context_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), IU_NAME_PREFIX, netlistBlock(), options, and IDF::UnitImplementationLocation::unitName().

Referenced by generate().

Here is the call graph for this function:

◆ addRFToNetlist()

void ProGe::NetlistGenerator::addRFToNetlist ( const ProGeOptions options,
const IDF::RFImplementationLocation location,
NetlistBlock netlistBlock 
)
private

Adds the RF identified by the given RFImplementationLocation instance to the netlist.

Parameters
locationThe RFImplementationLocation instance.
netlistThe netlist.
Exceptions
IOExceptionIf the HDB that contains the implementation cannot be accessed.
InvalidDataIf the MachineImplementation instance or HDB is erroneous.

Definition at line 1289 of file NetlistGenerator.cc.

1291 {
1293 location.unitName())) {
1294 string errorMsg = "ADF does not contain register file '" +
1295 location.unitName() + "' referred to in IDF.";
1296 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
1297 }
1298 RegisterFile* rf =
1300 addBaseRFToNetlist(options, *rf, location, netlistBlock,
1302 }
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450

References __func__, addBaseRFToNetlist(), ProGe::ProGeContext::adf(), context_, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::Navigator< ComponentType >::item(), netlistBlock(), options, TTAMachine::Machine::registerFileNavigator(), RF_NAME_PREFIX, and IDF::UnitImplementationLocation::unitName().

Referenced by generate().

Here is the call graph for this function:

◆ calculateAddressWidth()

unsigned int ProGe::NetlistGenerator::calculateAddressWidth ( TTAMachine::FunctionUnit const *  fu) const
private

Calculates the address width of an address space in FU

Exceptions
Invaliddata If the FU doesn't have an address space or the address space is invalid

Definition at line 1856 of file NetlistGenerator.cc.

1857 {
1858 if (fu->hasAddressSpace() && fu->addressSpace() != NULL) {
1859 AddressSpace* AS = fu->addressSpace();
1860 unsigned int highestAddr = AS->end();
1861 unsigned int lowestAddr = AS->start();
1862 if (highestAddr == 0 || lowestAddr >= highestAddr) {
1863 string errorMessage = "Invalid address space";
1864 throw InvalidData(
1865 __FILE__, __LINE__, __func__, errorMessage.c_str());
1866 }
1867 return static_cast<unsigned int>(ceil(log(highestAddr) / log(2)));
1868 } else {
1869 string errorMessage = "Tried to resolve address space width "
1870 "from FU '" +
1871 fu->name() +
1872 "' that doesn't have address space";
1873 throw InvalidData(
1874 __FILE__, __LINE__, __func__, errorMessage.c_str());
1875 }
1876 // never reached
1877 return 0;
1878 }
virtual ULongWord end() const
virtual ULongWord start() const

References __func__, TTAMachine::FunctionUnit::addressSpace(), TTAMachine::AddressSpace::end(), TTAMachine::FunctionUnit::hasAddressSpace(), TTAMachine::Component::name(), and TTAMachine::AddressSpace::start().

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ checkInstanceName()

TCEString ProGe::NetlistGenerator::checkInstanceName ( const TCEString baseInstanceName,
const TCEString moduleName 
) const
private

Return fixed instance name if instance name is equal to module name.

Parameters
baseInstanceNameDefault name for a component instance
moduleNameName for the component module defined in HDB
Returns
Instance name differing from the module name.

Definition at line 2080 of file NetlistGenerator.cc.

2081 {
2082
2083 TCEString newInstanceName;
2084 if (baseInstanceName.lower() == moduleName.lower()) {
2085 newInstanceName = baseInstanceName + INSTANCE_SUFFIX;
2086 } else {
2087 newInstanceName = baseInstanceName;
2088 }
2089 return newInstanceName;
2090 }
const TCEString INSTANCE_SUFFIX
TCEString lower() const
Definition TCEString.cc:78

References INSTANCE_SUFFIX, and TCEString::lower().

Referenced by addBaseRFToNetlist(), and addFUToNetlist().

Here is the call graph for this function:

◆ clkPort()

NetlistPort & ProGe::NetlistGenerator::clkPort ( const NetlistBlock block) const

Returns the clock port of the given block in the netlist.

Parameters
blockThe block in the netlist.
Returns
The clock port of the given block.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 425 of file NetlistGenerator.cc.

425 {
426 try {
428 } catch (const Exception&) {
429 throw InstanceNotFound(__FILE__, __LINE__, __func__,
430 (boost::format("Cannot find clock port in netlist block "
431 "instance name: "
432 "'%s', module name: '%s'") %
433 block.instanceName() % block.moduleName())
434 .str());
435 }
436 }
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
PortPurposeMap clkPorts_
Maps clock ports.

References __func__, clkPorts_, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), and ProGe::BaseNetlistBlock::moduleName().

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGeneratableFUsToNetlist(), DefaultICDecoderGenerator::addRV32MicroCode(), DefaultICDecoderGenerator::generateDebuggerCode(), and mapClockPort().

Here is the call graph for this function:

◆ context()

const ProGeContext & ProGe::NetlistGenerator::context ( ) const
inline

Definition at line 125 of file NetlistGenerator.hh.

125{ return context_; }

References context_.

Referenced by DefaultICDecoderGenerator::generate().

◆ findCorrespondingPort()

TTAMachine::FUPort & ProGe::NetlistGenerator::findCorrespondingPort ( const TTAMachine::FunctionUnit fuToSearch,
const TTAMachine::FunctionUnit origFU,
const std::string &  portName 
)
staticprivate

Finds the corresponding ports from the given function units.

Parameters
fuToSearchThe FU that is searched for the corresponding port.
origFUThe original FU.
portNameName of the port in the original FU.
Returns
The corresponding port in fuToSearch FU.
Exceptions
InstanceNotFoundIf there is no corresponding port.

Definition at line 1963 of file NetlistGenerator.cc.

1965 {
1966 FUPort* correspondingPort = NULL;
1967 assert(origFU.hasOperationPort(portName));
1968 const FUPort* origPort = origFU.operationPort(portName);
1969 for (int i = 0; i < origFU.operationCount(); i++) {
1970 HWOperation* origOperation = origFU.operation(i);
1971 string opName = origOperation->name();
1972 if (fuToSearch.hasOperation(opName)) {
1973 HWOperation* operation = fuToSearch.operation(opName);
1974 if (!origOperation->isBound(*origPort)) {
1975 continue;
1976 }
1977 int origIO = origOperation->io(*origPort);
1978 FUPort* port = operation->port(origIO);
1979 if (port == NULL) {
1980 throw InstanceNotFound(__FILE__, __LINE__, __func__);
1981 }
1982 if (correspondingPort == NULL) {
1983 correspondingPort = port;
1984 } else if (correspondingPort != port) {
1985 throw InstanceNotFound(__FILE__, __LINE__, __func__);
1986 }
1987 }
1988 }
1989
1990 if (correspondingPort == NULL) {
1992 std::string("Corresponding port for [") + portName +
1993 "] defined in HDB was not found in FU of ADF: [" +
1994 fuToSearch.name() + "].");
1995 }
1996
1997 return *correspondingPort;
1998 }
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition Exception.hh:39
virtual HWOperation * operation(const std::string &name) const
virtual FUPort * operationPort(const std::string &name) const
virtual bool hasOperationPort(const std::string &name) const
virtual bool hasOperation(const std::string &name) const
virtual FUPort * port(int operand) const
int io(const FUPort &port) const
const std::string & name() const
bool isBound(const FUPort &port) const

References __func__, assert, TTAMachine::FunctionUnit::hasOperation(), TTAMachine::FunctionUnit::hasOperationPort(), TTAMachine::HWOperation::io(), TTAMachine::HWOperation::isBound(), TTAMachine::HWOperation::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::HWOperation::port(), and THROW_EXCEPTION.

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ fuEntry()

FUEntry & ProGe::NetlistGenerator::fuEntry ( const std::string &  fuName) const

Returns the FU entry which was selected to represent the given FU.

Parameters
fuNameName of the FU in ADF.
Returns
The FU entry.
Exceptions
InstanceNotFoundIf the netlist is not created yet or if there was no FU entry for the given FU.

Definition at line 657 of file NetlistGenerator.cc.

657 {
658 try {
660 } catch (const Exception&) {
661 throw InstanceNotFound(__FILE__, __LINE__, __func__,
662 "Cannot find function unit entry from the netlist.");
663 }
664 }

References __func__, fuEntryMap_, and MapTools::keyForValue().

Referenced by isParameterizable().

Here is the call graph for this function:

◆ fuGuardPort()

NetlistPort & ProGe::NetlistGenerator::fuGuardPort ( const NetlistPort fuPort) const

Returns the guard port of the given FU data port.

Parameters
fuPortThe FU data port.
Returns
The guard port.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 402 of file NetlistGenerator.cc.

402 {
403 try {
405 fuGuardPortMap_, &fuPort);
406 } catch (const Exception&) {
407 throw InstanceNotFound(__FILE__, __LINE__, __func__,
408 (boost::format(
409 "Cannot find guard port '%s' in instance name: '%s', "
410 "module name: '%s'") %
411 fuPort.name() % fuPort.parentBlock().instanceName() %
412 fuPort.parentBlock().moduleName())
413 .str());
414 }
415 }
PortRelationMap fuGuardPortMap_
Maps FU guard ports.

References __func__, fuGuardPortMap_, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), ProGe::BaseNetlistBlock::moduleName(), ProGe::NetlistPort::name(), and ProGe::NetlistPort::parentBlock().

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ fuOpcodePort()

NetlistPort & ProGe::NetlistGenerator::fuOpcodePort ( const NetlistBlock fuBlock) const

Returns the opcode port of the given FU.

Parameters
fuBlockThe FU.
Returns
The opcode port.
Exceptions
InstanceNotFoundIf the given FU does not have an opcode port.

Definition at line 380 of file NetlistGenerator.cc.

380 {
381 try {
383 fuOpcodePorts_, &fuBlock);
384 } catch (const Exception&) {
385 throw InstanceNotFound(__FILE__, __LINE__, __func__,
386 (boost::format("Cannot find opcode port in function unit "
387 "instance name: '%s',"
388 "module name: '%s'") %
389 fuBlock.instanceName() % fuBlock.moduleName())
390 .str());
391 }
392 }
PortPurposeMap fuOpcodePorts_
Maps FU opcode ports.

References __func__, fuOpcodePorts_, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), and ProGe::BaseNetlistBlock::moduleName().

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ gcuReturnAddressInPort()

NetlistPort & ProGe::NetlistGenerator::gcuReturnAddressInPort ( ) const

Returns the return address in port of GCU.

Returns
The return address in port.
Exceptions
InstanceNotFoundIf GCU does not have the port.

Definition at line 551 of file NetlistGenerator.cc.

551 {
552 if (raInPort_ != NULL) {
553 return *raInPort_;
554 } else {
555 throw InstanceNotFound(__FILE__, __LINE__, __func__,
556 "Cannot find return address of in port of GCU");
557 }
558 }

References __func__, and raInPort_.

Referenced by DefaultICGenerator::addICToNetlist(), and DefaultICDecoderGenerator::generateDebuggerCode().

◆ gcuReturnAddressOutPort()

NetlistPort & ProGe::NetlistGenerator::gcuReturnAddressOutPort ( ) const

Returns the return address out port of GCU.

Returns
The return address out port.
Exceptions
InstanceNotFoundIf GCU does not have the port.

Definition at line 567 of file NetlistGenerator.cc.

567 {
568 if (raOutPort_ != NULL) {
569 return *raOutPort_;
570 } else {
571 throw InstanceNotFound(__FILE__, __LINE__, __func__,
572 "Cannot find return address of out port of GCU");
573 }
574 }

References __func__, and raOutPort_.

Referenced by DefaultICGenerator::addICToNetlist().

◆ generate()

NetlistBlock * ProGe::NetlistGenerator::generate ( const ProGeOptions options,
int  imemWidthInMAUs,
TCEString  entityNameStr = TOPLEVEL_BLOCK_DEFAULT_NAME,
std::ostream &  warningStream = std::cerr 
)

Generates the netlist block of the processor.

Parameters
imemWidthInMAUsWidth of instruction memory in MAUs.
entityNameStrThe name string used to make the netlist blocks uniquely named.
Returns
The newly generated netlist block representing a single TTA Core.
Exceptions
IOExceptionIf some of the HDBs given in IDF cannot be accessed.
InvalidDataIf HDB or IDF is invalid.
OutOfRangeIf the given width of instruction memory is not positive
InstanceNotFoundSomething missing missing from HDB.

Definition at line 188 of file NetlistGenerator.cc.

191 {
192 if (imemWidthInMAUs < 1) {
193 string errorMsg =
194 "Instruction memory width in MAUs must be positive.";
195 throw OutOfRange(__FILE__, __LINE__, __func__, errorMsg);
196 }
197
198 // add toplevel block
199 coreBlock_ = new NetlistBlock(entityNameStr, "tta_core");
202
203 // add GCU to the netlist
204 addGCUToNetlist(*coreBlock_, imemWidthInMAUs);
205
206 // add Genrated FUs to the toplevel netlist.
207 for (auto fug : context_.idf().FUGenerations()) {
209 }
210
211 // add function units to the netlist
212 for (int i = 0; i < context_.idf().fuImplementationCount(); i++) {
215 addFUToNetlist(location, *coreBlock_, warningStream);
216 }
217
218 // add register files to the netlist
219 for (int i = 0; i < context_.idf().rfImplementationCount(); i++) {
220 RFImplementationLocation& location =
222 addRFToNetlist(options, location, *coreBlock_);
223 }
224
225 // add immediate units to the netlist
226 for (int i = 0; i < context_.idf().iuImplementationCount(); i++) {
227 RFImplementationLocation& location =
229 addIUToNetlist(options, location, *coreBlock_);
230 }
231
233
234 return coreBlock_;
235 }
RFImplementationLocation & iuImplementation(const std::string &iu) const
RFImplementationLocation & rfImplementation(const std::string &rf) const
FUImplementationLocation & fuImplementation(const std::string &fu) const
virtual void completeNetlist(NetlistBlock &netlistBlock, const NetlistGenerator &generator)=0
void addPackage(const std::string &packageName)
GeneratableFUNetlistBlock * addGeneratableFUsToNetlist(const IDF::FUGenerated &fug, NetlistBlock &netlistBlock)
void addRFToNetlist(const ProGeOptions &options, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock)
void addFUToNetlist(const IDF::FUImplementationLocation &location, NetlistBlock &netlistBlock, std::ostream &warningStream)
void addGCUToNetlist(NetlistBlock &toplevelBlock, int imemWidthInMAUs)
void addIUToNetlist(const ProGeOptions &options, const IDF::RFImplementationLocation &location, NetlistBlock &netlistBlock)
const IDF::MachineImplementation & idf() const

References __func__, addFUToNetlist(), addGCUToNetlist(), addGeneratableFUsToNetlist(), addIUToNetlist(), ProGe::NetlistBlock::addPackage(), addRFToNetlist(), ProGe::ICDecoderGeneratorPlugin::completeNetlist(), context_, coreBlock_, ProGe::ProGeContext::coreEntityName(), IDF::MachineImplementation::FUGenerations(), IDF::MachineImplementation::fuImplementation(), ProGe::ProGeContext::idf(), IDF::MachineImplementation::iuImplementation(), options, plugin_, and IDF::MachineImplementation::rfImplementation().

Referenced by ProGe::ProcessorGenerator::generateProcessor().

Here is the call graph for this function:

◆ glockPort()

NetlistPort & ProGe::NetlistGenerator::glockPort ( const NetlistBlock block) const

Returns the global lock port of the given block in the netlist.

Parameters
blockThe block in the netlist.
Returns
The global lock port of the given block.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 477 of file NetlistGenerator.cc.

477 {
478 try {
480 } catch (const Exception&) {
481 throw InstanceNotFound(__FILE__, __LINE__, __func__,
482 (boost::format("Cannot find global lock port in netlist block "
483 "instance name:"
484 " '%s', module name: '%s'") %
485 block.instanceName() % block.moduleName())
486 .str());
487 }
488 }
PortPurposeMap glockPorts_
Maps global lock ports.

References __func__, glockPorts_, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), and ProGe::BaseNetlistBlock::moduleName().

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGeneratableFUsToNetlist(), DefaultDecoderGenerator::addGlockPortToDecoder(), and mapGlobalLockPort().

Here is the call graph for this function:

◆ glockReqPort()

NetlistPort & ProGe::NetlistGenerator::glockReqPort ( const NetlistBlock block) const

Returns the global lock request port of the given block in the netlist.

Parameters
blockThe block in the netlist.
Returns
The global lock request port of the given block.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 510 of file NetlistGenerator.cc.

510 {
511 try {
513 } catch (const Exception&) {
514 throw InstanceNotFound(__FILE__, __LINE__, __func__,
515 (boost::format("Cannot find global lock request port in "
516 "netlist block "
517 "instance name: '%s', module name: '%s'") %
518 block.instanceName() % block.moduleName())
519 .str());
520 }
521 }
PortPurposeMap glockReqPorts_
Maps global lock request ports.

References __func__, glockReqPorts_, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), and ProGe::BaseNetlistBlock::moduleName().

Referenced by addFUToNetlist(), addGeneratableFUsToNetlist(), DefaultDecoderGenerator::addLockReqPortToDecoder(), and mapGlobalLockRequestPort().

Here is the call graph for this function:

◆ hasGlockPort()

bool ProGe::NetlistGenerator::hasGlockPort ( const NetlistBlock block) const

Tells whether the given netlist block has a global lock port.

Parameters
blockThe netlist block.
Returns
True if the block has a global lock port, otherwise false.

Definition at line 465 of file NetlistGenerator.cc.

465 {
466 return MapTools::containsKey(glockPorts_, &block);
467 }
static bool containsKey(const MapType &aMap, const KeyType &aKey)

References MapTools::containsKey(), and glockPorts_.

Referenced by DefaultDecoderGenerator::addGlockPortToDecoder(), and DefaultDecoderGenerator::glockPortWidth().

Here is the call graph for this function:

◆ hasGlockReqPort()

bool ProGe::NetlistGenerator::hasGlockReqPort ( const NetlistBlock block) const

Tells whether the given netlist block has global lock request port.

Parameters
blockThe netlist block.
Returns
True if the block has a global lock request port, otherwise false.

Definition at line 497 of file NetlistGenerator.cc.

497 {
499 }

References MapTools::containsKey(), and glockReqPorts_.

Referenced by DefaultDecoderGenerator::addLockReqPortToDecoder(), and DefaultDecoderGenerator::glockRequestWidth().

Here is the call graph for this function:

◆ hasOpcodePort()

bool ProGe::NetlistGenerator::hasOpcodePort ( const NetlistPort port) const

Returns true if the given RF port has opcode port. Otherwise, returns false.

Definition at line 322 of file NetlistGenerator.cc.

322 {
324 }
PortRelationMap rfOpcodePortMap_
Maps opcode ports.

References MapTools::containsKey(), and rfOpcodePortMap_.

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ immediateUnitWritePort()

NetlistPort & ProGe::NetlistGenerator::immediateUnitWritePort ( const TTAMachine::ImmediateUnit iu) const

Returns a netlist port that is the write port of the given immediate unit.

Parameters
iuThe immediate unit.
Returns
The netlist port.
Exceptions
InstanceNotFoundIf the port is not found.

Definition at line 532 of file NetlistGenerator.cc.

533 {
534 try {
536 } catch (const Exception&) {
537 throw InstanceNotFound(__FILE__, __LINE__, __func__,
538 (boost::format("Cannot find immediate unit '%s' write port.") %
539 iu.name())
540 .str());
541 }
542 }
IUPortMap iuPortMap_
Maps the created netlist ports to immediate units.

References __func__, iuPortMap_, MapTools::keyForValue(), and TTAMachine::Component::name().

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ inferLSUSignal()

Signal ProGe::NetlistGenerator::inferLSUSignal ( const std::string &  portName)
staticprivate

Definition at line 2151 of file NetlistGenerator.cc.

2151 {
2152 size_t pos = 0;
2153 if (((pos = portName.find("addr")) != std::string::npos)) {
2154 return SignalType::ADDRESS;
2155 } else if (((pos = portName.find("data")) != std::string::npos)) {
2156 if ((portName.find("_in", pos + 4)) != std::string::npos) {
2157 return SignalType::READ_DATA;
2158 } else if ((portName.find("_out", pos + 4)) != std::string::npos) {
2160 }
2161 } else if (((pos = portName.find("mem_en")) != std::string::npos)) {
2162 if ((portName.find("_x", pos + 6)) != std::string::npos) {
2164 } else {
2166 }
2167 } else if (((pos = portName.find("wr_mask")) != std::string::npos)) {
2168 if ((portName.find("_x", pos + 7)) != std::string::npos) {
2170 } else {
2172 }
2173 } else if (((pos = portName.find("wr_en")) != std::string::npos)) {
2174 if ((portName.find("_x", pos + 5)) != std::string::npos) {
2176 } else {
2177 return SignalType::WRITEMODE;
2178 }
2179 }
2180 return SignalType::UNDEFINED;
2181 }
@ UNDEFINED
Signal does not have specified usage.
@ READ_WRITE_REQUEST
Signal to make either read or write request.
@ WRITEMODE
Signal to choose mode for READ_WRITE_REQUEST or similar.

References ProGe::ADDRESS, ProGe::LOW, ProGe::READ_DATA, ProGe::READ_WRITE_REQUEST, ProGe::UNDEFINED, ProGe::WRITE_BITMASK, ProGe::WRITE_DATA, and ProGe::WRITEMODE.

Referenced by addFUExternalPortsToNetlist().

◆ instructionDecoder()

NetlistBlock & ProGe::NetlistGenerator::instructionDecoder ( ) const

Returns the instruction decoder block in the netlist.

Returns
The instruction decoder block.
Exceptions
InstanceNotFoundIf there is no instruction decoder in the netlist.

Definition at line 600 of file NetlistGenerator.cc.

600 {
601 if (instructionDecoder_ == NULL) {
602 throw InstanceNotFound(__FILE__, __LINE__, __func__,
603 "Cannot find instruction decoder block from the netlist.");
604 } else {
605 return *instructionDecoder_;
606 }
607 }

References __func__, and instructionDecoder_.

Referenced by DefaultICDecoderGenerator::addRV32MicroCode(), DefaultDecoderGenerator::completeDecoderBlock(), DefaultICDecoderGenerator::generateDebuggerCode(), and DefaultDecoderGenerator::opcodeWidth().

◆ instructionDecompressor()

NetlistBlock & ProGe::NetlistGenerator::instructionDecompressor ( ) const

Returns the instruction decompressor block in the netlist.

Returns
The instruction decompressor block.
Exceptions
InstanceNotFoundIf there is no instruction decompressor in the netlist.

Definition at line 636 of file NetlistGenerator.cc.

636 {
637 if (instructionDecompressor_ == NULL) {
638 throw InstanceNotFound(__FILE__, __LINE__, __func__,
639 "Cannot find instruction decompressor block from the "
640 "netlist.");
641 } else {
643 }
644 }

References __func__, and instructionDecompressor_.

Referenced by DefaultICDecoderGenerator::addRV32MicroCode().

◆ instructionFetch()

NetlistBlock & ProGe::NetlistGenerator::instructionFetch ( ) const

Returns the instruction fetch block in the netlist.

Returns
The instruction fetch block.
Exceptions
InstanceNotFoundIf there is no instruction fetch in the netlist.

Definition at line 617 of file NetlistGenerator.cc.

617 {
618 if (instructionFetch_ == NULL) {
619 throw InstanceNotFound(__FILE__, __LINE__, __func__,
620 "Cannot find instruction fetch block from the netlist.");
621 } else {
622 return *instructionFetch_;
623 }
624 }

References __func__, and instructionFetch_.

Referenced by DefaultICDecoderGenerator::addDummyIfetchDebugPorts(), DefaultICDecoderGenerator::addInstructioRegisterBypass(), DefaultICDecoderGenerator::addRV32MicroCode(), DefaultICDecoderGenerator::generate(), and DefaultICDecoderGenerator::generateDebuggerCode().

◆ instructionMemory()

TTAMachine::AddressSpace & ProGe::NetlistGenerator::instructionMemory ( const TTAMachine::Machine machine)
staticprivate

Returns the address space that represents the instruction memory of the given machine.

Parameters
machineThe machine.
Returns
The address space.
Exceptions
IllegalMachineIf the machine does not have the instruction memory address space.

Definition at line 2041 of file NetlistGenerator.cc.

2041 {
2043 if (cu == NULL) {
2044 string errorMsg = "The machine does not have a control unit.";
2045 throw IllegalMachine(__FILE__, __LINE__, __func__, errorMsg);
2046 }
2047
2048 AddressSpace* iMem = cu->addressSpace();
2049 if (iMem == NULL) {
2050 string errorMsg =
2051 "The control unit does not have an address space.";
2052 throw IllegalMachine(__FILE__, __LINE__, __func__, errorMsg);
2053 }
2054
2055 return *iMem;
2056 }
TTAMachine::Machine * machine
the architecture definition of the estimated processor

References __func__, TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::controlUnit(), and machine.

Referenced by instructionMemoryAddressWidth(), and instructionMemoryWidth().

Here is the call graph for this function:

◆ instructionMemoryAddressWidth()

int ProGe::NetlistGenerator::instructionMemoryAddressWidth ( const TTAMachine::Machine machine)
staticprivate

Explores the given machine for the width of the instruction memory address.

Parameters
machineThe machine.
Returns
The width of the instruction memory address.
Exceptions
IllegalMachineIf the machine is erroneous.

Definition at line 2009 of file NetlistGenerator.cc.

2010 {
2012 return MathTools::requiredBits(iMem.end());
2013 }
static TTAMachine::AddressSpace & instructionMemory(const TTAMachine::Machine &machine)

References TTAMachine::AddressSpace::end(), instructionMemory(), machine, and MathTools::requiredBits().

Here is the call graph for this function:

◆ instructionMemoryWidth()

int ProGe::NetlistGenerator::instructionMemoryWidth ( const TTAMachine::Machine machine)
staticprivate

Explores the given machine for the width of the instruction memory.

Parameters
machineThe machine.
Returns
The width of the instruction memory.
Exceptions
IllegalMachineIf the machine is erroneous.

Definition at line 2023 of file NetlistGenerator.cc.

2024 {
2026 return iMem.width();
2027 }
virtual int width() const

References instructionMemory(), machine, and TTAMachine::AddressSpace::width().

Here is the call graph for this function:

◆ isLSU()

bool ProGe::NetlistGenerator::isLSU ( const TTAMachine::FunctionUnit fu) const
private

(Ugly) heursitics for identifying an LSU.

If it has an address space and implements a memory operation, it is an LSU

Parameters
fuFunction unit to be tested
Returns
Is the fu an LSU

Definition at line 2102 of file NetlistGenerator.cc.

2102 {
2103
2104 if (!fu.hasAddressSpace()) {
2105 return false;
2106 }
2107
2108 const int opCount = 18;
2109 TCEString ops[opCount] = {
2110 "ldw", "ldh", "ldq", "ldw2", "ldw4",
2111 "stw", "sth", "stq", "stw2", "stw4",
2112 "ld8", "ldu8", "ld16","ldu16", "ld32",
2113 "st8", "st16", "st32"
2114 };
2115
2116 for (auto& op : ops) {
2117 if (fu.hasOperationLowercase(op)) {
2118 return true;
2119 }
2120 }
2121 return false;
2122 }
virtual bool hasOperationLowercase(const std::string &name) const

References TTAMachine::FunctionUnit::hasAddressSpace(), and TTAMachine::FunctionUnit::hasOperationLowercase().

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ isLSUDataPort()

bool ProGe::NetlistGenerator::isLSUDataPort ( const TTAMachine::FunctionUnit adfFU,
const std::string &  portName 
)
staticprivate

(Ugly) heuristics for identifying an LSU data memory port.

The identification is made by partial match of the port's name.

Parameters
portNameThe port name given in HDB.
Returns
True if the port is LSU data memory port.

Definition at line 2132 of file NetlistGenerator.cc.

2133 {
2134
2135 if (!adfFU.hasAddressSpace()) {
2136 return false;
2137 }
2138
2139 static const std::set<std::string> magicWords{
2140 "addr", "data", "mem_en", "wr_en", "wr_mask"};
2141
2142 for (auto magicWord : magicWords) {
2143 if (portName.find(magicWord) != std::string::npos) {
2144 return true;
2145 }
2146 }
2147
2148 return false;
2149 }

References TTAMachine::FunctionUnit::hasAddressSpace().

Referenced by addFUExternalPortsToNetlist().

Here is the call graph for this function:

◆ isParameterizable()

bool ProGe::NetlistGenerator::isParameterizable ( const std::string &  paramName,
const HDB::FUEntry fuEntry 
) const
private

Checks if the given parameter is defined parametrizable in the given FUImplementation

Parameters
paramNameName of the parameter
fuImplementationFUImplementation to be tested

Definition at line 1832 of file NetlistGenerator.cc.

1833 {
1834 FUImplementation& fuImplementation = fuEntry->implementation();
1835
1836 for (int i = 0; i < fuImplementation.architecturePortCount(); i++) {
1837
1838 FUPortImplementation& port = fuImplementation.architecturePort(i);
1839 string widthFormula = port.widthFormula();
1840 if (widthFormula == paramName) {
1842 port.architecturePort());
1843 }
1844 }
1845 return false;
1846 }
bool hasParameterizedWidth(const std::string &port) const
HDB::FUEntry & fuEntry(const std::string &fuName) const

References HDB::FUEntry::architecture(), HDB::FUPortImplementation::architecturePort(), HDB::FUImplementation::architecturePort(), HDB::FUImplementation::architecturePortCount(), fuEntry(), HDB::FUArchitecture::hasParameterizedWidth(), HDB::FUEntry::implementation(), and HDB::FUPortImplementation::widthFormula().

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ loadPort()

NetlistPort & ProGe::NetlistGenerator::loadPort ( const NetlistPort port) const

Returns the load enable port of the given port in the netlist.

Parameters
portThe architectural port in the netlist.
Returns
The load enable port of the given port.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 304 of file NetlistGenerator.cc.

304 {
305 try {
307 } catch (const Exception&) {
308 throw InstanceNotFound(__FILE__, __LINE__, __func__,
309 (boost::format(
310 "Cannot find load port '%s' in instance name: '%s', "
311 "module name: '%s'") %
312 port.name() % port.parentBlock().instanceName() %
313 port.parentBlock().moduleName())
314 .str());
315 }
316 }
PortRelationMap loadPortMap_
Maps loads ports.

References __func__, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), loadPortMap_, ProGe::BaseNetlistBlock::moduleName(), ProGe::NetlistPort::name(), and ProGe::NetlistPort::parentBlock().

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGCUToNetlist(), DefaultDecoderGenerator::completeDecoderBlock(), and mapLoadPort().

Here is the call graph for this function:

◆ mapClockPort()

void ProGe::NetlistGenerator::mapClockPort ( const NetlistBlock block,
NetlistPort clkPort 
)
private

Maps the given clock port for the given block.

Parameters
blockThe netlist block.
clkPortThe clock port of the block.

Definition at line 1733 of file NetlistGenerator.cc.

1734 {
1735
1737 clkPorts_.insert(
1738 std::pair<const NetlistBlock*, NetlistPort*>(&block, &clkPort));
1739 }

References assert, clkPort(), clkPorts_, and MapTools::containsKey().

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGCUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapFUGuardPort()

void ProGe::NetlistGenerator::mapFUGuardPort ( const NetlistPort dataPort,
NetlistPort guardPort 
)
private

Maps the given guard port for the given FU data port.

Parameters
dataPortThe data port.
guardPortThe guard port.

Definition at line 1803 of file NetlistGenerator.cc.

1804 {
1805
1807 fuGuardPortMap_.insert(
1808 std::pair<const NetlistPort*, NetlistPort*>(&dataPort, &guardPort));
1809 }

References assert, MapTools::containsKey(), and fuGuardPortMap_.

Referenced by addFUToNetlist().

Here is the call graph for this function:

◆ mapFUOpcodePort()

void ProGe::NetlistGenerator::mapFUOpcodePort ( const NetlistBlock block,
NetlistPort port 
)
private

Maps the given opcode port for the given FU block.

Parameters
blockThe FU block.
opcodePortThe opcode port of the FU block.

Definition at line 1719 of file NetlistGenerator.cc.

1720 {
1721
1723 fuOpcodePorts_.insert(
1724 std::pair<const NetlistBlock*, NetlistPort*>(&block, &port));
1725 }

References assert, MapTools::containsKey(), and fuOpcodePorts_.

Referenced by addFUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapGlobalLockPort()

void ProGe::NetlistGenerator::mapGlobalLockPort ( const NetlistBlock block,
NetlistPort glockPort 
)
private

Maps the given global lock port for the given block.

Parameters
blockThe netlist block.
glockPortThe global lock port of the block.

Definition at line 1761 of file NetlistGenerator.cc.

1762 {
1763
1765 glockPorts_.insert(
1766 std::pair<const NetlistBlock*, NetlistPort*>(&block, &glockPort));
1767 }

References assert, MapTools::containsKey(), glockPort(), and glockPorts_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapGlobalLockRequestPort()

void ProGe::NetlistGenerator::mapGlobalLockRequestPort ( const NetlistBlock block,
NetlistPort glockReqPort 
)

Maps the given global lock request port for the given block.

Parameters
blockThe netlist block.
glockReqPortThe global lock request port of the block.

Definition at line 1775 of file NetlistGenerator.cc.

1776 {
1777
1779 glockReqPorts_.insert(std::pair<const NetlistBlock*, NetlistPort*>(
1780 &block, &glockReqPort));
1781 }

References assert, MapTools::containsKey(), glockReqPort(), and glockReqPorts_.

Referenced by addFUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapImmediateUnitWritePort()

void ProGe::NetlistGenerator::mapImmediateUnitWritePort ( const TTAMachine::ImmediateUnit iu,
NetlistPort port 
)
private

Maps the given netlist port as a write port of the given immediate unit.

Parameters
iuThe immediate unit.
portThe netlist port.

Definition at line 1818 of file NetlistGenerator.cc.

1819 {
1820
1821 iuPortMap_.insert(
1822 std::pair<const ImmediateUnit*, NetlistPort*>(&iu, &port));
1823 }

References iuPortMap_.

Referenced by addBaseRFToNetlist().

◆ mapLoadPort()

void ProGe::NetlistGenerator::mapLoadPort ( const NetlistPort port,
NetlistPort loadPort 
)
private

Maps the given load port for the given architectural port.

Parameters
portThe architectural port in the netlist.
loadPortThe load port of the architectural port.

Definition at line 1691 of file NetlistGenerator.cc.

1692 {
1693
1695 loadPortMap_.insert(
1696 std::pair<const NetlistPort*, NetlistPort*>(&port, &loadPort));
1697 }

References assert, MapTools::containsKey(), loadPort(), and loadPortMap_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGCUToNetlist(), and ProGe::GeneratableFUNetlistBlock::addInOperand().

Here is the call graph for this function:

◆ mapNetlistBlock()

void ProGe::NetlistGenerator::mapNetlistBlock ( const TTAMachine::Unit unit,
NetlistBlock netlistBlock 
)
private

Maps the given ADF Function Unit to the given netlist block.

Parameters
adfFUThe Function Unit in ADF (Machine Object Model).
netlistBlockThe corresponding block in the netlist.

Definition at line 1668 of file NetlistGenerator.cc.

1669 {
1672 std::pair<const Unit*, NetlistBlock*>(&unit, &netlistBlock));
1673 }
UnitCorrespondenceMap unitCorrespondenceMap_
Maps the ADF units to the netlist blocks.

References assert, MapTools::containsKey(), netlistBlock(), and unitCorrespondenceMap_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapNetlistPort()

void ProGe::NetlistGenerator::mapNetlistPort ( const TTAMachine::Port adfPort,
NetlistPort netlistPort 
)
private

Maps the given ADF port to the given netlist port.

Parameters
adfPortThe port in ADF (Machine Object Model).
netlistPortThe corresponding port in the netlist.

Definition at line 1650 of file NetlistGenerator.cc.

1651 {
1652
1653 if (portCorrespondenceMap_.count(&adfPort) != 0) {
1654 auto range = portCorrespondenceMap_.equal_range(&adfPort);
1655 for (auto i = range.first; i != range.second; ++i) {
1656 assert(i->second->direction() != netlistPort.direction());
1657 }
1658 }
1659 portCorrespondenceMap_.emplace(&adfPort, &netlistPort);
1660 }
NetlistPort & netlistPort(const TTAMachine::Port &port, Direction dir=IN) const
Direction direction() const

References assert, ProGe::NetlistPort::direction(), netlistPort(), and portCorrespondenceMap_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGCUToNetlist(), ProGe::GeneratableFUNetlistBlock::addInOperand(), and ProGe::GeneratableFUNetlistBlock::addOutOperand().

Here is the call graph for this function:

◆ mapResetPort()

void ProGe::NetlistGenerator::mapResetPort ( const NetlistBlock block,
NetlistPort resetPort 
)
private

Maps the given reset port for the given block.

Parameters
blockThe netlist block.
resetPortThe reset port of the block.

Definition at line 1747 of file NetlistGenerator.cc.

1748 {
1749
1751 rstPorts_.insert(
1752 std::pair<const NetlistBlock*, NetlistPort*>(&block, &resetPort));
1753 }
PortPurposeMap rstPorts_
Maps reset ports.

References assert, MapTools::containsKey(), and rstPorts_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGCUToNetlist(), and addGeneratableFUsToNetlist().

Here is the call graph for this function:

◆ mapRFGuardPort()

void ProGe::NetlistGenerator::mapRFGuardPort ( const NetlistBlock block,
NetlistPort guardPort 
)
private

Maps the given guard port for the given RF block.

Parameters
blockThe netlist block.
guardPortThe guard port of the block.

Definition at line 1789 of file NetlistGenerator.cc.

1790 {
1791
1793 rfGuardPorts_.insert(
1794 std::pair<const NetlistBlock*, NetlistPort*>(&block, &guardPort));
1795 }
PortPurposeMap rfGuardPorts_
Maps RF guard ports.

References assert, MapTools::containsKey(), and rfGuardPorts_.

Referenced by addBaseRFToNetlist().

Here is the call graph for this function:

◆ mapRFOpcodePort()

void ProGe::NetlistGenerator::mapRFOpcodePort ( const NetlistPort port,
NetlistPort opcodePort 
)
private

Maps the given opcode port for the given architectural RF port.

Parameters
portThe architectural port in the netlist.
opcodePortThe opcode port of the architectural port.

Definition at line 1705 of file NetlistGenerator.cc.

1706 {
1707
1709 rfOpcodePortMap_.insert(
1710 std::pair<const NetlistPort*, NetlistPort*>(&port, &opcodePort));
1711 }

References assert, MapTools::containsKey(), and rfOpcodePortMap_.

Referenced by addBaseRFToNetlist().

Here is the call graph for this function:

◆ netlistBlock()

NetlistBlock & ProGe::NetlistGenerator::netlistBlock ( const TTAMachine::Unit unit) const

Returns the netlist block which is corresponding to the given unit in the machine object model.

Parameters
unitThe Unit in the machine object model
Returns
The corresponding block in the netlist.
Exceptions
InstanceNotFoundIf the netlist does not contain the block.

Definition at line 283 of file NetlistGenerator.cc.

283 {
284 try {
287 } catch (const Exception&) {
288 throw InstanceNotFound(__FILE__, __LINE__, __func__,
289 (boost::format(
290 "Cannot find corresponding netlist block for '%s'") %
291 unit.name())
292 .str());
293 }
294 }

References __func__, MapTools::keyForValue(), TTAMachine::Component::name(), and unitCorrespondenceMap_.

Referenced by DefaultDecoderGenerator::addGlockPortToDecoder(), addIUToNetlist(), DefaultDecoderGenerator::addLockReqPortToDecoder(), addRFToNetlist(), DefaultDecoderGenerator::completeDecoderBlock(), DefaultDecoderGenerator::glockPortWidth(), DefaultDecoderGenerator::glockRequestWidth(), and mapNetlistBlock().

Here is the call graph for this function:

◆ netlistPort()

NetlistPort & ProGe::NetlistGenerator::netlistPort ( const TTAMachine::Port port,
Direction  dir = IN 
) const

Returns the netlist port which is corresponding to the given port in the machine object model.

Parameters
portThe port in the machine object model
Returns
The corresponding port in the netlist.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 247 of file NetlistGenerator.cc.

248 {
249 if (portCorrespondenceMap_.count(&port) > 0) {
250 // Override direction with port direction if the port is
251 // unidirectional
252 if (!(port.isInput() && port.isOutput())) {
253 dir = port.isInput() ? IN : OUT;
254 }
255
256 auto range = portCorrespondenceMap_.equal_range(&port);
257 for (auto i = range.first; i != range.second; ++i) {
258 if(i->second->direction() == dir)
259 return *i->second;
260 }
263 }
264
265 throw InstanceNotFound(__FILE__, __LINE__, __func__,
266 (boost::format(
267 "Cannot find netlist port '%s' in parent unit: '%s'") %
268 port.name() % port.parentUnit()->name())
269 .str());
270 }
Unit * parentUnit() const

References __func__, ProGe::IN, TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), MapTools::keyForValue(), TTAMachine::Component::name(), TTAMachine::Port::name(), ProGe::OUT, TTAMachine::Port::parentUnit(), and portCorrespondenceMap_.

Referenced by DefaultICGenerator::addICToNetlist(), DefaultDecoderGenerator::completeDecoderBlock(), and mapNetlistPort().

Here is the call graph for this function:

◆ netlistPortIsMapped()

bool ProGe::NetlistGenerator::netlistPortIsMapped ( const TTAMachine::Port adfPort)
private

Returns true if the given ADF port is mapped to some netlist port.

Parameters
adfPortThe port in ADF (Machine Object Model).

Definition at line 1681 of file NetlistGenerator.cc.

1681 {
1682 return portCorrespondenceMap_.count(&adfPort) != 0;
1683 }

References portCorrespondenceMap_.

Referenced by addGCUToNetlist().

◆ opcodePortWidth() [1/2]

int ProGe::NetlistGenerator::opcodePortWidth ( const HDB::FUEntry fu,
std::ostream &  warningStream 
)
staticprivate

Calculates the required opcode port width for the given FU.

Parameters
fuThe FU.
warningStreamOutput stream where warnings are written
Returns
The required width of opcode port.
Exceptions
InvalidDataIf the HDB is missing some information.

Definition at line 1889 of file NetlistGenerator.cc.

1890 {
1892 assert(fu.hasArchitecture());
1894 FunctionUnit& architecture = fu.architecture().architecture();
1895 int portWidth = 0;
1896
1897 // operation codes are now numbered according to their alphabetical
1898 // order
1899 set<string> opcodeSet;
1900 for (int i = 0; i < architecture.operationCount(); i++) {
1901 HWOperation* operation = architecture.operation(i);
1902 opcodeSet.insert(operation->name());
1903 }
1904
1905 int opcode = 0;
1906 for (set<string>::iterator iter = opcodeSet.begin();
1907 iter != opcodeSet.end(); iter++) {
1908 // there is an old opcode value in hdb
1909 if (opcodeSet.size() != 1 && implementation.hasOpcode(*iter)) {
1910 // old value differs from current guide line
1911 if (opcode != implementation.opcode(*iter)) {
1912 warningStream << "Warning: Opcode defined in HDB for "
1913 << "operation " << *iter
1914 << " does not comply with the requirement "
1915 << "for numbering the operation codes "
1916 << "according to alphabetical order of "
1917 << "operations. Please fix the vhdl and "
1918 << "hdb entry." << std::endl;
1919 }
1920 }
1921 int requiredBits = MathTools::requiredBits(opcode);
1922 if (requiredBits > portWidth) {
1923 portWidth = requiredBits;
1924 }
1925 opcode++;
1926 }
1927
1928 return portWidth;
1929 }

References HDB::FUArchitecture::architecture(), HDB::FUEntry::architecture(), assert, HDB::FUEntry::hasArchitecture(), HDB::FUEntry::hasImplementation(), HDB::FUEntry::implementation(), implementation, TTAMachine::HWOperation::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), and MathTools::requiredBits().

Referenced by addFUToNetlist(), and addGCUToNetlist().

Here is the call graph for this function:

◆ opcodePortWidth() [2/2]

int ProGe::NetlistGenerator::opcodePortWidth ( const TTAMachine::ControlUnit gcu)
staticprivate

Calculates the required opcode port width for the given GCU.

Parameters
gcuThe GCU.
Returns
The required width of opcode port.

Definition at line 1937 of file NetlistGenerator.cc.

1937 {
1938 set<string> opcodeSet;
1939 for (int i = 0; i < gcu.operationCount(); i++) {
1940 HWOperation* operation = gcu.operation(i);
1941 opcodeSet.insert(operation->name());
1942 }
1943
1944 // Assumes that operations of GCU are coded as
1945 // 0..operationCount()-1.
1946 if (opcodeSet.size() < 2) {
1947 return 1;
1948 } else {
1949 return MathTools::requiredBits(opcodeSet.size() - 1);
1950 }
1951 }

References TTAMachine::HWOperation::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), and MathTools::requiredBits().

Here is the call graph for this function:

◆ rfEntry()

HDB::RFEntry & ProGe::NetlistGenerator::rfEntry ( const std::string &  rfName) const

Returns the RF entry which was selected to represent the given RF.

Parameters
fuNameName of the RF in ADF.
Returns
The RF entry.
Exceptions
InstanceNotFoundIf the netlist is not created yet or if there was no RF entry for the given RF.

Definition at line 676 of file NetlistGenerator.cc.

676 {
677 try {
679 } catch (const Exception&) {
680 throw InstanceNotFound(__FILE__, __LINE__, __func__,
681 "Cannot find register file entry from the netlist.");
682 }
683 }

References __func__, MapTools::keyForValue(), and rfEntryMap_.

Referenced by DefaultDecoderGenerator::sacEnabled().

Here is the call graph for this function:

◆ rfGuardPort()

NetlistPort & ProGe::NetlistGenerator::rfGuardPort ( const NetlistBlock rfBlock) const

Returns the guard port of the given RF block in the netlist.

Parameters
rfBlockThe RF block in the netlist.
Returns
The guard port of the given block.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 357 of file NetlistGenerator.cc.

357 {
358 try {
360 rfGuardPorts_, &rfBlock);
361 } catch (const Exception&) {
362 throw InstanceNotFound(__FILE__, __LINE__, __func__,
363 (boost::format("Cannot find guard port in register file "
364 "instance name: '%s',"
365 "module name: '%s'") %
366 rfBlock.instanceName() % rfBlock.moduleName())
367 .str());
368 }
369 }

References __func__, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), ProGe::BaseNetlistBlock::moduleName(), and rfGuardPorts_.

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ rfOpcodePort()

NetlistPort & ProGe::NetlistGenerator::rfOpcodePort ( const NetlistPort port) const

Returns the opcode port of the given RF port in the netlist.

Parameters
portThe architectural RF port in the netlist.
Returns
The opcode port of the given port.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 334 of file NetlistGenerator.cc.

334 {
335 try {
337 rfOpcodePortMap_, &port);
338 } catch (const Exception&) {
339 throw InstanceNotFound(__FILE__, __LINE__, __func__,
340 (boost::format("Cannot find rf opcode port '%s' in "
341 "instance name: '%s', "
342 "module name: '%s'") %
343 port.name() % port.parentBlock().instanceName() %
344 port.parentBlock().moduleName())
345 .str());
346 }
347 }

References __func__, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), ProGe::BaseNetlistBlock::moduleName(), ProGe::NetlistPort::name(), ProGe::NetlistPort::parentBlock(), and rfOpcodePortMap_.

Referenced by DefaultDecoderGenerator::completeDecoderBlock().

Here is the call graph for this function:

◆ rstPort()

NetlistPort & ProGe::NetlistGenerator::rstPort ( const NetlistBlock block) const

Returns the reset port of the given block in the netlist.

Parameters
blockThe block in the netlist.
Returns
The reset port of the given block.
Exceptions
InstanceNotFoundIf the netlist does not contain the port.

Definition at line 446 of file NetlistGenerator.cc.

446 {
447 try {
449 } catch (const Exception&) {
450 throw InstanceNotFound(__FILE__, __LINE__, __func__,
451 (boost::format("Cannot find reset port in netlist block "
452 "instance name: "
453 "'%s', module name: '%s'") %
454 block.instanceName() % block.moduleName())
455 .str());
456 }
457 }

References __func__, ProGe::BaseNetlistBlock::instanceName(), MapTools::keyForValue(), ProGe::BaseNetlistBlock::moduleName(), and rstPorts_.

Referenced by addBaseRFToNetlist(), addFUToNetlist(), addGeneratableFUsToNetlist(), DefaultICDecoderGenerator::addRV32MicroCode(), and DefaultICDecoderGenerator::generateDebuggerCode().

Here is the call graph for this function:

◆ translateDirection()

ProGe::Direction ProGe::NetlistGenerator::translateDirection ( HDB::Direction  direction)
staticprivate

Definition at line 2059 of file NetlistGenerator.cc.

2059 {
2060 switch (direction) {
2061 case HDB::IN:
2062 return IN;
2063 case HDB::OUT:
2064 return OUT;
2065 case HDB::BIDIR:
2066 return BIDIR;
2067 default:
2068 assert(false && "Unknown HDB::direction.");
2069 return IN;
2070 }
2071 }
@ BIDIR
Bidirectional port.
Definition ProGeTypes.hh:55

References assert, HDB::BIDIR, ProGe::BIDIR, HDB::IN, ProGe::IN, HDB::OUT, and ProGe::OUT.

Referenced by addBaseRFToNetlist(), addFUExternalPortsToNetlist(), and addFUToNetlist().

◆ ttaCore()

NetlistBlock & ProGe::NetlistGenerator::ttaCore ( ) const

Returns the TTA core block in the netlist.

Returns
The TTA core block.
Exceptions
InstanceNotFoundIf there is no instruction decoder in the netlist.

Definition at line 584 of file NetlistGenerator.cc.

584 {
585 if (coreBlock_ == NULL) {
586 throw InstanceNotFound(__FILE__, __LINE__, __func__,
587 "Cannot find TTA core block from the netlist.");
588 }
589 return *coreBlock_;
590 }

References __func__, and coreBlock_.

Friends And Related Symbol Documentation

◆ GeneratableFUNetlistBlock

friend class GeneratableFUNetlistBlock
friend

Definition at line 85 of file NetlistGenerator.hh.

Referenced by addGeneratableFUsToNetlist().

Member Data Documentation

◆ ADDR_WIDTH

const std::string ProGe::NetlistGenerator::ADDR_WIDTH
static

Definition at line 152 of file NetlistGenerator.hh.

◆ clkPorts_

PortPurposeMap ProGe::NetlistGenerator::clkPorts_
private

Maps clock ports.

Definition at line 258 of file NetlistGenerator.hh.

Referenced by clkPort(), and mapClockPort().

◆ context_

const ProGeContext& ProGe::NetlistGenerator::context_
private

◆ coreBlock_

NetlistBlock* ProGe::NetlistGenerator::coreBlock_
private

The TTA core block.

Definition at line 274 of file NetlistGenerator.hh.

Referenced by generate(), and ttaCore().

◆ DECODER_CLOCK_PORT

const std::string ProGe::NetlistGenerator::DECODER_CLOCK_PORT = CLOCK_PORT_NAME
static

◆ DECODER_INSTR_WORD_PORT

const std::string ProGe::NetlistGenerator::DECODER_INSTR_WORD_PORT
static
Initial value:

Instruction word port name in instruction decoder.

Definition at line 128 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), DefaultDecoderGenerator::writeInstructionDismembering(), and DefaultDecoderGenerator::writeInstructionTemplateProcedures().

◆ DECODER_LOCK_REQ_IN_PORT

const std::string ProGe::NetlistGenerator::DECODER_LOCK_REQ_IN_PORT
static

◆ DECODER_LOCK_REQ_OUT_PORT

const std::string ProGe::NetlistGenerator::DECODER_LOCK_REQ_OUT_PORT
static
Initial value:

Lock request out port name in instruction decoder.

Definition at line 140 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), DefaultDecoderGenerator::writeGlockMapping(), and DefaultDecoderGenerator::writeInstructionDecoder().

◆ DECODER_LOCK_STATUS_PORT

const std::string ProGe::NetlistGenerator::DECODER_LOCK_STATUS_PORT
static
Initial value:

Definition at line 144 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and DefaultDecoderGenerator::writeGlockMapping().

◆ DECODER_PC_LOAD_PORT

const std::string ProGe::NetlistGenerator::DECODER_PC_LOAD_PORT
static
Initial value:

PC load port name in instruction decoder.

Definition at line 136 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and DefaultDecoderGenerator::writeControlRegisterMappings().

◆ DECODER_PC_OPCODE_PORT

const std::string ProGe::NetlistGenerator::DECODER_PC_OPCODE_PORT
static
Initial value:

PC opcode port name in instruction decoder.

Definition at line 138 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), DefaultDecoderGenerator::opcodeWidth(), and DefaultDecoderGenerator::writeControlRegisterMappings().

◆ DECODER_RA_LOAD_PORT

const std::string ProGe::NetlistGenerator::DECODER_RA_LOAD_PORT
static
Initial value:

RA load port name in instruction decoder.

Definition at line 134 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and DefaultDecoderGenerator::writeControlRegisterMappings().

◆ DECODER_RESET_PORT

const std::string ProGe::NetlistGenerator::DECODER_RESET_PORT = RESET_PORT_NAME
static

◆ DECOMP_GLOCK_PORT

const std::string ProGe::NetlistGenerator::DECOMP_GLOCK_PORT
static
Initial value:

Global lock out port name in decompressor.

Definition at line 148 of file NetlistGenerator.hh.

◆ DECOMP_INSTR_WORD_PORT

const std::string ProGe::NetlistGenerator::DECOMP_INSTR_WORD_PORT
static
Initial value:

Instruction word port name in decompressor.

Definition at line 150 of file NetlistGenerator.hh.

◆ DECOMP_LOCK_REQ_IN_PORT

const std::string ProGe::NetlistGenerator::DECOMP_LOCK_REQ_IN_PORT
static
Initial value:

Lock request in port name in decompressor.

Definition at line 146 of file NetlistGenerator.hh.

◆ FETCHBLOCK_PORT_NAME

const std::string ProGe::NetlistGenerator::FETCHBLOCK_PORT_NAME = "fetchblock"
static

◆ fuEntryMap_

FUEntryMap ProGe::NetlistGenerator::fuEntryMap_
private

Maps FU implementations for different FU's.

Definition at line 282 of file NetlistGenerator.hh.

Referenced by addFUToNetlist(), fuEntry(), and ~NetlistGenerator().

◆ fuGuardPortMap_

PortRelationMap ProGe::NetlistGenerator::fuGuardPortMap_
private

Maps FU guard ports.

Definition at line 268 of file NetlistGenerator.hh.

Referenced by fuGuardPort(), and mapFUGuardPort().

◆ fuOpcodePorts_

PortPurposeMap ProGe::NetlistGenerator::fuOpcodePorts_
private

Maps FU opcode ports.

Definition at line 270 of file NetlistGenerator.hh.

Referenced by fuOpcodePort(), and mapFUOpcodePort().

◆ glockPorts_

PortPurposeMap ProGe::NetlistGenerator::glockPorts_
private

Maps global lock ports.

Definition at line 264 of file NetlistGenerator.hh.

Referenced by glockPort(), hasGlockPort(), and mapGlobalLockPort().

◆ glockReqPorts_

PortPurposeMap ProGe::NetlistGenerator::glockReqPorts_
private

Maps global lock request ports.

Definition at line 266 of file NetlistGenerator.hh.

Referenced by glockReqPort(), hasGlockReqPort(), and mapGlobalLockRequestPort().

◆ instructionDecoder_

NetlistBlock* ProGe::NetlistGenerator::instructionDecoder_
private

The instruction decoder block.

Definition at line 276 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and instructionDecoder().

◆ instructionDecompressor_

NetlistBlock* ProGe::NetlistGenerator::instructionDecompressor_
private

The instruction decompressor block.

Definition at line 278 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and instructionDecompressor().

◆ instructionFetch_

NetlistBlock* ProGe::NetlistGenerator::instructionFetch_
private

The instruction fetch block.

Definition at line 280 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and instructionFetch().

◆ iuPortMap_

IUPortMap ProGe::NetlistGenerator::iuPortMap_
private

Maps the created netlist ports to immediate units.

Definition at line 272 of file NetlistGenerator.hh.

Referenced by immediateUnitWritePort(), and mapImmediateUnitWritePort().

◆ loadPortMap_

PortRelationMap ProGe::NetlistGenerator::loadPortMap_
private

Maps loads ports.

Definition at line 254 of file NetlistGenerator.hh.

Referenced by loadPort(), and mapLoadPort().

◆ plugin_

ICDecoderGeneratorPlugin& ProGe::NetlistGenerator::plugin_
private

The generator plugin.

Definition at line 248 of file NetlistGenerator.hh.

Referenced by generate().

◆ portCorrespondenceMap_

PortCorrespondenceMap ProGe::NetlistGenerator::portCorrespondenceMap_
private

Maps the ADF ports to the netlist ports.

Definition at line 250 of file NetlistGenerator.hh.

Referenced by addBaseRFToNetlist(), mapNetlistPort(), netlistPort(), and netlistPortIsMapped().

◆ raInPort_

NetlistPort* ProGe::NetlistGenerator::raInPort_
private

Return address in port in GCU (ifetch).

Definition at line 286 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and gcuReturnAddressInPort().

◆ raOutPort_

NetlistPort* ProGe::NetlistGenerator::raOutPort_
private

Returns address out port in GCU (ifetch).

Definition at line 288 of file NetlistGenerator.hh.

Referenced by addGCUToNetlist(), and gcuReturnAddressOutPort().

◆ rfEntryMap_

RFEntryMap ProGe::NetlistGenerator::rfEntryMap_
private

Maps RF implementations for different RF's.

Definition at line 284 of file NetlistGenerator.hh.

Referenced by addBaseRFToNetlist(), rfEntry(), and ~NetlistGenerator().

◆ rfGuardPorts_

PortPurposeMap ProGe::NetlistGenerator::rfGuardPorts_
private

Maps RF guard ports.

Definition at line 262 of file NetlistGenerator.hh.

Referenced by mapRFGuardPort(), and rfGuardPort().

◆ rfOpcodePortMap_

PortRelationMap ProGe::NetlistGenerator::rfOpcodePortMap_
private

Maps opcode ports.

Definition at line 256 of file NetlistGenerator.hh.

Referenced by hasOpcodePort(), mapRFOpcodePort(), and rfOpcodePort().

◆ rstPorts_

PortPurposeMap ProGe::NetlistGenerator::rstPorts_
private

Maps reset ports.

Definition at line 260 of file NetlistGenerator.hh.

Referenced by mapResetPort(), and rstPort().

◆ unitCorrespondenceMap_

UnitCorrespondenceMap ProGe::NetlistGenerator::unitCorrespondenceMap_
private

Maps the ADF units to the netlist blocks.

Definition at line 252 of file NetlistGenerator.hh.

Referenced by mapNetlistBlock(), and netlistBlock().


The documentation for this class was generated from the following files: