CIRCT  19.0.0git
Public Member Functions | Public Attributes | List of all members
circt::moore::Range Struct Reference

The [a:b] part in a vector/array type such as logic [a:b]. More...

#include <MooreTypes.h>

Collaboration diagram for circt::moore::Range:
Collaboration graph
[legend]

Public Member Functions

 Range (unsigned size)
 Construct a range [size-1:0]. More...
 
 Range (unsigned size, RangeDir dir, int offset)
 Construct a range [offset+size-1:offset] if dir is Down, or [offset:offset+size-1] if dir is Up. More...
 
 Range (int left, int right)
 Construct a range [left:right], with the direction inferred asDownif left >= right, orUp` otherwise. More...
 
bool operator== (const Range &other) const
 
int left () const
 Get the $left dimension. More...
 
int right () const
 Get the $right dimension. More...
 
int low () const
 Get the $low dimension. More...
 
int high () const
 Get the $high dimension. More...
 
int increment () const
 Get the $increment size. More...
 
std::string toString () const
 Format this range as a string. More...
 

Public Attributes

unsigned size
 The total number of bits, given as |a-b|+1. More...
 
RangeDir dir
 The direction of the vector, i.e. whether a > b or a < b. More...
 
int offset
 The starting offset of the range. More...
 

Detailed Description

The [a:b] part in a vector/array type such as logic [a:b].

Definition at line 62 of file MooreTypes.h.

Constructor & Destructor Documentation

◆ Range() [1/3]

circt::moore::Range::Range ( unsigned  size)
inlineexplicit

Construct a range [size-1:0].

Definition at line 71 of file MooreTypes.h.

References circt::moore::Down.

◆ Range() [2/3]

circt::moore::Range::Range ( unsigned  size,
RangeDir  dir,
int  offset 
)
inline

Construct a range [offset+size-1:offset] if dir is Down, or [offset:offset+size-1] if dir is Up.

Definition at line 75 of file MooreTypes.h.

◆ Range() [3/3]

circt::moore::Range::Range ( int  left,
int  right 
)
inline

Construct a range [left:right], with the direction inferred asDownif left >= right, orUp` otherwise.

Definition at line 80 of file MooreTypes.h.

References dir, circt::moore::Down, left(), offset, right(), size, and circt::moore::Up.

Member Function Documentation

◆ high()

int circt::moore::Range::high ( ) const
inline

Get the $high dimension.

Definition at line 103 of file MooreTypes.h.

References offset, and size.

Referenced by left(), and right().

◆ increment()

int circt::moore::Range::increment ( ) const
inline

Get the $increment size.

Definition at line 105 of file MooreTypes.h.

References dir, and circt::moore::Up.

◆ left()

int circt::moore::Range::left ( ) const
inline

Get the $left dimension.

Definition at line 97 of file MooreTypes.h.

References dir, high(), low(), and circt::moore::Up.

Referenced by circt::moore::operator<<(), and Range().

◆ low()

int circt::moore::Range::low ( ) const
inline

Get the $low dimension.

Definition at line 101 of file MooreTypes.h.

References offset.

Referenced by left(), and right().

◆ operator==()

bool circt::moore::Range::operator== ( const Range other) const
inline

Definition at line 92 of file MooreTypes.h.

References dir, offset, and size.

◆ right()

int circt::moore::Range::right ( ) const
inline

Get the $right dimension.

Definition at line 99 of file MooreTypes.h.

References dir, high(), low(), and circt::moore::Up.

Referenced by circt::moore::operator<<(), and Range().

◆ toString()

std::string circt::moore::Range::toString ( ) const
inline

Format this range as a string.

Definition at line 108 of file MooreTypes.h.

Member Data Documentation

◆ dir

RangeDir circt::moore::Range::dir

The direction of the vector, i.e. whether a > b or a < b.

Definition at line 66 of file MooreTypes.h.

Referenced by circt::moore::hash_value(), increment(), left(), operator==(), Range(), and right().

◆ offset

int circt::moore::Range::offset

The starting offset of the range.

Definition at line 68 of file MooreTypes.h.

Referenced by circt::moore::hash_value(), high(), low(), operator==(), and Range().

◆ size

unsigned circt::moore::Range::size

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