yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RTLIL::Cell Struct Reference

#include <rtlil.h>

+ Collaboration diagram for RTLIL::Cell:

Public Member Functions

 Cell (RTLIL::Cell &other)=delete
 
void operator= (RTLIL::Cell &other)=delete
 
RTLIL_ATTRIBUTE_MEMBERS bool hasPort (RTLIL::IdString portname) const
 
void unsetPort (RTLIL::IdString portname)
 
void setPort (RTLIL::IdString portname, RTLIL::SigSpec signal)
 
const RTLIL::SigSpecgetPort (RTLIL::IdString portname) const
 
const std::map
< RTLIL::IdString,
RTLIL::SigSpec > & 
connections () const
 
bool hasParam (RTLIL::IdString paramname) const
 
void unsetParam (RTLIL::IdString paramname)
 
void setParam (RTLIL::IdString paramname, RTLIL::Const value)
 
const RTLIL::ConstgetParam (RTLIL::IdString paramname) const
 
void check ()
 
void fixup_parameters (bool set_a_signed=false, bool set_b_signed=false)
 
bool has_keep_attr () const
 
template<typename T >
void rewrite_sigspecs (T functor)
 

Data Fields

RTLIL::Modulemodule
 
RTLIL::IdString name
 
RTLIL::IdString type
 
std::map< RTLIL::IdString,
RTLIL::SigSpec
connections_
 
std::map< RTLIL::IdString,
RTLIL::Const
parameters
 

Protected Member Functions

 Cell ()
 

Friends

struct RTLIL::Module
 

Detailed Description

Definition at line 840 of file rtlil.h.

Constructor & Destructor Documentation

RTLIL::Cell::Cell ( )
protected

Definition at line 1762 of file rtlil.cc.

1762  : module(nullptr)
1763 {
1764 }
RTLIL::Module * module
Definition: rtlil.h:852
RTLIL::Cell::Cell ( RTLIL::Cell other)
delete

Member Function Documentation

void RTLIL::Cell::check ( )

Definition at line 1839 of file rtlil.cc.

1840 {
1841 #ifndef NDEBUG
1842  InternalCellChecker checker(NULL, this);
1843  checker.check();
1844 #endif
1845 }
#define NULL

+ Here is the caller graph for this function:

const std::map< RTLIL::IdString, RTLIL::SigSpec > & RTLIL::Cell::connections ( ) const

Definition at line 1814 of file rtlil.cc.

1815 {
1816  return connections_;
1817 }
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855

+ Here is the caller graph for this function:

void RTLIL::Cell::fixup_parameters ( bool  set_a_signed = false,
bool  set_b_signed = false 
)

Definition at line 1847 of file rtlil.cc.

1848 {
1849  if (type.substr(0, 1) != "$" || type.substr(0, 2) == "$_" || type.substr(0, 8) == "$paramod" ||
1850  type.substr(0, 9) == "$verific$" || type.substr(0, 7) == "$array:" || type.substr(0, 8) == "$extern:")
1851  return;
1852 
1853  if (type == "$mux" || type == "$pmux") {
1854  parameters["\\WIDTH"] = GetSize(connections_["\\Y"]);
1855  if (type == "$pmux")
1856  parameters["\\S_WIDTH"] = GetSize(connections_["\\S"]);
1857  check();
1858  return;
1859  }
1860 
1861  if (type == "$lut") {
1862  parameters["\\WIDTH"] = GetSize(connections_["\\A"]);
1863  return;
1864  }
1865 
1866  if (type == "$fa") {
1867  parameters["\\WIDTH"] = GetSize(connections_["\\Y"]);
1868  return;
1869  }
1870 
1871  if (type == "$lcu") {
1872  parameters["\\WIDTH"] = GetSize(connections_["\\CO"]);
1873  return;
1874  }
1875 
1876  bool signedness_ab = !type.in("$slice", "$concat", "$macc");
1877 
1878  if (connections_.count("\\A")) {
1879  if (signedness_ab) {
1880  if (set_a_signed)
1881  parameters["\\A_SIGNED"] = true;
1882  else if (parameters.count("\\A_SIGNED") == 0)
1883  parameters["\\A_SIGNED"] = false;
1884  }
1885  parameters["\\A_WIDTH"] = GetSize(connections_["\\A"]);
1886  }
1887 
1888  if (connections_.count("\\B")) {
1889  if (signedness_ab) {
1890  if (set_b_signed)
1891  parameters["\\B_SIGNED"] = true;
1892  else if (parameters.count("\\B_SIGNED") == 0)
1893  parameters["\\B_SIGNED"] = false;
1894  }
1895  parameters["\\B_WIDTH"] = GetSize(connections_["\\B"]);
1896  }
1897 
1898  if (connections_.count("\\Y"))
1899  parameters["\\Y_WIDTH"] = GetSize(connections_["\\Y"]);
1900 
1901  check();
1902 }
RTLIL::IdString type
Definition: rtlil.h:854
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856
bool in(T first, Args...rest)
Definition: rtlil.h:241
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
std::string substr(size_t pos=0, size_t len=std::string::npos) const
Definition: rtlil.h:208
void check()
Definition: rtlil.cc:1839
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const RTLIL::Const & RTLIL::Cell::getParam ( RTLIL::IdString  paramname) const

Definition at line 1834 of file rtlil.cc.

1835 {
1836  return parameters.at(paramname);
1837 }
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856

+ Here is the caller graph for this function:

const RTLIL::SigSpec & RTLIL::Cell::getPort ( RTLIL::IdString  portname) const

Definition at line 1809 of file rtlil.cc.

1810 {
1811  return connections_.at(portname);
1812 }
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855
bool RTLIL::Cell::has_keep_attr ( ) const
inline

Definition at line 875 of file rtlil.h.

875  {
876  return get_bool_attribute("\\keep") || (module && module->design && module->design->module(type) &&
877  module->design->module(type)->get_bool_attribute("\\keep"));
878  }
RTLIL::IdString type
Definition: rtlil.h:854
RTLIL::Module * module(RTLIL::IdString name)
Definition: rtlil.cc:254
RTLIL::Design * design
Definition: rtlil.h:589
RTLIL::Module * module
Definition: rtlil.h:852

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool RTLIL::Cell::hasParam ( RTLIL::IdString  paramname) const

Definition at line 1819 of file rtlil.cc.

1820 {
1821  return parameters.count(paramname) != 0;
1822 }
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856
bool RTLIL::Cell::hasPort ( RTLIL::IdString  portname) const

Definition at line 1766 of file rtlil.cc.

1767 {
1768  return connections_.count(portname) != 0;
1769 }
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855

+ Here is the caller graph for this function:

void RTLIL::Cell::operator= ( RTLIL::Cell other)
delete
template<typename T >
void RTLIL::Cell::rewrite_sigspecs ( functor)

Definition at line 1179 of file rtlil.h.

1179  {
1180  for (auto &it : connections_)
1181  functor(it.second);
1182 }
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855
void RTLIL::Cell::setParam ( RTLIL::IdString  paramname,
RTLIL::Const  value 
)

Definition at line 1829 of file rtlil.cc.

1830 {
1831  parameters[paramname] = value;
1832 }
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856

+ Here is the caller graph for this function:

void RTLIL::Cell::setPort ( RTLIL::IdString  portname,
RTLIL::SigSpec  signal 
)

Definition at line 1789 of file rtlil.cc.

1790 {
1791  auto conn_it = connections_.find(portname);
1792 
1793  if (conn_it == connections_.end()) {
1794  connections_[portname] = RTLIL::SigSpec();
1795  conn_it = connections_.find(portname);
1796  log_assert(conn_it != connections_.end());
1797  }
1798 
1799  for (auto mon : module->monitors)
1800  mon->notify_connect(this, conn_it->first, conn_it->second, signal);
1801 
1802  if (module->design)
1803  for (auto mon : module->design->monitors)
1804  mon->notify_connect(this, conn_it->first, conn_it->second, signal);
1805 
1806  conn_it->second = signal;
1807 }
std::set< RTLIL::Monitor * > monitors
Definition: rtlil.h:590
#define log_assert(_assert_expr_)
Definition: log.h:85
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855
RTLIL::Design * design
Definition: rtlil.h:589
std::set< RTLIL::Monitor * > monitors
Definition: rtlil.h:503
RTLIL::Module * module
Definition: rtlil.h:852
void RTLIL::Cell::unsetParam ( RTLIL::IdString  paramname)

Definition at line 1824 of file rtlil.cc.

1825 {
1826  parameters.erase(paramname);
1827 }
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856
void RTLIL::Cell::unsetPort ( RTLIL::IdString  portname)

Definition at line 1771 of file rtlil.cc.

1772 {
1773  RTLIL::SigSpec signal;
1774  auto conn_it = connections_.find(portname);
1775 
1776  if (conn_it != connections_.end())
1777  {
1778  for (auto mon : module->monitors)
1779  mon->notify_connect(this, conn_it->first, conn_it->second, signal);
1780 
1781  if (module->design)
1782  for (auto mon : module->design->monitors)
1783  mon->notify_connect(this, conn_it->first, conn_it->second, signal);
1784 
1785  connections_.erase(conn_it);
1786  }
1787 }
std::set< RTLIL::Monitor * > monitors
Definition: rtlil.h:590
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
Definition: rtlil.h:855
RTLIL::Design * design
Definition: rtlil.h:589
std::set< RTLIL::Monitor * > monitors
Definition: rtlil.h:503
RTLIL::Module * module
Definition: rtlil.h:852

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct RTLIL::Module
friend

Definition at line 844 of file rtlil.h.

Field Documentation

std::map<RTLIL::IdString, RTLIL::SigSpec> RTLIL::Cell::connections_

Definition at line 855 of file rtlil.h.

RTLIL::Module* RTLIL::Cell::module

Definition at line 852 of file rtlil.h.

RTLIL::IdString RTLIL::Cell::name

Definition at line 853 of file rtlil.h.

std::map<RTLIL::IdString, RTLIL::Const> RTLIL::Cell::parameters

Definition at line 856 of file rtlil.h.

RTLIL::IdString RTLIL::Cell::type

Definition at line 854 of file rtlil.h.


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