OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DefaultICDecoderGenerator Class Reference
Inheritance diagram for DefaultICDecoderGenerator:
Inheritance graph
Collaboration diagram for DefaultICDecoderGenerator:
Collaboration graph

Public Member Functions

 DefaultICDecoderGenerator (const TTAMachine::Machine &machine, const BinaryEncoding &bem)
 
virtual ~DefaultICDecoderGenerator ()
 
virtual void completeNetlist (NetlistBlock &netlistBlock, const NetlistGenerator &generator)
 
void addRV32MicroCode (NetlistBlock &netlistBlock, const NetlistGenerator &generator)
 
void generateDebuggerCode (const NetlistGenerator &generator)
 
void addDummyIfetchDebugPorts (const NetlistGenerator &generator)
 
virtual void generate (HDL language, const std::string &dstDirectory, const NetlistGenerator &generator, const IDF::MachineImplementation &implementation, const std::string &entityString)
 
virtual std::set< int > requiredRFLatencies (const TTAMachine::ImmediateUnit &iu) const
 
virtual void verifyCompatibility () const
 
- Public Member Functions inherited from ProGe::ICDecoderGeneratorPlugin
 ICDecoderGeneratorPlugin (const TTAMachine::Machine &machine, const BinaryEncoding &bem, const std::string &description)
 
virtual ~ICDecoderGeneratorPlugin ()
 
std::string pluginDescription () const
 
int recognizedParameterCount () const
 
std::string recognizedParameter (int index) const
 
std::string parameterDescription (const std::string &paramName) const
 
void setParameter (const std::string &name, const std::string &value)
 
const TTAMachine::Machinemachine () const
 
const BinaryEncodingbem () const
 

Private Member Functions

virtual void writeGlobalDefinitions (HDL language, std::ostream &pkgStream) const
 
bool generateDebugger (bool minimal=true) const
 
bool generateBusTrace () const
 
bool hasSynchronousReset () const
 
bool generateLockTrace () const
 
bool bypassInstructionRegister () const
 
int busTraceStartingCycle () const
 
int lockTraceStartingCycle () const
 
bool generateNoSelfLockingFUs () const
 
void addInstructioRegisterBypass (HDL language, const NetlistGenerator &generator)
 
int calculateSupportedDelaySlots () const
 
void readParameters ()
 

Static Private Member Functions

static std::string vhdlDirection (ProGe::Direction direction)
 
static int dataPortWidth (const TTAMachine::Socket &socket)
 

Private Attributes

NetlistBlockdbsmBlock
 
DefaultICGeneratoricGenerator_
 
DefaultDecoderGeneratordecoderGenerator_
 
const TTAMachine::Machinettamachine_
 
const BinaryEncodingbem_
 

Additional Inherited Members

- Protected Member Functions inherited from ProGe::ICDecoderGeneratorPlugin
void addParameter (const std::string &name, const std::string &description)
 
bool hasParameterSet (const std::string &name) const
 
std::string parameterValue (const std::string &name) const
 
- Static Protected Member Functions inherited from ProGe::ICDecoderGeneratorPlugin
static TTAMachine::Socket::Direction convertDirection (HDB::Direction direction)
 

Detailed Description

Default implementation for IC/decoder generator.

Definition at line 929 of file DefaultICDecoderPlugin.cc.

Constructor & Destructor Documentation

◆ DefaultICDecoderGenerator()

DefaultICDecoderGenerator::DefaultICDecoderGenerator ( const TTAMachine::Machine machine,
const BinaryEncoding bem 
)
inline

Definition at line 931 of file DefaultICDecoderPlugin.cc.

934 dbsmBlock(NULL),
935 icGenerator_(NULL),
936 decoderGenerator_(NULL),
938 bem_(bem) {
941 "Generates wires to the internal hardware debugger if "
942 "the value is '" + GENERATE_DEBUGGER_PARAM_INTERNAL
943 + "', and to the external debugger if the value is '"
944 + GENERATE_DEBUGGER_PARAM_EXTERNAL + "'. A minimal set of wires, "
945 "for softreset and break, are added if the value is '"
949 "Generates code that prints bus trace if the value is '" +
950 ENABLE_FEATURE + "'.");
953 "The first cycle for which the bus trace is printed.");
956 "Generates code that prints global lock trace if the value is"
957 " '" +
958 ENABLE_FEATURE + "'.");
961 "The first cycle for which the global lock trace is printed. "
962 "If value is \"" + BUS_TRACE_STARTING_CYCLE + "\" then the "
963 "value is inherited from " + BUS_TRACE_STARTING_CYCLE + ".");
966 "-1 delay slot by removing instruction fetch register. "
967 "'" +
968 ENABLE_FEATURE + "' to enable the feature.");
969
973 }
const std::string GENERATE_DEBUGGER_PARAM_MINIMAL
const std::string GENERATE_BUS_TRACE_PARAM
const std::string BUS_TRACE_STARTING_CYCLE
const std::string ENABLE_FEATURE
const std::string GENERATE_DEBUGGER_PARAM
const std::string GENERATE_DEBUGGER_PARAM_EXTERNAL
const std::string GENERATE_LOCK_TRACE_PARAM
const std::string LOCK_TRACE_STARTING_CYCLE
const std::string PLUGIN_DESCRIPTION
const std::string BYPASS_FETCHBLOCK_REG_PARAM
const std::string GENERATE_DEBUGGER_PARAM_INTERNAL
DefaultDecoderGenerator * decoderGenerator_
const TTAMachine::Machine & ttamachine_
void addParameter(const std::string &name, const std::string &description)
const BinaryEncoding & bem() const
const TTAMachine::Machine & machine() const

References ProGe::ICDecoderGeneratorPlugin::addParameter(), ProGe::ICDecoderGeneratorPlugin::bem(), BUS_TRACE_STARTING_CYCLE, BYPASS_FETCHBLOCK_REG_PARAM, decoderGenerator_, ENABLE_FEATURE, GENERATE_BUS_TRACE_PARAM, GENERATE_DEBUGGER_PARAM, GENERATE_DEBUGGER_PARAM_EXTERNAL, GENERATE_DEBUGGER_PARAM_INTERNAL, GENERATE_DEBUGGER_PARAM_MINIMAL, GENERATE_LOCK_TRACE_PARAM, icGenerator_, LOCK_TRACE_STARTING_CYCLE, and ProGe::ICDecoderGeneratorPlugin::machine().

Here is the call graph for this function:

◆ ~DefaultICDecoderGenerator()

virtual DefaultICDecoderGenerator::~DefaultICDecoderGenerator ( )
inlinevirtual

Definition at line 975 of file DefaultICDecoderPlugin.cc.

975 {
976 delete icGenerator_;
977 delete decoderGenerator_;
978 }

References decoderGenerator_, and icGenerator_.

Member Function Documentation

◆ addDummyIfetchDebugPorts()

void DefaultICDecoderGenerator::addDummyIfetchDebugPorts ( const NetlistGenerator generator)
inline

Definition at line 1370 of file DefaultICDecoderPlugin.cc.

1370 {
1371 NetlistBlock* fetchBlock = &generator.instructionFetch();
1372 // Connect ifetch debug ports
1373 NetlistPort* ifetchDebugLockRqPort = new NetlistPort(
1374 "db_lockreq", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1375 ifetchDebugLockRqPort->setToStatic(ProGe::StaticSignal::GND);
1376 NetlistPort* ifetchDebugResetPort = new NetlistPort(
1377 "db_rstx", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1378 ifetchDebugResetPort->setToStatic(ProGe::StaticSignal::VCC);
1379 new NetlistPort(
1380 "db_pc", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT,
1381 *fetchBlock);
1382 new NetlistPort(
1383 "db_pc_next", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT,
1384 *fetchBlock);
1385 new NetlistPort(
1386 "db_cyclecnt", "32", 32, ProGe::BIT_VECTOR, ProGe::OUT,
1387 *fetchBlock);
1388 new NetlistPort(
1389 "db_lockcnt", "32", 32, ProGe::BIT_VECTOR, ProGe::OUT,
1390 *fetchBlock);
1391 }
NetlistBlock & instructionFetch() const
void setToStatic(StaticSignal value) const
@ GND
All port signals set to low.
@ VCC
All port signals set to high.
@ 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

References ProGe::BIT, ProGe::BIT_VECTOR, ProGe::StaticSignal::GND, ProGe::IN, ProGe::NetlistGenerator::instructionFetch(), ProGe::OUT, ProGe::NetlistPort::setToStatic(), and ProGe::StaticSignal::VCC.

Here is the call graph for this function:

◆ addInstructioRegisterBypass()

void DefaultICDecoderGenerator::addInstructioRegisterBypass ( HDL  language,
const NetlistGenerator generator 
)
inlineprivate

Enables instruction register bypass feature in the instruction fetch block.

Definition at line 1835 of file DefaultICDecoderPlugin.cc.

1836 {
1837 assert(
1839 "Instruction register by pass only implemented for RISC-V");
1840
1841 // Todo: remove when this feature is added to debugger-fetch.
1842 assert(
1843 !generateDebugger() &&
1844 "addInstructionRegisterBypass(): "
1845 "debugger does not support Instruction Register Bypass "
1846 "feature yet.");
1847
1848 NetlistBlock* ifetchBlock = &generator.instructionFetch();
1849
1850 if (language == ProGe::VHDL) {
1851 ifetchBlock->setParameter(
1852 "bypass_fetchblock_register", "boolean", "true");
1853 } else if (language == ProGe::Verilog) {
1854 // Todo
1855 assert(
1856 false &&
1857 "Verilog version of instruction register bypass "
1858 "not implemented.");
1859 } else {
1860 assert(false && "Unknown HDL choice.");
1861 }
1862 }
#define assert(condition)
bool generateDebugger(bool minimal=true) const
void setParameter(const std::string &name, const std::string &type, const std::string &value)
bool isRISCVMachine() const
Definition Machine.cc:1057
@ Verilog
Verilog.
Definition ProGeTypes.hh:42
@ VHDL
VHDL.
Definition ProGeTypes.hh:41

References assert, generateDebugger(), ProGe::NetlistGenerator::instructionFetch(), TTAMachine::Machine::isRISCVMachine(), ProGe::NetlistBlock::setParameter(), ttamachine_, ProGe::Verilog, and ProGe::VHDL.

Referenced by generate().

Here is the call graph for this function:

◆ addRV32MicroCode()

void DefaultICDecoderGenerator::addRV32MicroCode ( NetlistBlock netlistBlock,
const NetlistGenerator generator 
)
inline

Definition at line 1004 of file DefaultICDecoderPlugin.cc.

1005 {
1006 NetlistBlock& decompressor = generator.instructionDecompressor();
1007 NetlistBlock& decoder = generator.instructionDecoder();
1008 NetlistBlock& ifetch = generator.instructionFetch();
1009 Netlist& netlist = netlistBlock.netlist();
1010
1011 // Change port width to 32 to match socket width
1012 ifetch.port("pc_in")->setWidthFormula("32");
1013
1014 NetlistBlock* microCodeBlock = new NetlistBlock(
1015 "rv32_microcode_wrapper", "rv32_microcode_wrapper_i");
1016
1017 // Adds the block to the netlist
1018 netlistBlock.addSubBlock(microCodeBlock);
1019
1020 NetlistPort* decoderRISCVSimmPort = new NetlistPort(
1022 ProGe::BIT_VECTOR, ProGe::IN, decoder);
1023
1024 NetlistPort* clk = new NetlistPort(
1025 "clk", "1", ProGe::BIT, ProGe::IN, *microCodeBlock);
1026
1027 NetlistPort* rst = new NetlistPort(
1028 "rstx", "1", ProGe::BIT, ProGe::IN, *microCodeBlock);
1029
1030 NetlistPort* glock = new NetlistPort(
1031 "glock_in", "1", ProGe::BIT, ProGe::IN, *microCodeBlock);
1032
1033 netlist.connect(
1035
1036 netlist.connect(*clk, generator.clkPort(netlistBlock));
1037
1038 netlist.connect(*rst, generator.rstPort(netlistBlock));
1039
1040 NetlistPort* instructionOut = new NetlistPort(
1041 "instruction_out", "INSTRUCTIONWIDTH", BIT_VECTOR, ProGe::OUT,
1042 *microCodeBlock);
1043
1044 NetlistPort* microCodeImmOut = new NetlistPort(
1046 *microCodeBlock);
1047
1048 NetlistPort* instructionIn = new NetlistPort(
1049 "instruction_in", "IMEMWIDTHINMAUS*IMEMMAUWIDTH", BIT_VECTOR,
1050 ProGe::IN, *microCodeBlock);
1051
1052 netlist.connect(*microCodeImmOut, *decoderRISCVSimmPort);
1053
1054 netlist.disconnectPorts(
1057
1058 netlist.connect(
1059 *instructionOut,
1061
1062 netlist.connect(
1064 *instructionIn);
1065
1067 ->setWidthFormula("INSTRUCTIONWIDTH");
1068
1069 NetlistPort* ifetchStallPortIFetch = new NetlistPort(
1071
1072 NetlistPort* ifetchStallPortMicroCode = new NetlistPort(
1074 *microCodeBlock);
1075
1076 NetlistPort* rvJumpPortMicroCode = new NetlistPort(
1077 "rv_jump", "1", ProGe::BIT, ProGe::OUT, *microCodeBlock);
1078
1079 NetlistPort* rvAuipcPortMicroCode = new NetlistPort(
1080 "rv_auipc", "1", ProGe::BIT, ProGe::OUT, *microCodeBlock);
1081
1082 NetlistPort* rvOffsetPortMicroCode = new NetlistPort(
1083 "rv_offset", "32", BIT_VECTOR, ProGe::OUT, *microCodeBlock);
1084
1085 NetlistPort* rvOffsetPortIfetch =
1086 new NetlistPort("rv_offset", "32", BIT_VECTOR, ProGe::IN, ifetch);
1087
1088 NetlistPort* rvJumpPortIfetch =
1089 new NetlistPort("rv_jump", "1", ProGe::BIT, ProGe::IN, ifetch);
1090
1091 NetlistPort* rvAuipcPortIfetch =
1092 new NetlistPort("rv_auipc", "1", ProGe::BIT, ProGe::IN, ifetch);
1093
1094 netlist.connect(*rvJumpPortMicroCode, *rvJumpPortIfetch);
1095 netlist.connect(*rvAuipcPortMicroCode, *rvAuipcPortIfetch);
1096 netlist.connect(*rvOffsetPortMicroCode, *rvOffsetPortIfetch);
1097
1098 netlist.connect(*ifetchStallPortMicroCode, *ifetchStallPortIFetch);
1099 }
const std::string RISCV_SIMM_PORT_OUT_NAME
const std::string IFETCH_STALL_PORT_NAME
static const std::string RISCV_SIMM_PORT_IN_NAME
static const std::string GLOCK_PORT_NAME
void addSubBlock(BaseNetlistBlock *subBlock, const std::string &instanceName="")
virtual NetlistPort * port(const std::string &portName, bool partialMatch=true)
virtual const Netlist & netlist() const
NetlistPort & rstPort(const NetlistBlock &block) const
static const std::string FETCHBLOCK_PORT_NAME
NetlistBlock & instructionDecompressor() const
NetlistBlock & instructionDecoder() const
NetlistPort & clkPort(const NetlistBlock &block) const
void setWidthFormula(const std::string &newFormula)
bool connect(const NetlistPort &port1, const NetlistPort &port2, int port1FirstBit, int port2FirstBit, int width=1)
Definition Netlist.cc:83
void disconnectPorts(const NetlistPort &port1, const NetlistPort &port2)
Definition Netlist.cc:135

References ProGe::NetlistBlock::addSubBlock(), ProGe::BIT, ProGe::BIT_VECTOR, ProGe::NetlistGenerator::clkPort(), ProGe::Netlist::connect(), ProGe::Netlist::disconnectPorts(), ProGe::NetlistGenerator::FETCHBLOCK_PORT_NAME, DefaultDecoderGenerator::GLOCK_PORT_NAME, IFETCH_STALL_PORT_NAME, ProGe::IN, ProGe::NetlistGenerator::instructionDecoder(), ProGe::NetlistGenerator::instructionDecompressor(), ProGe::NetlistGenerator::instructionFetch(), ProGe::NetlistBlock::netlist(), ProGe::OUT, ProGe::NetlistBlock::port(), DefaultDecoderGenerator::RISCV_SIMM_PORT_IN_NAME, RISCV_SIMM_PORT_OUT_NAME, ProGe::NetlistGenerator::rstPort(), and ProGe::NetlistPort::setWidthFormula().

Referenced by completeNetlist().

Here is the call graph for this function:

◆ busTraceStartingCycle()

int DefaultICDecoderGenerator::busTraceStartingCycle ( ) const
inlineprivate

Returns the starting cycle to be written to the bus trace given as parameter.

Returns
The starting cycle.

Definition at line 1740 of file DefaultICDecoderPlugin.cc.

1740 {
1742 return 0;
1743 } else {
1744 string paramValue = parameterValue(BUS_TRACE_STARTING_CYCLE);
1745 try {
1746 unsigned int cycle = Conversion::toUnsignedInt(paramValue);
1747 return cycle;
1748 } catch (const Exception&) {
1749 return 0;
1750 }
1751 }
1752 }
static unsigned int toUnsignedInt(const T &source)
std::string parameterValue(const std::string &name) const
bool hasParameterSet(const std::string &name) const

References BUS_TRACE_STARTING_CYCLE, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), ProGe::ICDecoderGeneratorPlugin::parameterValue(), and Conversion::toUnsignedInt().

Referenced by generate(), lockTraceStartingCycle(), and readParameters().

Here is the call graph for this function:

◆ bypassInstructionRegister()

bool DefaultICDecoderGenerator::bypassInstructionRegister ( ) const
inlineprivate

Tells whether instruction register should be left generated (true).

Definition at line 1721 of file DefaultICDecoderPlugin.cc.

1721 {
1723 return false;
1724 } else {
1725 string paramValue = parameterValue(BYPASS_FETCHBLOCK_REG_PARAM);
1726 if (paramValue == BYPASS_FETCHBLOCK_REG_PARAM_YES) {
1727 return true;
1728 } else {
1729 return false;
1730 }
1731 }
1732 }
const std::string BYPASS_FETCHBLOCK_REG_PARAM_YES

References BYPASS_FETCHBLOCK_REG_PARAM, BYPASS_FETCHBLOCK_REG_PARAM_YES, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), and ProGe::ICDecoderGeneratorPlugin::parameterValue().

Referenced by calculateSupportedDelaySlots(), and generate().

Here is the call graph for this function:

◆ calculateSupportedDelaySlots()

int DefaultICDecoderGenerator::calculateSupportedDelaySlots ( ) const
inlineprivate

Return number of required delay slots. By default the number is three but can be reduced or increased by options.

Definition at line 1869 of file DefaultICDecoderPlugin.cc.

1869 {
1870 int delaySlots = 3;
1872 delaySlots -= 1;
1873 }
1874 return delaySlots;
1875 }

References bypassInstructionRegister().

Referenced by verifyCompatibility().

Here is the call graph for this function:

◆ completeNetlist()

virtual void DefaultICDecoderGenerator::completeNetlist ( NetlistBlock netlistBlock,
const NetlistGenerator generator 
)
inlinevirtual

Completes the given netlist by adding IC block and completing the decoder block by adding the ports connected to IC. Connects also IC to all the units in the machine.

Parameters
Thenetlist to complete.
generatorThe netlist generator which generated the netlist.

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 989 of file DefaultICDecoderPlugin.cc.

990 {
991 // add interconnection network to the netlist and connect it to the
992 // units
993 icGenerator_->addICToNetlist(generator, netlistBlock);
994
995 // complete the decoder block and connect it to the IC and units
996 decoderGenerator_->completeDecoderBlock(generator, netlistBlock);
997
999 addRV32MicroCode(netlistBlock, generator);
1000 }
1001 }
void completeDecoderBlock(const ProGe::NetlistGenerator &nlGenerator, ProGe::NetlistBlock &coreBlock)
void addRV32MicroCode(NetlistBlock &netlistBlock, const NetlistGenerator &generator)
void addICToNetlist(const ProGe::NetlistGenerator &generator, ProGe::NetlistBlock &netlistBlock)

References DefaultICGenerator::addICToNetlist(), addRV32MicroCode(), DefaultDecoderGenerator::completeDecoderBlock(), decoderGenerator_, icGenerator_, TTAMachine::Machine::isRISCVMachine(), and ttamachine_.

Here is the call graph for this function:

◆ dataPortWidth()

static int DefaultICDecoderGenerator::dataPortWidth ( const TTAMachine::Socket socket)
inlinestaticprivate

Calculates the data port width of the given socket.

Parameters
socketThe socket.
Returns
The width of the data port.

Definition at line 1818 of file DefaultICDecoderPlugin.cc.

1818 {
1819 int ports = socket.portCount();
1820 int width(0);
1821 for (int i = 0; i < ports; i++) {
1822 Port* port = socket.port(i);
1823 if (port->width() > width) {
1824 width = port->width();
1825 }
1826 }
1827 return width;
1828 }
virtual int width() const =0
Port * port(int index) const
Definition Socket.cc:266
int portCount() const

References TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), and TTAMachine::Port::width().

Here is the call graph for this function:

◆ generate()

virtual void DefaultICDecoderGenerator::generate ( HDL  language,
const std::string &  dstDirectory,
const NetlistGenerator generator,
const IDF::MachineImplementation implementation,
const std::string &  entityString 
)
inlinevirtual

Generates the interconnection network and instruction decoder to the given destination directory.

Parameters
dstDirectoryThe destination directory.
generatorThe netlist generator that generated the netlist.

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 1401 of file DefaultICDecoderPlugin.cc.

1405 {
1406 const string DS = FileSystem::DIRECTORY_SEPARATOR;
1407 const string templateDir = Environment::dataDirPath("ProGe");
1408
1409 BlockSourceCopier copier(implementation, entityString, language);
1411 MachineInfo::getOpset(*generator.context().adf().controlUnit());
1412 Path proGeDataDir(Environment::dataDirPath("ProGe"));
1413 HDLTemplateInstantiator& instantiator =
1414 copier.getTemplateInstatiator();
1415
1417 instantiator.replacePlaceholder(
1418 "ifetch-stall-cond",
1419 " and " + IFETCH_STALL_PORT_NAME + " = '0'");
1420 instantiator.replacePlaceholder(
1421 "ifetch-stall-port-declarations",
1422 IFETCH_STALL_PORT_NAME + " : in std_logic;");
1423
1424 ProGe::RV32MicroCodeGenerator* microCodeGen =
1425 new RV32MicroCodeGenerator(ttamachine_, bem_, entityString);
1426 microCodeGen->setBypassInstructionRegister(
1428 microCodeGen->generateRTL(instantiator, dstDirectory);
1429 }
1430
1431 if (generateBusTrace()) {
1434 } else {
1436 }
1437
1438 try {
1439 // Check for illegal combinations in fetch/decode unit options
1440
1441 if (!generateDebugger()) {
1442 // Signal declarations as a stand-in for debug ports
1443 instantiator.replacePlaceholderFromFile(
1444 "db-signal-declarations",
1445 proGeDataDir /
1446 std::string("no_debug_signal_declaration.snippet"));
1447 }
1448
1449 if (hasSynchronousReset()) {
1450 if (language == VHDL) {
1451 generator.instructionFetch().setParameter(
1452 "sync_reset_g", "boolean", "true");
1453 instantiator.replacePlaceholder("sync-waitlist", "clk");
1454 } else { // language == Verilog
1455 instantiator.replacePlaceholder(
1456 "update-condition", "always@(posedge clk)");
1457 }
1458 } else {
1459 if (language == VHDL) {
1460 instantiator.replacePlaceholder(
1461 "sync-waitlist", "clk, rstx");
1462 } else { // language == Verilog
1463 instantiator.replacePlaceholder(
1464 "update-condition",
1465 "always@(posedge clk or negedge rstx)");
1466 }
1467 }
1468
1471 if (language == VHDL) {
1472 generator.instructionFetch().setParameter(
1473 "no_glock_loopback_g", "std_logic", "'1'");
1474 } // todo verilog version
1475 }
1476
1477 // Set the pc opcode port width
1478 std::size_t reqOpcodeWidth =
1480 instantiator.replacePlaceholder(
1481 "pc-opcode-len", Conversion::toString(reqOpcodeWidth - 1));
1482
1483 instantiator.replacePlaceholderFromFile(
1484 "default-instr-reg-write",
1485 Path(
1486 proGeDataDir /
1487 std::string("default-instr-reg-write.snippet")));
1488
1489 // Next PC process sensitivity list
1490 std::string sensitivityStringPCBypassed =
1491 "pc_in, pc_reg, increased_pc ";
1492 std::string sensitivityStringPCNotBypassed = "";
1493 // Complete the default sensitivity list
1494 sensitivityStringPCBypassed += ",\n pc_load, pc_opcode";
1495 instantiator.replacePlaceholder( // This is bypassed too
1496 "pc-sensitivity-list-pc-bypass", sensitivityStringPCBypassed);
1497
1498 // Next PC signal assign condition
1499 std::string conditionString =
1500 "pc_load = '1' and ((unsigned(pc_opcode) = IFE_CALL or \n"
1501 " unsigned(pc_opcode) = IFE_JUMP))\n";
1502 instantiator.replacePlaceholder(
1503 "not-bypassed-next-pc-condition", conditionString);
1504
1505 if (generateDebugger()) { // DEBUGTODO
1506 if (language != VHDL) {
1507 std::string errorMsg =
1508 "Language not set to VHDL when HW debugger is in "
1509 "use.";
1510 throw Exception(__FILE__, __LINE__, __func__, errorMsg);
1511 }
1512
1513 generator.instructionFetch().setParameter(
1514 "debug_logic_g", "boolean", "true");
1517 instantiator.replacePlaceholderFromFile(
1518 "db-port-declarations",
1519 Path(
1520 proGeDataDir /
1521 std::string(
1522 "debug_minimal_port_declaration.snippet")));
1523 instantiator.replacePlaceholderFromFile(
1524 "db-signal-declarations",
1525 Path(
1526 proGeDataDir /
1527 std::string(
1528 "debug_minimal_signal_declaration.snippet")));
1529 } else {
1530 instantiator.replacePlaceholderFromFile(
1531 "db-port-declarations",
1532 Path(
1533 proGeDataDir /
1534 std::string("debug_port_declaration.snippet")));
1535 instantiator.replacePlaceholderFromFile(
1536 "db-signal-declarations",
1537 Path(
1538 proGeDataDir /
1539 std::string("debug_signal_declaration.snippet")));
1540 }
1541 copier.instantiateHDLTemplate(
1542 templateDir + DS + "ifetch." +
1543 (language == VHDL ? "vhdl" : "v") + ".tmpl",
1544 dstDirectory,
1545 std::string("ifetch.") +
1546 (language == VHDL ? "vhdl" : "v"));
1547 } else {
1548 copier.instantiateHDLTemplate(
1549 templateDir + DS + "ifetch." +
1550 (language == VHDL ? "vhdl" : "v") + ".tmpl",
1551 dstDirectory,
1552 std::string("ifetch.") +
1553 (language == VHDL ? "vhdl" : "v"));
1554 }
1555 } catch (const Exception& e) {
1557 }
1558
1560 if (language != VHDL) {
1561 std::string errorMsg =
1562 "Instruction register bypass is not supported for "
1563 "given HDL.";
1564 throw Exception(__FILE__, __LINE__, __func__, errorMsg);
1565 }
1566
1567 addInstructioRegisterBypass(language, generator);
1568 }
1569
1570 // generate the IC
1571 icGenerator_->SetHDL(language);
1573 // generate the decoder
1574 decoderGenerator_->SetHDL(language);
1575 decoderGenerator_->generateInstructionDecoder(generator, dstDirectory);
1576
1577 if (generateDebugger()) {
1578 if (language != VHDL) {
1579 std::string errorMsg =
1580 "Language not set to VHDL when HW debugger is in use.";
1581 throw Exception(__FILE__, __LINE__, __func__, errorMsg);
1582 } else {
1583 generateDebuggerCode(generator);
1584 }
1585 }
1587 copier.instantiateHDLTemplate(
1588 templateDir + DS + "rv32_ifetch.vhdl.tmpl", dstDirectory,
1589 "ifetch.vhdl");
1590 } else {
1591 copier.instantiateHDLTemplate(
1592 templateDir + DS + "ifetch.vhdl.tmpl", dstDirectory,
1593 "ifetch.vhdl");
1594 }
1595 }
#define __func__
#define abortWithError(message)
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
#define DS
static std::string toString(const T &source)
void SetHDL(ProGe::HDL language)
void generateInstructionDecoder(const ProGe::NetlistGenerator &nlGenerator, const std::string &dstDirectory)
void setGenerateNoLoopbackGlock(bool generate)
void generateDebuggerCode(const NetlistGenerator &generator)
void addInstructioRegisterBypass(HDL language, const NetlistGenerator &generator)
void setBusTraceStartingCycle(unsigned int cycle)
void setGenerateBusTrace(bool generate)
void SetHDL(ProGe::HDL language)
void generateInterconnectionNetwork(const std::string &dstDirectory)
static std::string dataDirPath(const std::string &prog)
std::string errorMessage() const
Definition Exception.cc:123
static const std::string DIRECTORY_SEPARATOR
void replacePlaceholderFromFile(const std::string &key, const Path &filePath, bool append=false)
void replacePlaceholder(const std::string &key, const std::string &replacer, bool append=false)
TCETools::CIStringSet OperationSet
static OperationSet getOpset(const TTAMachine::Machine &mach)
static size_t gcuOpcodeWidth(const TTAMachine::Machine &mach)
const ProGeContext & context() const
const TTAMachine::Machine & adf() const
void setBypassInstructionRegister(const bool &value)
void generateRTL(HDLTemplateInstantiator &instantiator, const std::string &fileDst)
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345

References __func__, abortWithError, addInstructioRegisterBypass(), ProGe::ProGeContext::adf(), bem_, busTraceStartingCycle(), bypassInstructionRegister(), ProGe::NetlistGenerator::context(), TTAMachine::Machine::controlUnit(), Environment::dataDirPath(), decoderGenerator_, FileSystem::DIRECTORY_SEPARATOR, DS, Exception::errorMessage(), ProGe::CUOpcodeGenerator::gcuOpcodeWidth(), GENERATE_DEBUGGER_PARAM, GENERATE_DEBUGGER_PARAM_MINIMAL, generateBusTrace(), generateDebugger(), generateDebuggerCode(), DefaultDecoderGenerator::generateInstructionDecoder(), DefaultICGenerator::generateInterconnectionNetwork(), generateNoSelfLockingFUs(), ProGe::RV32MicroCodeGenerator::generateRTL(), MachineInfo::getOpset(), ProGe::BlockSourceCopier::getTemplateInstatiator(), hasSynchronousReset(), icGenerator_, IFETCH_STALL_PORT_NAME, implementation, ProGe::BlockSourceCopier::instantiateHDLTemplate(), ProGe::NetlistGenerator::instructionFetch(), TTAMachine::Machine::isRISCVMachine(), ProGe::ICDecoderGeneratorPlugin::parameterValue(), HDLTemplateInstantiator::replacePlaceholder(), HDLTemplateInstantiator::replacePlaceholderFromFile(), DefaultICGenerator::setBusTraceStartingCycle(), ProGe::RV32MicroCodeGenerator::setBypassInstructionRegister(), DefaultICGenerator::setGenerateBusTrace(), DefaultDecoderGenerator::setGenerateNoLoopbackGlock(), DefaultDecoderGenerator::SetHDL(), DefaultICGenerator::SetHDL(), ProGe::NetlistBlock::setParameter(), Conversion::toString(), ttamachine_, and ProGe::VHDL.

Here is the call graph for this function:

◆ generateBusTrace()

bool DefaultICDecoderGenerator::generateBusTrace ( ) const
inlineprivate

Tells whether IC generator should generate bus tracing code.

Returns
True if IC generator should generate the code.

Definition at line 1680 of file DefaultICDecoderPlugin.cc.

1680 {
1682 return false;
1683 } else {
1684 string paramValue = parameterValue(GENERATE_BUS_TRACE_PARAM);
1685 if (paramValue == GENERATE_BUS_TRACE_PARAM_YES) {
1686 return true;
1687 } else {
1688 return false;
1689 }
1690 }
1691 }
const std::string GENERATE_BUS_TRACE_PARAM_YES

References GENERATE_BUS_TRACE_PARAM, GENERATE_BUS_TRACE_PARAM_YES, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), and ProGe::ICDecoderGeneratorPlugin::parameterValue().

Referenced by generate(), and readParameters().

Here is the call graph for this function:

◆ generateDebugger()

bool DefaultICDecoderGenerator::generateDebugger ( bool  minimal = true) const
inlineprivate

Tells whether IC generator should generate debug interface code.

Returns
True if IC generator should generate the code.

Definition at line 1659 of file DefaultICDecoderPlugin.cc.

1659 {
1661 return false;
1662 } else {
1663 string paramValue = parameterValue(GENERATE_DEBUGGER_PARAM);
1664 if (paramValue == GENERATE_DEBUGGER_PARAM_YES ||
1665 paramValue == GENERATE_DEBUGGER_PARAM_INTERNAL ||
1666 paramValue == GENERATE_DEBUGGER_PARAM_EXTERNAL ||
1667 (paramValue == GENERATE_DEBUGGER_PARAM_MINIMAL && minimal)) {
1668 return true;
1669 } else {
1670 return false;
1671 }
1672 }
1673 }
const std::string GENERATE_DEBUGGER_PARAM_YES

References GENERATE_DEBUGGER_PARAM, GENERATE_DEBUGGER_PARAM_EXTERNAL, GENERATE_DEBUGGER_PARAM_INTERNAL, GENERATE_DEBUGGER_PARAM_MINIMAL, GENERATE_DEBUGGER_PARAM_YES, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), and ProGe::ICDecoderGeneratorPlugin::parameterValue().

Referenced by addInstructioRegisterBypass(), generate(), generateDebuggerCode(), and readParameters().

Here is the call graph for this function:

◆ generateDebuggerCode()

void DefaultICDecoderGenerator::generateDebuggerCode ( const NetlistGenerator generator)
inline

Definition at line 1101 of file DefaultICDecoderPlugin.cc.

1101 {
1102 assert(
1103 generateDebugger() &&
1104 "Entered debugger connection generation without cause.");
1105
1106 NetlistBlock* decoderBlock = &generator.instructionDecoder();
1107 NetlistBlock& toplevelBlock = decoderBlock->parentBlock();
1108 std::string addrWidthFormula = generator.gcuReturnAddressInPort()
1109 .widthFormula();
1110 NetlistBlock* fetchBlock = &generator.instructionFetch();
1111 NetlistBlock* icBlock = NULL;
1112
1113 bool is_external = false, is_internal = false, is_minimal = false;
1114
1117 is_external = true;
1120 is_minimal = true;
1121 } else {
1122 is_internal = true;
1123 }
1124
1125 for (std::size_t i = 0; i < toplevelBlock.subBlockCount(); i++) {
1126 icBlock = &toplevelBlock.subBlock(i);
1127 if (icBlock->instanceName() == "ic")
1128 break;
1129 if (icBlock->moduleName() == "ic")
1130 break;
1131 }
1132
1133 if (is_internal) {
1134 //Include debugger package with width constants in tta0.vhdl
1135 toplevelBlock.addPackage("debugger_if");
1136 }
1137
1138 NetlistPort* ttaResetPort = new NetlistPort(
1139 "db_tta_nreset", "1", BIT, ProGe::IN, toplevelBlock);
1140 NetlistPort *ttaLockcountPort = new NetlistPort("db_lockcnt",
1141 "64", ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1142 NetlistPort *ttaCyclecountPort = new NetlistPort("db_cyclecnt",
1143 "64", ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1144
1145 NetlistPort *ttaPCPort = new NetlistPort("db_pc",
1146 "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1147
1148 if (is_minimal || is_external) {
1149
1150 NetlistPort* dbGlockReqPort = new NetlistPort(
1151 "db_lockrq", "1", BIT, ProGe::IN, toplevelBlock);
1152
1153 // Connect to the highest bit of decoder lockrq vector, others are
1154 // already connected
1155 NetlistPort* decoderGlockReqPort =
1156 decoderBlock->port("lock_req");
1157 int bit = decoderGenerator_->glockRequestWidth()-1;
1158 toplevelBlock.netlist().connect(
1159 *dbGlockReqPort, *decoderGlockReqPort, 0, bit, 1);
1160
1161 // Connect ifetch debug ports
1162 NetlistPort* ifetchDebugResetPort = new NetlistPort(
1163 "db_rstx", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1164 toplevelBlock.netlist().connect(*ttaResetPort,
1165 *ifetchDebugResetPort);
1166
1167 NetlistPort* ifetchDebugLockRqPort = new NetlistPort(
1168 "db_lockreq", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1169 toplevelBlock.netlist().connect(*dbGlockReqPort,
1170 *ifetchDebugLockRqPort);
1171
1172 NetlistPort* ifetchCyclecountPort = new NetlistPort(
1173 "db_cyclecnt", "64", 64, ProGe::BIT_VECTOR, ProGe::OUT,
1174 *fetchBlock);
1175 toplevelBlock.netlist().connect(
1176 *ifetchCyclecountPort, *ttaCyclecountPort);
1177 NetlistPort* ifetchLockcountPort = new NetlistPort(
1178 "db_lockcnt", "64", 64, ProGe::BIT_VECTOR, ProGe::OUT,
1179 *fetchBlock);
1180 toplevelBlock.netlist().connect(
1181 *ifetchLockcountPort, *ttaLockcountPort);
1182
1183 NetlistPort* ifetchPCPort = new NetlistPort(
1184 "db_pc", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT,
1185 *fetchBlock);
1186 toplevelBlock.netlist().connect(*ifetchPCPort, *ttaPCPort);
1187 }
1188 if (!is_minimal) {
1189 //Add debugger interface ports to tta0 entity
1190 NetlistPort *ttaPCStartPort = new NetlistPort("db_pc_start",
1191 "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::IN, toplevelBlock);
1192 NetlistPort *ttaBustracePort = new NetlistPort("db_bustraces",
1193 "BUSTRACE_WIDTH", ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1194
1195 // Connect bustraces out and away
1196 NetlistPort* icBustracePort = icBlock->port("db_bustraces");
1197 assert(icBustracePort);
1198 toplevelBlock.netlist().connect(
1199 *icBustracePort, *ttaBustracePort);
1200
1201 if (is_external) {
1202 NetlistPort* dbPCNextPort = new NetlistPort(
1203 "db_pc_next", "IMEMADDRWIDTH",
1204 ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1205
1206 NetlistPort* ifetchPCStartPort = new NetlistPort(
1207 "db_pc_start", "IMEMADDRWIDTH", ProGe::BIT_VECTOR,
1208 ProGe::IN, *fetchBlock);
1209 toplevelBlock.netlist().connect(*ifetchPCStartPort,
1210 *ttaPCStartPort);
1211 NetlistPort* ifetchPCNextPort = new NetlistPort(
1212 "db_pc_next", "IMEMADDRWIDTH", ProGe::BIT_VECTOR,
1213 ProGe::OUT, *fetchBlock);
1214 toplevelBlock.netlist().connect(*ifetchPCNextPort,
1215 *dbPCNextPort);
1216
1217 } else if (is_internal) { // Generate internal debugger
1218 NetlistPort* ttaBpEnaPort = new NetlistPort(
1219 "db_bp_ena", "1+db_breakpoints",
1220 ProGe::BIT_VECTOR, ProGe::IN, toplevelBlock);
1221 NetlistPort* ttaBp0Port = new NetlistPort(
1222 "bp_target_cc", "db_breakpoints_cc*db_data_width",
1223 ProGe::BIT_VECTOR, ProGe::IN, toplevelBlock);
1224 NetlistPort* ttaBp41Port = new NetlistPort(
1225 "bp_target_pc", "db_breakpoints_pc*IMEMADDRWIDTH",
1227 toplevelBlock);
1228 NetlistPort* ttaBpHitPort = new NetlistPort(
1229 "db_bp_hit", "2+db_breakpoints",
1230 ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1231 NetlistPort* ttaContinuePort = new NetlistPort(
1232 "db_tta_continue", "1", BIT, ProGe::IN, toplevelBlock);
1233 NetlistPort* ttaForceBreakPort = new NetlistPort(
1234 "db_tta_forcebreak", "1", BIT, ProGe::IN, toplevelBlock);
1235 NetlistPort* ttaStdoutBreakPort = new NetlistPort(
1236 "db_tta_stdoutbreak", "1", BIT, ProGe::IN, toplevelBlock);
1237
1238 //Build and connect the debugger state machine block in tta0.vhdl
1239 dbsmBlock = new NetlistBlock("dbsm", "dbsm_1");
1240 toplevelBlock.addSubBlock(dbsmBlock);
1241
1242 dbsmBlock->setParameter("cyclecnt_width_g", "integer",
1243 "db_data_width");
1244 dbsmBlock->setParameter("pc_width_g", "integer",
1245 "IMEMADDRWIDTH");
1246
1247 NetlistPort* dbsmClkPort = new NetlistPort(
1248 "clk", "1", BIT, ProGe::IN, *dbsmBlock);
1249 toplevelBlock.netlist().connect(
1250 *dbsmClkPort, generator.clkPort(toplevelBlock));
1251
1252 NetlistPort* dbsmNresetPort = new NetlistPort(
1253 "nreset", "1", BIT, ProGe::IN, *dbsmBlock);
1254 toplevelBlock.netlist().connect(
1255 *dbsmNresetPort, generator.rstPort(toplevelBlock));
1256
1257 NetlistPort* dbsmBpEnaPort = new NetlistPort(
1258 "bp_ena", "1+db_breakpoints",
1260 toplevelBlock.netlist().connect(*ttaBpEnaPort, *dbsmBpEnaPort);
1261
1262 NetlistPort* dbsmBp0Port = new NetlistPort(
1263 "bp_target_cc", "db_breakpoints_cc*cyclecnt_width_g",
1266 toplevelBlock.netlist().connect(*ttaBp0Port, *dbsmBp0Port);
1267
1268 NetlistPort* dbsmCyclecountPort = new NetlistPort(
1269 "cyclecnt", "cyclecnt_width_g", ProGe::BIT_VECTOR,
1271
1272 NetlistPort* dbsmBp41Port = new NetlistPort(
1273 "bp_target_pc", "db_breakpoints_pc*IMEMADDRWIDTH",
1275 toplevelBlock.netlist().connect(*ttaBp41Port, *dbsmBp41Port);
1276
1277 NetlistPort* dbsmPCNextPort = new NetlistPort(
1278 "pc_next", "IMEMADDRWIDTH", ProGe::BIT_VECTOR,
1280
1281 NetlistPort* dbsmContinuePort = new NetlistPort(
1282 "tta_continue", "1", BIT, ProGe::IN, *dbsmBlock);
1283 toplevelBlock.netlist().connect(
1284 *ttaContinuePort, *dbsmContinuePort);
1285
1286 NetlistPort* dbsmForceBreakPort = new NetlistPort(
1287 "tta_forcebreak", "1", BIT, ProGe::IN, *dbsmBlock);
1288 toplevelBlock.netlist().connect(*ttaForceBreakPort,
1289 *dbsmForceBreakPort);
1290
1291 NetlistPort* dbsmStdoutBreakPort = new NetlistPort(
1292 "tta_stdoutbreak", "1", BIT, ProGe::IN, *dbsmBlock);
1293 toplevelBlock.netlist().connect(
1294 *ttaStdoutBreakPort, *dbsmStdoutBreakPort);
1295
1296 NetlistPort* dbsmBpHitPort = new NetlistPort(
1297 "bp_hit", "2+db_breakpoints",
1299 toplevelBlock.netlist().connect(*ttaBpHitPort, *dbsmBpHitPort);
1300
1301 NetlistPort* dbsmExtlockPort = new NetlistPort(
1302 "extlock", "1", BIT, ProGe::IN, *dbsmBlock);
1303 toplevelBlock.netlist().connect(
1304 *toplevelBlock.port("busy"), *dbsmExtlockPort);
1305
1306
1307 // Connect to the highest bit of decoder lockrq vector, others are
1308 // already connected
1309 NetlistPort* dbsmGlockReqPort = new NetlistPort(
1310 "bp_lockrq", "1", BIT, ProGe::OUT, *dbsmBlock);
1311 NetlistPort* decoderGlockReqPort =
1312 decoderBlock->port("lock_req");
1313 int bit = decoderGenerator_->glockRequestWidth()-1;
1314 toplevelBlock.netlist().connect(
1315 *dbsmGlockReqPort, *decoderGlockReqPort, 0, bit, 1);
1316
1317 // Connect ifetch debug ports
1318 NetlistPort* ifetchDebugLockRqPort = new NetlistPort(
1319 "db_lockreq", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1320 toplevelBlock.netlist().connect(*dbsmGlockReqPort,
1321 *ifetchDebugLockRqPort);
1322 NetlistPort* ifetchDebugResetPort = new NetlistPort(
1323 "db_rstx", "1", 1, ProGe::BIT, ProGe::IN, *fetchBlock);
1324 toplevelBlock.netlist().connect(*ttaResetPort,
1325 *ifetchDebugResetPort);
1326 NetlistPort* ifetchPCStartPort = new NetlistPort(
1327 "db_pc_start", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::IN,
1328 *fetchBlock);
1329 toplevelBlock.netlist().connect(*ifetchPCStartPort,
1330 *ttaPCStartPort);
1331 NetlistPort* ifetchPCPort = new NetlistPort(
1332 "db_pc", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT,
1333 *fetchBlock);
1334 toplevelBlock.netlist().connect(*ifetchPCPort, *ttaPCPort);
1335 NetlistPort* ifetchPCNextPort = new NetlistPort(
1336 "db_pc_next", "IMEMADDRWIDTH", ProGe::BIT_VECTOR, ProGe::OUT,
1337 *fetchBlock);
1338 toplevelBlock.netlist().connect(
1339 *ifetchPCNextPort, *dbsmPCNextPort);
1340 NetlistPort* ifetchCyclecountPort = new NetlistPort(
1341 "db_cyclecnt", "64", 64, ProGe::BIT_VECTOR, ProGe::OUT,
1342 *fetchBlock);
1343 toplevelBlock.netlist().connect(
1344 *ifetchCyclecountPort, *ttaCyclecountPort);
1345 toplevelBlock.netlist().connect(
1346 *ifetchCyclecountPort, *dbsmCyclecountPort);
1347 NetlistPort* ifetchLockcountPort = new NetlistPort(
1348 "db_lockcnt", "64", 64, ProGe::BIT_VECTOR, ProGe::OUT,
1349 *fetchBlock);
1350 toplevelBlock.netlist().connect(
1351 *ifetchLockcountPort, *ttaLockcountPort);
1352 NetlistPort *ttaInstrPort = new NetlistPort(
1353 "db_instr", "IMEMWIDTHINMAUS*IMEMMAUWIDTH",
1354 ProGe::BIT_VECTOR, ProGe::OUT, toplevelBlock);
1355 NetlistPort* ifetchFetchblockPort =
1356 fetchBlock->port("fetchblock");
1357 toplevelBlock.netlist().connect(
1358 *ifetchFetchblockPort, *ttaInstrPort);
1359
1360 }
1361 }
1362
1363 // Connect decoder softreset
1364 NetlistPort* decoderDBResetPort = decoderBlock->port("db_tta_nreset");
1365 decoderDBResetPort->unsetStatic();
1366 toplevelBlock.netlist().connect(*ttaResetPort, *decoderDBResetPort);
1367 }
const std::string & instanceName() const
const std::string & moduleName() const
virtual size_t subBlockCount() const
NetlistBlock & subBlock(size_t index) override
void addPackage(const std::string &packageName)
virtual const NetlistBlock & parentBlock() const override
NetlistPort & gcuReturnAddressInPort() const
std::string widthFormula() const
void unsetStatic() const

References ProGe::NetlistBlock::addPackage(), ProGe::NetlistBlock::addSubBlock(), assert, ProGe::BIT, ProGe::BIT_VECTOR, ProGe::NetlistGenerator::clkPort(), ProGe::Netlist::connect(), dbsmBlock, decoderGenerator_, ProGe::NetlistGenerator::gcuReturnAddressInPort(), GENERATE_DEBUGGER_PARAM, GENERATE_DEBUGGER_PARAM_EXTERNAL, GENERATE_DEBUGGER_PARAM_MINIMAL, generateDebugger(), DefaultDecoderGenerator::glockRequestWidth(), ProGe::IN, ProGe::BaseNetlistBlock::instanceName(), ProGe::NetlistGenerator::instructionDecoder(), ProGe::NetlistGenerator::instructionFetch(), ProGe::BaseNetlistBlock::moduleName(), ProGe::NetlistBlock::netlist(), ProGe::OUT, ProGe::ICDecoderGeneratorPlugin::parameterValue(), ProGe::NetlistBlock::parentBlock(), ProGe::NetlistBlock::port(), ProGe::NetlistGenerator::rstPort(), ProGe::NetlistBlock::setParameter(), ProGe::NetlistBlock::subBlock(), ProGe::NetlistBlock::subBlockCount(), ProGe::NetlistPort::unsetStatic(), and ProGe::NetlistPort::widthFormula().

Referenced by generate().

Here is the call graph for this function:

◆ generateLockTrace()

bool DefaultICDecoderGenerator::generateLockTrace ( ) const
inlineprivate

Tells whether IC generator should generate global lock tracing code.

Returns
True if IC generator should generate the code.

Definition at line 1704 of file DefaultICDecoderPlugin.cc.

1704 {
1706 return false;
1707 } else {
1708 string paramValue = parameterValue(GENERATE_LOCK_TRACE_PARAM);
1709 if (paramValue == GENERATE_LOCK_TRACE_PARAM_YES) {
1710 return true;
1711 } else {
1712 return false;
1713 }
1714 }
1715 }
const std::string GENERATE_LOCK_TRACE_PARAM_YES

References GENERATE_LOCK_TRACE_PARAM, GENERATE_LOCK_TRACE_PARAM_YES, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), and ProGe::ICDecoderGeneratorPlugin::parameterValue().

Referenced by readParameters().

Here is the call graph for this function:

◆ generateNoSelfLockingFUs()

bool DefaultICDecoderGenerator::generateNoSelfLockingFUs ( ) const
inlineprivate

Definition at line 1783 of file DefaultICDecoderPlugin.cc.

1783 {
1785 return false;
1786 } else {
1787 string paramValue = parameterValue(NO_SELF_LOCKING_PARAM);
1788 return paramValue == NO_SELF_LOCKING_PARAM_YES;
1789 }
1790 }
const std::string NO_SELF_LOCKING_PARAM_YES
const std::string NO_SELF_LOCKING_PARAM

References ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), NO_SELF_LOCKING_PARAM, NO_SELF_LOCKING_PARAM_YES, and ProGe::ICDecoderGeneratorPlugin::parameterValue().

Referenced by generate().

Here is the call graph for this function:

◆ hasSynchronousReset()

bool DefaultICDecoderGenerator::hasSynchronousReset ( ) const
inlineprivate

Definition at line 1694 of file DefaultICDecoderPlugin.cc.

1694 {
1695 return hasParameterSet(SYNC_RESET) &&
1697 }
const std::string SYNC_RESET

References ENABLE_FEATURE, ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), ProGe::ICDecoderGeneratorPlugin::parameterValue(), and SYNC_RESET.

Referenced by generate(), and readParameters().

Here is the call graph for this function:

◆ lockTraceStartingCycle()

int DefaultICDecoderGenerator::lockTraceStartingCycle ( ) const
inlineprivate

Returns the starting cycle to be written to the global lock trace given as parameter.

If parameter is not defined use value from busTraceStartingCycle() instead.

Returns
The starting cycle.

Definition at line 1763 of file DefaultICDecoderPlugin.cc.

1763 {
1765 return busTraceStartingCycle();
1766 } else {
1767 string paramValue = parameterValue(LOCK_TRACE_STARTING_CYCLE);
1768
1769 if (paramValue == BUS_TRACE_STARTING_CYCLE) {
1770 return busTraceStartingCycle();
1771 }
1772
1773 try {
1774 unsigned int cycle = Conversion::toUnsignedInt(paramValue);
1775 return cycle;
1776 } catch (const Exception&) {
1777 return 0;
1778 }
1779 }
1780 }

References BUS_TRACE_STARTING_CYCLE, busTraceStartingCycle(), ProGe::ICDecoderGeneratorPlugin::hasParameterSet(), LOCK_TRACE_STARTING_CYCLE, ProGe::ICDecoderGeneratorPlugin::parameterValue(), and Conversion::toUnsignedInt().

Referenced by readParameters().

Here is the call graph for this function:

◆ readParameters()

void DefaultICDecoderGenerator::readParameters ( )
inlineprivatevirtual

Reads parameters and configures the IC and decoder generators.

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 1881 of file DefaultICDecoderPlugin.cc.

1881 {
1884 // IC is combinatorial, no need for reset
1886
1887 if (generateBusTrace()) {
1890 } else {
1893 }
1894
1895 if (generateLockTrace()) {
1899 } else {
1901 }
1902 }
void setLockTraceStartingCycle(unsigned int startCycle)
void setGenerateLockTrace(bool generate)
void setGenerateDebugger(bool generate)
void setExportBustrace(bool export_bt)

References busTraceStartingCycle(), decoderGenerator_, generateBusTrace(), generateDebugger(), generateLockTrace(), hasSynchronousReset(), icGenerator_, lockTraceStartingCycle(), DefaultICGenerator::setBusTraceStartingCycle(), DefaultICGenerator::setExportBustrace(), DefaultDecoderGenerator::setGenerateBusEnable(), DefaultICGenerator::setGenerateBusTrace(), DefaultDecoderGenerator::setGenerateDebugger(), DefaultDecoderGenerator::setGenerateLockTrace(), DefaultDecoderGenerator::setLockTraceStartingCycle(), and DefaultDecoderGenerator::setSyncReset().

Here is the call graph for this function:

◆ requiredRFLatencies()

virtual std::set< int > DefaultICDecoderGenerator::requiredRFLatencies ( const TTAMachine::ImmediateUnit iu) const
inlinevirtual

Returns the required latency of the hardware implementation of the given immediate unit.

Parameters
iuThe immediate unit.

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 1604 of file DefaultICDecoderPlugin.cc.

1604 {
1606 }
std::set< int > requiredRFLatencies(const TTAMachine::ImmediateUnit &iu) const

References decoderGenerator_, and DefaultDecoderGenerator::requiredRFLatencies().

Here is the call graph for this function:

◆ verifyCompatibility()

virtual void DefaultICDecoderGenerator::verifyCompatibility ( ) const
inlinevirtual

Verifies that the plugin is compatible with the machine.

Exceptions
InvalidDataIf the plugin is not compatible with the machine.

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 1615 of file DefaultICDecoderPlugin.cc.

1615 {
1616 int requiredDelaySlots = calculateSupportedDelaySlots();
1617 int specifiedDelaySlots = ttamachine_.controlUnit()->delaySlots();
1618
1619 if (specifiedDelaySlots != requiredDelaySlots) {
1620 throw InvalidData(
1621 __FILE__, __LINE__, __func__,
1622 TCEString("Decoder generator supports ") +
1623 Conversion::toString(requiredDelaySlots + 1) +
1624 "-stage transport pipeline of GCU with given options. "
1625 "Given machine has " +
1626 Conversion::toString(specifiedDelaySlots + 1) +
1627 " stages");
1628 }
1629
1632 }
void verifyCompatibility() const

References __func__, calculateSupportedDelaySlots(), TTAMachine::Machine::controlUnit(), decoderGenerator_, TTAMachine::ControlUnit::delaySlots(), icGenerator_, Conversion::toString(), ttamachine_, DefaultDecoderGenerator::verifyCompatibility(), and DefaultICGenerator::verifyCompatibility().

Here is the call graph for this function:

◆ vhdlDirection()

static std::string DefaultICDecoderGenerator::vhdlDirection ( ProGe::Direction  direction)
inlinestaticprivate

Converts the given direction to a string.

Parameters
directionThe direction.
Returns
The direction as string in VHDL.

Definition at line 1799 of file DefaultICDecoderPlugin.cc.

1799 {
1800 switch (direction) {
1801 case ProGe::IN:
1802 return "in";
1803 case ProGe::OUT:
1804 return "out";
1805 case ProGe::BIDIR:
1806 return "inout";
1807 }
1808 assert(false);
1809 return std::string();
1810 }
@ BIDIR
Bidirectional port.
Definition ProGeTypes.hh:55

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

◆ writeGlobalDefinitions()

virtual void DefaultICDecoderGenerator::writeGlobalDefinitions ( HDL  language,
std::ostream &  pkgStream 
) const
inlineprivatevirtual

Returns global package definitions in the form of a stream specifically for the variable length instruction architecture.

Parameters
pkgStreamThe destination stream

Implements ProGe::ICDecoderGeneratorPlugin.

Definition at line 1642 of file DefaultICDecoderPlugin.cc.

1642 {
1643 if (language == ProGe::VHDL) {
1644 pkgStream << " -- instruction width" << endl
1645 << " constant INSTRUCTIONWIDTH : positive := "
1646 << bem().width() << ";" << endl;
1647 } else if (language == ProGe::Verilog) {
1648 pkgStream << "// instruction width" << endl
1649 << "parameter INSTRUCTIONWIDTH = " << bem().width()
1650 << endl;
1651 }
1652 }
virtual int width(const TCEString &templateName) const

References ProGe::ICDecoderGeneratorPlugin::bem(), ProGe::Verilog, ProGe::VHDL, and BinaryEncoding::width().

Here is the call graph for this function:

Member Data Documentation

◆ bem_

const BinaryEncoding& DefaultICDecoderGenerator::bem_
private

Definition at line 1909 of file DefaultICDecoderPlugin.cc.

Referenced by generate().

◆ dbsmBlock

NetlistBlock* DefaultICDecoderGenerator::dbsmBlock
private

Definition at line 1904 of file DefaultICDecoderPlugin.cc.

Referenced by generateDebuggerCode().

◆ decoderGenerator_

DefaultDecoderGenerator* DefaultICDecoderGenerator::decoderGenerator_
private

◆ icGenerator_

DefaultICGenerator* DefaultICDecoderGenerator::icGenerator_
private

◆ ttamachine_

const TTAMachine::Machine& DefaultICDecoderGenerator::ttamachine_
private

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