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

#include <rtlil.h>

+ Collaboration diagram for RTLIL::SigChunk:

Public Member Functions

 SigChunk ()
 
 SigChunk (const RTLIL::Const &value)
 
 SigChunk (RTLIL::Wire *wire)
 
 SigChunk (RTLIL::Wire *wire, int offset, int width=1)
 
 SigChunk (const std::string &str)
 
 SigChunk (int val, int width=32)
 
 SigChunk (RTLIL::State bit, int width=1)
 
 SigChunk (RTLIL::SigBit bit)
 
RTLIL::SigChunk extract (int offset, int length) const
 
bool operator< (const RTLIL::SigChunk &other) const
 
bool operator== (const RTLIL::SigChunk &other) const
 
bool operator!= (const RTLIL::SigChunk &other) const
 

Data Fields

RTLIL::Wirewire
 
std::vector< RTLIL::Statedata
 
int width
 
int offset
 

Detailed Description

Definition at line 883 of file rtlil.h.

Constructor & Destructor Documentation

RTLIL::SigChunk::SigChunk ( )

Definition at line 1904 of file rtlil.cc.

1905 {
1906  wire = NULL;
1907  width = 0;
1908  offset = 0;
1909 }
RTLIL::Wire * wire
Definition: rtlil.h:885
#define NULL
RTLIL::SigChunk::SigChunk ( const RTLIL::Const value)

Definition at line 1911 of file rtlil.cc.

1912 {
1913  wire = NULL;
1914  data = value.bits;
1915  width = GetSize(data);
1916  offset = 0;
1917 }
RTLIL::Wire * wire
Definition: rtlil.h:885
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define NULL
std::vector< RTLIL::State > bits
Definition: rtlil.h:438
std::vector< RTLIL::State > data
Definition: rtlil.h:886

+ Here is the call graph for this function:

RTLIL::SigChunk::SigChunk ( RTLIL::Wire wire)

Definition at line 1919 of file rtlil.cc.

1920 {
1921  log_assert(wire != nullptr);
1922  this->wire = wire;
1923  this->width = wire->width;
1924  this->offset = 0;
1925 }
int width
Definition: rtlil.h:826
RTLIL::Wire * wire
Definition: rtlil.h:885
#define log_assert(_assert_expr_)
Definition: log.h:85
RTLIL::SigChunk::SigChunk ( RTLIL::Wire wire,
int  offset,
int  width = 1 
)

Definition at line 1927 of file rtlil.cc.

1928 {
1929  log_assert(wire != nullptr);
1930  this->wire = wire;
1931  this->width = width;
1932  this->offset = offset;
1933 }
RTLIL::Wire * wire
Definition: rtlil.h:885
#define log_assert(_assert_expr_)
Definition: log.h:85
RTLIL::SigChunk::SigChunk ( const std::string &  str)

Definition at line 1935 of file rtlil.cc.

1936 {
1937  wire = NULL;
1938  data = RTLIL::Const(str).bits;
1939  width = GetSize(data);
1940  offset = 0;
1941 }
RTLIL::Wire * wire
Definition: rtlil.h:885
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define NULL
std::vector< RTLIL::State > bits
Definition: rtlil.h:438
std::vector< RTLIL::State > data
Definition: rtlil.h:886

+ Here is the call graph for this function:

RTLIL::SigChunk::SigChunk ( int  val,
int  width = 32 
)

Definition at line 1943 of file rtlil.cc.

1944 {
1945  wire = NULL;
1946  data = RTLIL::Const(val, width).bits;
1947  this->width = GetSize(data);
1948  offset = 0;
1949 }
RTLIL::Wire * wire
Definition: rtlil.h:885
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define NULL
std::vector< RTLIL::State > bits
Definition: rtlil.h:438
std::vector< RTLIL::State > data
Definition: rtlil.h:886

+ Here is the call graph for this function:

RTLIL::SigChunk::SigChunk ( RTLIL::State  bit,
int  width = 1 
)

Definition at line 1951 of file rtlil.cc.

1952 {
1953  wire = NULL;
1954  data = RTLIL::Const(bit, width).bits;
1955  this->width = GetSize(data);
1956  offset = 0;
1957 }
RTLIL::Wire * wire
Definition: rtlil.h:885
int GetSize(RTLIL::Wire *wire)
Definition: yosys.cc:334
#define NULL
std::vector< RTLIL::State > bits
Definition: rtlil.h:438
std::vector< RTLIL::State > data
Definition: rtlil.h:886

+ Here is the call graph for this function:

RTLIL::SigChunk::SigChunk ( RTLIL::SigBit  bit)

Definition at line 1959 of file rtlil.cc.

1960 {
1961  wire = bit.wire;
1962  offset = 0;
1963  if (wire == NULL)
1964  data = RTLIL::Const(bit.data).bits;
1965  else
1966  offset = bit.offset;
1967  width = 1;
1968 }
RTLIL::Wire * wire
Definition: rtlil.h:907
RTLIL::State data
Definition: rtlil.h:909
int offset
Definition: rtlil.h:910
RTLIL::Wire * wire
Definition: rtlil.h:885
#define NULL
std::vector< RTLIL::State > bits
Definition: rtlil.h:438
std::vector< RTLIL::State > data
Definition: rtlil.h:886

Member Function Documentation

RTLIL::SigChunk RTLIL::SigChunk::extract ( int  offset,
int  length 
) const

Definition at line 1970 of file rtlil.cc.

1971 {
1972  RTLIL::SigChunk ret;
1973  if (wire) {
1974  ret.wire = wire;
1975  ret.offset = this->offset + offset;
1976  ret.width = length;
1977  } else {
1978  for (int i = 0; i < length; i++)
1979  ret.data.push_back(data[offset+i]);
1980  ret.width = length;
1981  }
1982  return ret;
1983 }
RTLIL::Wire * wire
Definition: rtlil.h:885
std::vector< RTLIL::State > data
Definition: rtlil.h:886
bool RTLIL::SigChunk::operator!= ( const RTLIL::SigChunk other) const

Definition at line 2008 of file rtlil.cc.

2009 {
2010  if (*this == other)
2011  return false;
2012  return true;
2013 }
bool RTLIL::SigChunk::operator< ( const RTLIL::SigChunk other) const

Definition at line 1985 of file rtlil.cc.

1986 {
1987  if (wire && other.wire)
1988  if (wire->name != other.wire->name)
1989  return wire->name < other.wire->name;
1990 
1991  if (wire != other.wire)
1992  return wire < other.wire;
1993 
1994  if (offset != other.offset)
1995  return offset < other.offset;
1996 
1997  if (width != other.width)
1998  return width < other.width;
1999 
2000  return data < other.data;
2001 }
RTLIL::Wire * wire
Definition: rtlil.h:885
RTLIL::IdString name
Definition: rtlil.h:825
std::vector< RTLIL::State > data
Definition: rtlil.h:886
bool RTLIL::SigChunk::operator== ( const RTLIL::SigChunk other) const

Definition at line 2003 of file rtlil.cc.

2004 {
2005  return wire == other.wire && width == other.width && offset == other.offset && data == other.data;
2006 }
RTLIL::Wire * wire
Definition: rtlil.h:885
std::vector< RTLIL::State > data
Definition: rtlil.h:886

Field Documentation

std::vector<RTLIL::State> RTLIL::SigChunk::data

Definition at line 886 of file rtlil.h.

int RTLIL::SigChunk::offset

Definition at line 887 of file rtlil.h.

int RTLIL::SigChunk::width

Definition at line 887 of file rtlil.h.

RTLIL::Wire* RTLIL::SigChunk::wire

Definition at line 885 of file rtlil.h.


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