OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HDLGenerator::Module Class Reference

#include <HDLGenerator.hh>

Inheritance diagram for HDLGenerator::Module:
Inheritance graph
Collaboration diagram for HDLGenerator::Module:
Collaboration graph

Public Member Functions

 Module (std::string name)
 
 Module (ipxact::ModuleInfo info, int id)
 
void set_header ()
 
void set_prefix (std::string prefix)
 
Moduleoperator<< (Behaviour &rhs)
 
Moduleoperator<< (Behaviour &&rhs)
 
Moduleoperator<< (Port &&port)
 
Moduleoperator<< (Parameter &&param)
 
Moduleoperator<< (IntegerConstant &&constant)
 
Moduleoperator<< (BinaryConstant &&constant)
 
Moduleoperator<< (Wire &&wire)
 
Moduleoperator<< (Register &&reg)
 
Moduleoperator<< (Register &reg)
 
Moduleoperator<< (Option &&opt)
 
Moduleoperator<< (Module &&rhs)
 
Moduleoperator<< (Module &rhs)
 
void build () final
 
void appendToHeader (const std::string &line)
 
virtual bool isRegister (const std::string &name) final
 
virtual bool isConstant (const std::string &name) final
 
virtual bool isVariable (const std::string &name) final
 
void registerVariable (const std::shared_ptr< Variable > var)
 
Width width (const std::string &name) final
 
WireType wireType (const std::string &name) final
 
void reads (const std::string &var) final
 
void writes (const std::string &var) final
 
void declare (std::ostream &stream, Language lang, int level)
 
void instantiate (std::ostream &stream, Language lang, int level)
 
void implement (std::ostream &stream, Language lang, int level=0)
 
bool hasOption (const std::string &var) final
 
RegistergetRegister (const std::string &var) final
 
- Public Member Functions inherited from HDLGenerator::Generatable
 Generatable (std::string name)
 
virtual ~Generatable ()=default
 
virtual void reads (const LHSValue &var)
 
int integerWidth (const std::string &name)
 
virtual Width width ()
 
virtual WireType wireType () const
 
virtual void hdl (std::ostream &stream, Language lang, int indent)
 
virtual void hdl (std::ostream &stream, Language lang)
 
virtual void implementAll (std::ostream &stream, Language lang)
 
virtual void implementAll (std::ostream &stream, Language lang, int indent)
 
template<typename Func >
void forAll (Func func)
 
template<typename Type , typename Func >
void forAll (Func func)
 
template<class Type >
bool parentIs ()
 
template<class Type >
Type * parentType ()
 
void pushComponent (std::shared_ptr< Generatable > c)
 
template<class Component >
void addComponent (Component c)
 
const std::string & name () const noexcept
 
void setParent (Generatable *parent) noexcept
 
Generatableparent () const noexcept
 

Private Member Functions

void clear ()
 

Private Attributes

int id_ = 0
 
std::string prefix_
 
std::unordered_set< std::string > options_
 
std::vector< std::string > headerComment_
 
std::vector< Parameterparameters_
 
std::vector< Portports_
 
std::vector< IntegerConstantconstants_
 
std::vector< BinaryConstantbinaryConstants_
 
std::vector< std::shared_ptr< Wire > > wires_
 
std::vector< Registerregisters_
 
std::vector< std::shared_ptr< Variable > > variables_
 
std::vector< std::shared_ptr< Behaviour > > behaviours_
 
std::vector< Modulemodules_
 

Detailed Description

Entity/module.

Definition at line 1163 of file HDLGenerator.hh.

Constructor & Destructor Documentation

◆ Module() [1/2]

HDLGenerator::Module::Module ( std::string  name)
inline

Definition at line 1165 of file HDLGenerator.hh.

1165  : Generatable(name), prefix_(name) {
1166  set_header();
1167  }

References set_header().

Here is the call graph for this function:

◆ Module() [2/2]

HDLGenerator::Module::Module ( ipxact::ModuleInfo  info,
int  id 
)
inline

Definition at line 1169 of file HDLGenerator.hh.

1169  : Generatable(info.name),
1170  prefix_(info.name) {
1171  set_header();
1172  id_ = id;
1173  for (auto&& p : info.parameters) {
1174  parameters_.emplace_back(Parameter{p.name, p.value});
1175  }
1176  for (auto&& p : info.ports) {
1177  Direction dir = p.direction == "in" ?
1179  if (p.vector) {
1180  *this << Port(p.name, dir, p.left + "+1");
1181  } else {
1182  *this << Port(p.name, dir);
1183  }
1184  }
1185  }

References id_, HDLGenerator::In, HDLGenerator::Generatable::name(), HDLGenerator::Out, ipxact::ModuleInfo::parameters, parameters_, ipxact::ModuleInfo::ports, and set_header().

Here is the call graph for this function:

Member Function Documentation

◆ appendToHeader()

void HDLGenerator::Module::appendToHeader ( const std::string &  line)
inline

Definition at line 1273 of file HDLGenerator.hh.

1273  {
1274  headerComment_.emplace_back(line);
1275  }

References headerComment_.

◆ build()

void HDLGenerator::Module::build ( )
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1266 of file HDLGenerator.hh.

1266  {
1267  for (auto&& b : behaviours_) {
1268  b->setParent(this);
1269  b->build();
1270  }
1271  }

References behaviours_.

Referenced by implement().

◆ clear()

void HDLGenerator::Module::clear ( )
inlineprivate

Definition at line 1669 of file HDLGenerator.hh.

1669  {
1670  // clear variables.
1671  variables_.clear();
1672  // Remove duplicate registers.
1673  registers_.erase(std::unique(registers_.begin(), registers_.end(),
1674  [](Register l, Register r) {
1675  return l.name() == r.name();
1676  }),
1677  registers_.end());
1678  }

References registers_, and variables_.

Referenced by implement().

◆ declare()

void HDLGenerator::Module::declare ( std::ostream &  stream,
Language  lang,
int  level 
)
inline

Definition at line 1378 of file HDLGenerator.hh.

1378  {
1379  if (lang == Language::VHDL) {
1380  stream << StringTools::indent(level) << "component "
1381  << name() << " is\n";
1382  // - Generics
1383  if (!parameters_.empty()) {
1384  std::string separator = "";
1385  stream << StringTools::indent(level + 1) << "generic (\n";
1386  for (auto&& parameter : parameters_) {
1387  stream << separator << StringTools::indent(level + 2);
1388  parameter.declare(stream, lang);
1389  separator = ";\n";
1390  }
1391  stream << ");\n";
1392  }
1393  // - Ports
1394  if (!ports_.empty()) {
1395  std::string separator = "";
1396  stream << StringTools::indent(level + 1) << "port (\n";
1397  for (auto&& port : ports_) {
1398  stream << separator << StringTools::indent(level + 2);
1399  port.declare(stream, lang);
1400  separator = ";\n";
1401  }
1402  stream << ");\n";
1403  }
1404  stream << StringTools::indent(level) << "end component "
1405  << name() << ";\n";
1406  } else if (lang == Language::Verilog) {
1407  // no declaration for verilog.
1408  } else {
1409  throw std::runtime_error(__PRETTY_FUNCTION__);
1410  }
1411  }

References StringTools::indent(), HDLGenerator::Generatable::name(), parameters_, ports_, HDLGenerator::Verilog, and HDLGenerator::VHDL.

Here is the call graph for this function:

◆ getRegister()

Register& HDLGenerator::Module::getRegister ( const std::string &  var)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1659 of file HDLGenerator.hh.

1659  {
1660  for (auto&& r : registers_) {
1661  if (r.name() == var) {
1662  return r;
1663  }
1664  }
1665  throw std::runtime_error("Couldn't find register '" + var + "'");
1666  }

References registers_.

◆ hasOption()

bool HDLGenerator::Module::hasOption ( const std::string &  var)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1654 of file HDLGenerator.hh.

1654  {
1655  return std::find(options_.begin(), options_.end(), var) !=
1656  options_.end();
1657  }

References options_.

◆ implement()

void HDLGenerator::Module::implement ( std::ostream &  stream,
Language  lang,
int  level = 0 
)
inline

Definition at line 1476 of file HDLGenerator.hh.

1476  {
1477  clear();
1478  build();
1479  if (lang == Language::VHDL) {
1480  std::string ident = StringTools::indent(level);
1481  // Header comment
1482  for (auto&& line : headerComment_) {
1483  stream << ident << "-- " << line << "\n";
1484  }
1485  // Libraries
1486  stream << ident << "\n"
1487  << ident << "library ieee;\n"
1488  << ident << "use ieee.std_logic_1164.all;\n"
1489  << ident << "use ieee.numeric_std.all;\n"
1490  << ident << "use ieee.std_logic_misc.all;\n"
1491  // Entity
1492  << ident << "\n"
1493  << ident << "entity " << name() << " is\n";
1494  // - Generics
1495  if (!parameters_.empty()) {
1496  std::string separator = "";
1497  stream << StringTools::indent(level + 1) << "generic (\n";
1498  for (auto&& parameter : parameters_) {
1499  stream << separator;
1500  parameter.declare(stream, lang, level + 2);
1501  separator = ";\n";
1502  }
1503  stream << ");\n";
1504  }
1505  // - Ports
1506  if (!ports_.empty()) {
1507  std::string separator = "";
1508  stream << StringTools::indent(level + 1) << "port (\n";
1509  for (auto&& port : ports_) {
1510  stream << separator;
1511  port.declare(stream, lang, level + 2);
1512  separator = ";\n";
1513  }
1514  stream << ");\n";
1515  }
1516  stream << ident << "end entity " << name() << ";\n"
1517  // Architecture
1518  << ident << "\n"
1519  << ident << "architecture rtl of "
1520  << name() << " is\n";
1521  // constants
1522  if (!constants_.empty() || !binaryConstants_.empty()) {
1523  stream << "\n";
1524  }
1525  for (auto&& c : constants_) {
1526  c.declare(stream, lang, level + 1);
1527  }
1528  for (auto&& c : binaryConstants_) {
1529  c.declare(stream, lang, level + 1);
1530  }
1531  // wires
1532  if (!wires_.empty()) {
1533  stream << "\n";
1534  }
1535  for (auto&& w : wires_) {
1536  w->declare(stream, lang, level + 1);
1537  }
1538  // registers
1539  if (!registers_.empty()) {
1540  stream << "\n";
1541  }
1542  for (auto&& r : registers_) {
1543  r.declare(stream, lang, level + 1);
1544  }
1545  // declare components
1546  std::vector<std::string> declared;
1547  for (auto&& m : modules_) {
1548  if (std::find(declared.begin(), declared.end(),
1549  m.name()) != declared.end()) {
1550  continue;
1551  }
1552  stream << "\n";
1553  m.declare(stream, lang, level + 1);
1554  declared.emplace_back(m.name());
1555  }
1556  stream << StringTools::indent(level) << "\nbegin\n\n";
1557  // instantiate components
1558  for (auto&& m : modules_) {
1559  m.instantiate(stream, lang, level + 1);
1560  stream << "\n";
1561  }
1562  // actual behavioural code
1563  for (auto&& b : behaviours_) {
1564  b->behaviour(stream, lang, level + 1);
1565  }
1566  stream << "\n";
1567  stream << StringTools::indent(level)
1568  << "end architecture rtl;\n\n";
1569 
1570  } else if (lang == Language::Verilog) {
1571  // Header comment
1572  stream << StringTools::indent(level) << "/*\n";
1573  for (auto&& line : headerComment_) {
1574  stream << StringTools::indent(level)
1575  << " * " << line << "\n";
1576  }
1577  stream << StringTools::indent(level) << " */\n";
1578  // Module
1579  stream << StringTools::indent(level) << "\n";
1580  stream << StringTools::indent(level) << "module " << name();
1581  // - Parameters
1582  if (!parameters_.empty()) {
1583  std::string separator = "";
1584  stream << " #(\n";
1585  for (auto&& parameter : parameters_) {
1586  stream << separator;
1587  parameter.declare(stream, lang, level + 2);
1588  separator = ",\n";
1589  }
1590  stream << ")";
1591  }
1592  // - Ports
1593  if (!ports_.empty()) {
1594  std::string separator = "";
1595  stream << " (\n";
1596  for (auto&& port : ports_) {
1597  stream << separator;
1598  port.declare(stream, lang, level + 2);
1599  separator = ",\n";
1600  }
1601  stream << ")";
1602  }
1603  // end module interface
1604  stream << ";\n";
1605  // constants
1606  if (!constants_.empty() || !binaryConstants_.empty()) {
1607  stream << "\n";
1608  }
1609  for (auto&& c : constants_) {
1610  c.declare(stream, lang, level + 1);
1611  }
1612  for (auto&& c : binaryConstants_) {
1613  c.declare(stream, lang, level + 1);
1614  }
1615  // wires
1616  if (!wires_.empty()) {
1617  stream << "\n";
1618  }
1619  for (auto&& w : wires_) {
1620  w->declare(stream, lang, level + 1);
1621  }
1622  // variables
1623  if (!variables_.empty()) {
1624  stream << "\n";
1625  for (auto&& v : variables_) {
1626  v->declare(stream, lang, level + 1);
1627  }
1628  }
1629  // registers
1630  if (!registers_.empty()) {
1631  stream << "\n";
1632  }
1633  for (auto&& r : registers_) {
1634  r.declare(stream, lang, level + 1);
1635  }
1636  // instantiate stuff
1637  for (auto&& m : modules_) {
1638  stream << "\n";
1639  m.instantiate(stream, lang, level + 1);
1640  }
1641  // actual code
1642  stream << "\n";
1643  for (auto&& b : behaviours_) {
1644  b->behaviour(stream, lang, level + 1);
1645  }
1646  // end module
1647  stream << "\n";
1648  stream << StringTools::indent(level) << "endmodule\n\n";
1649  } else {
1650  throw std::runtime_error(__PRETTY_FUNCTION__);
1651  }
1652  }

References behaviours_, binaryConstants_, build(), clear(), constants_, headerComment_, StringTools::indent(), modules_, HDLGenerator::Generatable::name(), parameters_, ports_, registers_, variables_, HDLGenerator::Verilog, HDLGenerator::VHDL, and wires_.

Here is the call graph for this function:

◆ instantiate()

void HDLGenerator::Module::instantiate ( std::ostream &  stream,
Language  lang,
int  level 
)
inline

Definition at line 1413 of file HDLGenerator.hh.

1413  {
1414  std::string instance = prefix_ + "_" + std::to_string(id_);
1415  if (lang == Language::VHDL) {
1416  stream << StringTools::indent(level)
1417  << instance << " : " << name() << "\n";
1418  if (parameters_.size() > 0) {
1419  stream << StringTools::indent(level + 1) << "generic map (\n";
1420 
1421  std::string separator = "";
1422  for (auto&& p : parameters_) {
1423  stream << separator
1424  << StringTools::indent(level + 2)
1425  << p.name() << " => " << p.strValue();
1426  separator = ",\n";
1427  }
1428  stream << ")\n";
1429  }
1430  std::string separator = "";
1431  stream << StringTools::indent(level + 1) << "port map (\n";
1432  for (auto&& p : ports_) {
1433  stream << separator << StringTools::indent(level + 2)
1434  << p.name() << " => ";
1435  if (p.name() == "clk" || p.name() == "rstx" ||
1436  p.name() == "glock_in") {
1437  stream << p.name();
1438  } else {
1439  stream << instance << "_" << p.name();
1440  }
1441  separator = ",\n";
1442  }
1443  stream << ");\n";
1444  } else if (lang == Language::Verilog) {
1445  stream << StringTools::indent(level) << name() << " ";
1446  if (parameters_.size() > 0) {
1447  stream << "#(";
1448  std::string separator = "";
1449  for (auto&& p : parameters_) {
1450  stream << separator;
1451  stream << "." << p.name() << "(" << p.strValue() << ")";
1452  separator = ", ";
1453  }
1454  stream << ") ";
1455  }
1456  std::string separator = "";
1457  stream << instance << " (\n";
1458  for (auto&& p : ports_) {
1459  stream << separator;
1460  stream << StringTools::indent(level + 2) << "." << p.name()
1461  << "(";
1462  if (p.name() == "clk" || p.name() == "rstx" ||
1463  p.name() == "glock_in") {
1464  stream << p.name() << ")";
1465  } else {
1466  stream << instance << "_" << name() << ")";
1467  }
1468  separator = ",\n";
1469  }
1470  stream << ");\n";
1471  } else {
1472  throw std::runtime_error(__PRETTY_FUNCTION__);
1473  }
1474  }

References id_, StringTools::indent(), HDLGenerator::Generatable::name(), parameters_, ports_, prefix_, HDLGenerator::Verilog, and HDLGenerator::VHDL.

Here is the call graph for this function:

◆ isConstant()

virtual bool HDLGenerator::Module::isConstant ( const std::string &  name)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1286 of file HDLGenerator.hh.

1286  {
1287  for (auto&& r : constants_) {
1288  if (r.name() == name) {
1289  return true;
1290  }
1291  }
1292  for (auto&& r : binaryConstants_) {
1293  if (r.name() == name) {
1294  return true;
1295  }
1296  }
1297  return false;
1298  }

References binaryConstants_, constants_, and HDLGenerator::Generatable::name().

Here is the call graph for this function:

◆ isRegister()

virtual bool HDLGenerator::Module::isRegister ( const std::string &  name)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1277 of file HDLGenerator.hh.

1277  {
1278  for (auto&& r : registers_) {
1279  if (r.name() == name) {
1280  return true;
1281  }
1282  }
1283  return false;
1284  }

References HDLGenerator::Generatable::name(), and registers_.

Here is the call graph for this function:

◆ isVariable()

virtual bool HDLGenerator::Module::isVariable ( const std::string &  name)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1300 of file HDLGenerator.hh.

1300  {
1301  for (auto&& v : variables_) {
1302  if (v->name() == name) {
1303  return true;
1304  }
1305  }
1306  return false;
1307  }

References HDLGenerator::Generatable::name(), and variables_.

Here is the call graph for this function:

◆ operator<<() [1/12]

Module& HDLGenerator::Module::operator<< ( Behaviour &&  rhs)
inline

Definition at line 1211 of file HDLGenerator.hh.

1211  {
1212  behaviours_.emplace_back(new Behaviour(rhs));
1213  return *this;
1214  }

References behaviours_.

◆ operator<<() [2/12]

Module& HDLGenerator::Module::operator<< ( Behaviour rhs)
inline

Definition at line 1206 of file HDLGenerator.hh.

1206  {
1207  behaviours_.emplace_back(new Behaviour(rhs));
1208  return *this;
1209  }

References behaviours_.

◆ operator<<() [3/12]

Module& HDLGenerator::Module::operator<< ( BinaryConstant &&  constant)
inline

Definition at line 1231 of file HDLGenerator.hh.

1231  {
1232  binaryConstants_.emplace_back(constant);
1233  return *this;
1234  }

References binaryConstants_.

◆ operator<<() [4/12]

Module& HDLGenerator::Module::operator<< ( IntegerConstant &&  constant)
inline

Definition at line 1226 of file HDLGenerator.hh.

1226  {
1227  constants_.emplace_back(constant);
1228  return *this;
1229  }

References constants_.

◆ operator<<() [5/12]

Module& HDLGenerator::Module::operator<< ( Module &&  rhs)
inline

Definition at line 1256 of file HDLGenerator.hh.

1256  {
1257  modules_.emplace_back(rhs);
1258  return *this;
1259  }

References modules_.

◆ operator<<() [6/12]

Module& HDLGenerator::Module::operator<< ( Module rhs)
inline

Definition at line 1261 of file HDLGenerator.hh.

1261  {
1262  modules_.emplace_back(rhs);
1263  return *this;
1264  }

References modules_.

◆ operator<<() [7/12]

Module& HDLGenerator::Module::operator<< ( Option &&  opt)
inline

Definition at line 1251 of file HDLGenerator.hh.

1251  {
1252  options_.emplace(opt.name());
1253  return *this;
1254  }

References options_.

◆ operator<<() [8/12]

Module& HDLGenerator::Module::operator<< ( Parameter &&  param)
inline

Definition at line 1221 of file HDLGenerator.hh.

1221  {
1222  parameters_.emplace_back(param);
1223  return *this;
1224  }

References parameters_.

◆ operator<<() [9/12]

Module& HDLGenerator::Module::operator<< ( Port &&  port)
inline

Definition at line 1216 of file HDLGenerator.hh.

1216  {
1217  ports_.push_back(port);
1218  return *this;
1219  }

References ports_.

◆ operator<<() [10/12]

Module& HDLGenerator::Module::operator<< ( Register &&  reg)
inline

Definition at line 1241 of file HDLGenerator.hh.

1241  {
1242  registers_.emplace_back(reg);
1243  return *this;
1244  }

References registers_.

◆ operator<<() [11/12]

Module& HDLGenerator::Module::operator<< ( Register reg)
inline

Definition at line 1246 of file HDLGenerator.hh.

1246  {
1247  registers_.emplace_back(reg);
1248  return *this;
1249  }

References registers_.

◆ operator<<() [12/12]

Module& HDLGenerator::Module::operator<< ( Wire &&  wire)
inline

Definition at line 1236 of file HDLGenerator.hh.

1236  {
1237  wires_.emplace_back(new Wire(wire));
1238  return *this;
1239  }

References wires_.

◆ reads()

void HDLGenerator::Module::reads ( const std::string &  var)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1374 of file HDLGenerator.hh.

1374 { (void)var; }

◆ registerVariable()

void HDLGenerator::Module::registerVariable ( const std::shared_ptr< Variable var)
inline

Definition at line 1309 of file HDLGenerator.hh.

1309  {
1310  for (auto&& v : variables_) {
1311  if (v->name() == var->name()) {
1312  throw std::runtime_error("tried to register variable " +
1313  var->name() + " multiple times");
1314  }
1315  }
1316  variables_.push_back(var);
1317  }

References variables_.

◆ set_header()

void HDLGenerator::Module::set_header ( )
inline

Definition at line 1187 of file HDLGenerator.hh.

1187  {
1188  auto now = std::chrono::system_clock::now();
1189  auto now_c = std::chrono::system_clock::to_time_t(now);
1190  char buffer[31];
1191  std::stringstream ss;
1192  std::strftime(buffer, 30, "%c", std::localtime(&now_c));
1193  ss << buffer; // std::put_time(std::localtime(&now_c), "%c");
1194  headerComment_.emplace_back(
1195  "Module generated by TTA Codesign Environment");
1196  headerComment_.emplace_back("");
1197  headerComment_.emplace_back(
1198  std::string("Generated on ") + ss.str());
1199  headerComment_.emplace_back("");
1200  }

References headerComment_.

Referenced by Module().

◆ set_prefix()

void HDLGenerator::Module::set_prefix ( std::string  prefix)
inline

Definition at line 1202 of file HDLGenerator.hh.

1202  {
1203  prefix_ = prefix;
1204  }

References prefix_.

Referenced by FUGen::createOperationResources().

◆ width()

Width HDLGenerator::Module::width ( const std::string &  name)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1319 of file HDLGenerator.hh.

1319  {
1320  for (auto&& v : parameters_) {
1321  if (v.name() == name) {
1322  return v.width();
1323  }
1324  }
1325  for (auto&& v : constants_) {
1326  if (v.name() == name) {
1327  return v.width();
1328  }
1329  }
1330  for (auto&& v : registers_) {
1331  if (v.name() == name) {
1332  return v.width();
1333  }
1334  }
1335  for (auto&& v : wires_) {
1336  if (v->name() == name) {
1337  return v->width();
1338  }
1339  }
1340  for (auto&& v : variables_) {
1341  if (v->name() == name) {
1342  return v->width();
1343  }
1344  }
1345  for (auto&& v : ports_) {
1346  if (v.name() == name) {
1347  return v.width();
1348  }
1349  }
1350  // not finding a thing is an error.
1351  throw std::runtime_error("Couldn't find width for " + name);
1352  }

References constants_, HDLGenerator::Generatable::name(), parameters_, ports_, registers_, variables_, and wires_.

Here is the call graph for this function:

◆ wireType()

WireType HDLGenerator::Module::wireType ( const std::string &  name)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1354 of file HDLGenerator.hh.

1354  {
1355  for (auto&& v : ports_) {
1356  if (v.name() == name) {
1357  return v.wireType();
1358  }
1359  }
1360  for (auto&& v : wires_) {
1361  if (v->name() == name) {
1362  return v->wireType();
1363  }
1364  }
1365  for (auto&& v : variables_) {
1366  if (v->name() == name) {
1367  return v->wireType();
1368  }
1369  }
1370  // not finding a thing is an error.
1371  throw std::runtime_error("Couldn't find wire type for " + name);
1372  }

References HDLGenerator::Generatable::name(), ports_, variables_, and wires_.

Here is the call graph for this function:

◆ writes()

void HDLGenerator::Module::writes ( const std::string &  var)
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 1376 of file HDLGenerator.hh.

1376 { (void)var; }

Member Data Documentation

◆ behaviours_

std::vector<std::shared_ptr<Behaviour> > HDLGenerator::Module::behaviours_
private

Definition at line 1690 of file HDLGenerator.hh.

Referenced by build(), implement(), and operator<<().

◆ binaryConstants_

std::vector<BinaryConstant> HDLGenerator::Module::binaryConstants_
private

Definition at line 1686 of file HDLGenerator.hh.

Referenced by implement(), isConstant(), and operator<<().

◆ constants_

std::vector<IntegerConstant> HDLGenerator::Module::constants_
private

Definition at line 1685 of file HDLGenerator.hh.

Referenced by implement(), isConstant(), operator<<(), and width().

◆ headerComment_

std::vector<std::string> HDLGenerator::Module::headerComment_
private

Definition at line 1682 of file HDLGenerator.hh.

Referenced by appendToHeader(), implement(), and set_header().

◆ id_

int HDLGenerator::Module::id_ = 0
private

Definition at line 1679 of file HDLGenerator.hh.

Referenced by instantiate(), and Module().

◆ modules_

std::vector<Module> HDLGenerator::Module::modules_
private

Definition at line 1691 of file HDLGenerator.hh.

Referenced by implement(), and operator<<().

◆ options_

std::unordered_set<std::string> HDLGenerator::Module::options_
private

Definition at line 1681 of file HDLGenerator.hh.

Referenced by hasOption(), and operator<<().

◆ parameters_

std::vector<Parameter> HDLGenerator::Module::parameters_
private

Definition at line 1683 of file HDLGenerator.hh.

Referenced by declare(), implement(), instantiate(), Module(), operator<<(), and width().

◆ ports_

std::vector<Port> HDLGenerator::Module::ports_
private

Definition at line 1684 of file HDLGenerator.hh.

Referenced by declare(), implement(), instantiate(), operator<<(), width(), and wireType().

◆ prefix_

std::string HDLGenerator::Module::prefix_
private

Definition at line 1680 of file HDLGenerator.hh.

Referenced by instantiate(), and set_prefix().

◆ registers_

std::vector<Register> HDLGenerator::Module::registers_
private

Definition at line 1688 of file HDLGenerator.hh.

Referenced by clear(), getRegister(), implement(), isRegister(), operator<<(), and width().

◆ variables_

std::vector<std::shared_ptr<Variable> > HDLGenerator::Module::variables_
private

Definition at line 1689 of file HDLGenerator.hh.

Referenced by clear(), implement(), isVariable(), registerVariable(), width(), and wireType().

◆ wires_

std::vector<std::shared_ptr<Wire> > HDLGenerator::Module::wires_
private

Definition at line 1687 of file HDLGenerator.hh.

Referenced by implement(), operator<<(), width(), and wireType().


The documentation for this class was generated from the following file:
HDLGenerator::Module::behaviours_
std::vector< std::shared_ptr< Behaviour > > behaviours_
Definition: HDLGenerator.hh:1690
HDLGenerator::Module::prefix_
std::string prefix_
Definition: HDLGenerator.hh:1680
HDLGenerator::Module::variables_
std::vector< std::shared_ptr< Variable > > variables_
Definition: HDLGenerator.hh:1689
HDLGenerator::Module::constants_
std::vector< IntegerConstant > constants_
Definition: HDLGenerator.hh:1685
HDLGenerator::Module::modules_
std::vector< Module > modules_
Definition: HDLGenerator.hh:1691
HDLGenerator::Module::set_header
void set_header()
Definition: HDLGenerator.hh:1187
StringTools::indent
static std::string indent(int level)
Definition: StringTools.cc:319
ipxact::ModuleInfo::ports
std::vector< Port > ports
Definition: IPXact.hh:56
HDLGenerator::Module::ports_
std::vector< Port > ports_
Definition: HDLGenerator.hh:1684
HDLGenerator::Direction::In
@ In
ipxact::ModuleInfo::name
std::string name
Definition: IPXact.hh:54
HDLGenerator::Module::options_
std::unordered_set< std::string > options_
Definition: HDLGenerator.hh:1681
HDLGenerator::Module::headerComment_
std::vector< std::string > headerComment_
Definition: HDLGenerator.hh:1682
HDLGenerator::Module::build
void build() final
Definition: HDLGenerator.hh:1266
HDLGenerator::Generatable::Generatable
Generatable(std::string name)
Definition: Generatable.hh:53
HDLGenerator::Language::Verilog
@ Verilog
HDLGenerator::Module::registers_
std::vector< Register > registers_
Definition: HDLGenerator.hh:1688
HDLGenerator::Module::wires_
std::vector< std::shared_ptr< Wire > > wires_
Definition: HDLGenerator.hh:1687
HDLGenerator::Module::id_
int id_
Definition: HDLGenerator.hh:1679
HDLGenerator::Direction::Out
@ Out
HDLGenerator::Module::parameters_
std::vector< Parameter > parameters_
Definition: HDLGenerator.hh:1683
HDLGenerator::Generatable::name
const std::string & name() const noexcept
Definition: Generatable.hh:239
HDLGenerator::Direction
Direction
Definition: HWGenTools.hh:35
HDLGenerator::Module::binaryConstants_
std::vector< BinaryConstant > binaryConstants_
Definition: HDLGenerator.hh:1686
HDLGenerator::Language::VHDL
@ VHDL
HDLGenerator::Module::clear
void clear()
Definition: HDLGenerator.hh:1669
ipxact::ModuleInfo::parameters
std::vector< Parameter > parameters
Definition: IPXact.hh:55