vrq
Public Member Functions | Static Public Member Functions | List of all members
CModule Class Reference

#include <cmodule.h>

Inheritance diagram for CModule:
CBlock CDecl CObject

Public Member Functions

 CModule (CSymbol *symbol, Coord_t *aLoc)
 Create a module declaration. More...
 
virtual CDeclClone (CObstack *heap)
 Create a clone of this declaration. More...
 
void InlineParamDecls (int v)
 Set inline parameter attribute. More...
 
int InlineParamDecls ()
 Get inline parameter attribute. More...
 
void InlinePortDecls (int v)
 Set inline port attribute. More...
 
int InlinePortDecls ()
 Get inline port attribute. More...
 
void PackageImportDecls (CNode *v)
 Set package import declarations. More...
 
CNodePackageImportDecls ()
 Get package import declarations. More...
 
void ModuleDirectlyDefined (int v)
 Set directly defined attribute. More...
 
int ModuleDirectlyDefined ()
 Get directly defined attribute. More...
 
int IsDefined (void)
 Get defined attribute. More...
 
void SetDefined (int flag)
 Set defined attribute. More...
 
void ModuleIncluded (int v)
 Set included attribute. More...
 
int ModuleIncluded ()
 Get included attribute. More...
 
int IsMacroModule (void)
 Get macro module attribute. More...
 
void SetMacroModule (int flag)
 Set macro module attribute. More...
 
bool IsInterface (void)
 Get interface attribute. More...
 
void SetInterface (bool flag)
 Set interface attribute. More...
 
bool IsModport (void)
 Get modport attribute. More...
 
void SetModport (bool flag)
 Set modport attribute. More...
 
int IsPrimitive (void)
 Get primitive attribute. More...
 
void SetPrimitive (int flag)
 Set primitive attribute. More...
 
virtual void Dump (FILE *f)
 Dump macro info to file descriptor. More...
 
void SetPorts (CNode *ports)
 Set module port list. More...
 
CNodeGetPorts ()
 Get modules port list. More...
 
virtual vector< CFunction * > * GetFunctionList ()
 Get list of functions/tasks. More...
 
virtual vector< CInstance * > * GetInstanceList ()
 Get list if module instances. More...
 
virtual vector< CPort * > * GetPortList ()
 Get list if module ports. More...
 
virtual vector< CPortDir * > * GetPortDirList ()
 Get list if module ports declarations. More...
 
CDeclFindDecl (CSymbol *sym)
 Find declaration in modules scope for given symbol. More...
 
int Cell ()
 Get cell attribute. More...
 
void Cell (int v)
 Set cell attribute. More...
 
int Protect ()
 Get protect attribute. More...
 
void Protect (int v)
 Set protect attribute. More...
 
int Precision ()
 Get timescale precision. More...
 
void Precision (int v)
 Set timescale precision. More...
 
int Unit ()
 Get timescale unit. More...
 
void Unit (int v)
 Set timescale unit. More...
 
int HasTimescale ()
 Get timescale present attribute. More...
 
int DefaultNetType ()
 Get default net type attribute. More...
 
void DefaultNetType (int v)
 Set default net type attribute. More...
 
int UnconnectedDrive ()
 Get unconnected drive attribute. More...
 
void UnconnectedDrive (int v)
 Set unconnected drive attribute. More...
 
virtual void Add (CFunction *function)
 
virtual void Add (CInstance *instance)
 
virtual void Add (CFref *fref)
 
virtual void Add (CVar *var)
 
virtual void Add (CNet *net)
 
virtual void Add (CNode *n)
 
virtual void Add (CParam *param)
 
- Public Member Functions inherited from CBlock
 CBlock (CSymbol *name, Coord_t *aLoc)
 Constructor for BLOCK declarations. More...
 
 CBlock (CSymbol *name, Coord_t *aLoc, Decl_t dtype)
 Constructor for BLOCK declarations. More...
 
virtual ~CBlock ()
 Object destructor. More...
 
virtual void Add (CBlock *child)
 
virtual void Add (CGenvar *genvar)
 
void SetParent (CBlock *parent)
 Set this block's parent block. More...
 
CBlockGetParent (void)
 Get this block's parent block. More...
 
void SetTrailingLabel (CSymbol *s)
 Set this block's end label. More...
 
CSymbolGetTrailingLabel (void)
 Get this block's end label. More...
 
vector< CNet * > * GetNetList ()
 Get list of object's nets. More...
 
vector< CVar * > * GetVarList ()
 Get list of object's registers. More...
 
vector< CParam * > * GetParamList ()
 Get list of object's parameters. More...
 
vector< CGenvar * > * GetGenvarList ()
 Get list of object's genvars. More...
 
virtual CNodeGetCodeList ()
 Get blocks parse tree. More...
 
virtual void SetCodeList (CNode *list)
 Set block's parse tree. More...
 
vector< CBlock * > * GetChildList ()
 Get list of block's child blocks. More...
 
virtual void SetSymtab (CSymtab< CDecl > &symtab)
 Set block's symbol table. More...
 
virtual CSymtab< CDecl > & GetSymtab ()
 Get block's symbol table. More...
 
- Public Member Functions inherited from CDecl
virtual void SetDataType (CDataType *dt)
 Set declartion's data type property. More...
 
virtual CDataTypeGetDataType ()
 Get declartion's data type property. More...
 
virtual void SetWireAttr (Wire_t v)
 Set declaration's wire attribute. More...
 
virtual Wire_t GetWireAttr ()
 Get declartion's wire type property. More...
 
virtual int IsWidthConstant (void) const
 Determine if packed width of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsWidthVolatile (void) const
 Determine if packed width of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsWidthEvaluateable (void) const
 Determine if packed width of declaration can be evaluated. More...
 
virtual INT32 GetWidth (void) const
 Evaluate packed width of declaration. More...
 
virtual CNodeGetWidthExp (void) const
 Get expression representing width of declaration. More...
 
virtual CNodeGetMsb () const
 Get expression for declaration's msb. More...
 
virtual CNodeGetLsb () const
 Get expression for declaration's lsb. More...
 
virtual int WidthDirection (void) const
 Evaluate current decl width direction. More...
 
virtual INT32 GetNumberOfUnpackedDimensions (void)
 Get number of unpacked dimensions of declaration. More...
 
virtual CNodeGetUnpackedMsi (INT32 dim)
 Get expression tree for upper limit of given packed array dimension. More...
 
virtual CNodeGetUnpackedLsi (INT32 dim)
 Get expression tree for lower limit of unpacked array dimension. More...
 
virtual void SetNumberOfUnpackedDimensions (INT32 dim)
 Set number of unpacked dimensions for declaration. More...
 
virtual CNodeGetUnpackedRange (INT32 dim)
 Get expression for range of array for dimension. More...
 
virtual void SetUnpackedRange (INT32 dim, CNode *v)
 Set expression for range of unpacked array for declaration. More...
 
virtual void SetConstAttr (int v)
 Set declaration's const attribute. More...
 
virtual int GetConstAttr ()
 Get declaration's const attribute. More...
 
virtual void SetVarAttr (int v)
 Set declaration's var attribute. More...
 
virtual int GetVarAttr ()
 Get declaration's var attribute. More...
 
virtual void SetAutomatic (int v)
 Set declaration's automatic property. More...
 
virtual int GetAutomatic ()
 Get declaration's automatic property. More...
 
virtual void SetVectored (int v)
 Set declartion's vectored property. More...
 
virtual int GetVectored ()
 Get declartion's vectored property. More...
 
virtual void SetScalared (int v)
 Set declartion's scalared property. More...
 
virtual int GetScalared ()
 Get declartion's scalared property. More...
 
void SetAttributes (CNode *attr)
 Set declarations's attributes. More...
 
CNodeGetAttributes ()
 Get declaration's attributes. More...
 
int HasAttribute (char *name, CNode *n=NULL, int init=1)
 Determine if declaration has the given attribute. More...
 
NodeType_t GetNodeType (void)
 Get node type of decl. More...
 
Decl_t GetClass (void)
 Get class of declaration. More...
 
void SetDeclStatementCreated (void)
 Set declaration statement created attribute. More...
 
int DeclStatementCreated (void)
 Get declaration statement create attibute. More...
 
Decl_t GetType (void)
 Get declaration type. More...
 
const char * GetTypeName (void)
 Get declaration type as a string. More...
 
void SetCoord (Coord_t *aLoc)
 Set declaration coordinate. More...
 
Coord_tGetCoord (void)
 Get file coordinates for declaration. More...
 
virtual void DumpDeclInfo (FILE *f)
 Dump declaration name, type and location to file descriptor. More...
 
const char * GetName (void)
 Shortcut to get declaration's name. More...
 
void SetSymbol (CSymbol *aSymbol)
 Set declaration's symbol. More...
 
CSymbolGetSymbol (void)
 Get declaration's symbol. More...
 
void SetPragmas (CNode *p)
 Set declaration pragmas. More...
 
CNodeGetPragmas ()
 Get declaration pragmas. More...
 
virtual void PreVisit1 (int(*func)(CNode *, void *), void *data)
 
virtual void PostVisit1 (void(*func)(CNode *, void *), void *data)
 
virtual void PostSubVisit1 (CNode *(*func)(CNode *, void *), void *data)
 
- Public Member Functions inherited from CObject
void * operator new (size_t size, CObstack *stack)
 Allocate object on CObstack heap. More...
 
void operator delete (void *object)
 Destroy object. More...
 

Static Public Member Functions

static CModuleLookupModule (CSymtab< CDecl > &symtab, char *aName)
 Find module declaration from name. More...
 
- Static Public Member Functions inherited from CDecl
static Flag Or (Flag f1, Flag f2)
 
static Flag Or (Flag f1, Flag f2, Flag f3)
 
static void GetMembers (Decl_t type, list< Decl_t > &result)
 Get a list of members of the given declaration class/type. More...
 

Additional Inherited Members

- Public Types inherited from CDecl
enum  Flag { eFLAG_NONE = 0, eFLAG_PRAGMA = 1, eFLAG_ARRAY = 2, eFLAG_DATATYPE = 4 }
 
- Protected Member Functions inherited from CDecl
 CDecl (CSymbol *aSymbol, Coord_t *aLoc, Decl_t aType, CDataType *dataType, Flag flags)
 Create instance of declaration. More...
 
void Copy (CObstack *heap, const CDecl &o)
 Perform deep copy of given object to this one This should never be call directly, only by subclasses. More...
 
- Protected Attributes inherited from CBlock
vector< CParam * > paramList
 
vector< CVar * > varList
 
vector< CGenvar * > genvarList
 
vector< CFref * > frefList
 
vector< CNet * > netList
 
vector< CInstance * > instanceList
 list of module instances. More...
 
CBlockparent
 
vector< CBlock * > children
 
CSymtab< CDeclsymtab
 
CSymboltrailingLabel
 

Constructor & Destructor Documentation

CModule::CModule ( CSymbol symbol,
Coord_t aLoc 
)

Create a module declaration.

Parameters
symbolname of module.
aLocfile coordinates of declaration.

Member Function Documentation

virtual void CModule::Add ( CFunction function)
virtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add function/task to module.

Parameters
functionpointer to function/task object
virtual void CModule::Add ( CInstance instance)
virtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add instance to block.

Parameters
instancepointer to instance object

Reimplemented from CBlock.

virtual void CModule::Add ( CFref fref)
virtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add fref to block.

Parameters
frefpointer to forward reference object

Reimplemented from CBlock.

virtual void CModule::Add ( CVar var)
inlinevirtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add variable to block.

Parameters
varpointer to register object

Reimplemented from CBlock.

virtual void CModule::Add ( CNet net)
inlinevirtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add net to block.

Parameters
netpointer to net object

Reimplemented from CBlock.

virtual void CModule::Add ( CNode n)
virtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add parse tree to block.

Parameters
nparse tree.

Reimplemented from CBlock.

virtual void CModule::Add ( CParam param)
inlinevirtual
Todo:
This routine will eventually be eliminated. Currently the construct must be added with this routine as well as by adding a node to the code tree.

Add parameter to block.

Parameters
parampointer to parameter object

Reimplemented from CBlock.

int CModule::Cell ( )
inline

Get cell attribute.

Returns
non-zero if module has been tagged as a cell.
void CModule::Cell ( int  v)
inline

Set cell attribute.

Parameters
vnon-zero if module has been tagged as a cell.
virtual CDecl* CModule::Clone ( CObstack heap)
inlinevirtual

Create a clone of this declaration.

Parameters
heapheap to use for allocation.
Returns
new declaration.

Reimplemented from CBlock.

int CModule::DefaultNetType ( )
inline

Get default net type attribute.

Returns
net type: vpiWire, vpiTri, vpiTri0, vpiWand, vpiTriAnd, vpiTriAnd, vpiTri1, vpiWor, vpiTriOr, VpiTriReg
void CModule::DefaultNetType ( int  v)
inline

Set default net type attribute.

Parameters
vnet type: vpiWire, vpiTri, vpiTri0, vpiWand, vpiTriAnd, vpiTriAnd, vpiTri1, vpiWor, vpiTriOr, VpiTriReg
virtual void CModule::Dump ( FILE *  f)
virtual

Dump macro info to file descriptor.

Parameters
ffile descriptor.

Reimplemented from CBlock.

CDecl* CModule::FindDecl ( CSymbol sym)

Find declaration in modules scope for given symbol.

Parameters
symsymbol to lookup.
Returns
declaration with given name, NULL if not found.
virtual vector<CFunction*>* CModule::GetFunctionList ( )
virtual

Get list of functions/tasks.

Returns
vector of functions/tasks.
virtual vector<CInstance*>* CModule::GetInstanceList ( )
virtual

Get list if module instances.

Returns
vector of instances.

Reimplemented from CBlock.

virtual vector<CPortDir*>* CModule::GetPortDirList ( )
virtual

Get list if module ports declarations.

Returns
vector of ports declarations.

Reimplemented from CBlock.

virtual vector<CPort*>* CModule::GetPortList ( )
virtual

Get list if module ports.

Returns
vector of ports.
CNode* CModule::GetPorts ( )
inline

Get modules port list.

Returns
port list.
int CModule::HasTimescale ( )
inline

Get timescale present attribute.

Returns
non-zero if timescale has been specified.
void CModule::InlineParamDecls ( int  v)
inline

Set inline parameter attribute.

Parameters
vnon-zero if parameters have been declared inline.
int CModule::InlineParamDecls ( )
inline

Get inline parameter attribute.

Returns
non-zero if parameters have been declared inline.
void CModule::InlinePortDecls ( int  v)
inline

Set inline port attribute.

Parameters
vnon-zero if port have been declared inline.
int CModule::InlinePortDecls ( )
inline

Get inline port attribute.

Returns
non-zero if port have been declared inline.
int CModule::IsDefined ( void  )
inline

Get defined attribute.

Returns
non-zero if module has been defined.
bool CModule::IsInterface ( void  )

Get interface attribute.

Returns
true if this is an interface
int CModule::IsMacroModule ( void  )

Get macro module attribute.

Returns
non-zero if module has been declare as a macro module.
bool CModule::IsModport ( void  )

Get modport attribute.

Returns
true if this is an modport
int CModule::IsPrimitive ( void  )

Get primitive attribute.

Returns
non-zero if module is a udp.
static CModule* CModule::LookupModule ( CSymtab< CDecl > &  symtab,
char *  aName 
)
static

Find module declaration from name.

If it doesn't exist create an undefined module object and tie it to name.

Parameters
symtabsymbol table to search or insert into.
aNamename of module.
void CModule::ModuleDirectlyDefined ( int  v)
inline

Set directly defined attribute.

Parameters
vnon-zero if module has been defined in a input file directly provide by the command line.
int CModule::ModuleDirectlyDefined ( )
inline

Get directly defined attribute.

Returns
non-zero if module has been defined in a input file directly provide by the command line.
void CModule::ModuleIncluded ( int  v)
inline

Set included attribute.

Parameters
vnon-zero if module declaration has been included in a compilation unit.
int CModule::ModuleIncluded ( )
inline

Get included attribute.

Returns
non-zero if module declaration has been included in a compilation unit.
void CModule::PackageImportDecls ( CNode v)
inline

Set package import declarations.

Parameters
vlist of declarations
CNode* CModule::PackageImportDecls ( )
inline

Get package import declarations.

Returns
list of declarations
int CModule::Precision ( )
inline

Get timescale precision.

Returns
precision: 0: s, -3: ms, -6: us, -9: ns, -12: ps, -15: fs
void CModule::Precision ( int  v)
inline

Set timescale precision.

Parameters
vprecision: 0: s, -3: ms, -6: us, -9: ns, -12: ps, -15: fs
int CModule::Protect ( )
inline

Get protect attribute.

Returns
non-zero if module has been tagged as protected.
void CModule::Protect ( int  v)
inline

Set protect attribute.

Parameters
vnon-zero if module has been tagged as protected.
void CModule::SetDefined ( int  flag)
inline

Set defined attribute.

Parameters
flagnon-zero if module has been defined.
void CModule::SetInterface ( bool  flag)

Set interface attribute.

Parameters
flagtrue if is an interface.
void CModule::SetMacroModule ( int  flag)

Set macro module attribute.

Parameters
flagnon-zero if module has been declare as a macro module.
void CModule::SetModport ( bool  flag)

Set modport attribute.

Parameters
flagtrue if is an modport.
void CModule::SetPorts ( CNode ports)

Set module port list.

Parameters
portsport list.
void CModule::SetPrimitive ( int  flag)

Set primitive attribute.

Parameters
flagnon-zero if module is a udp.
int CModule::UnconnectedDrive ( )
inline

Get unconnected drive attribute.

Returns
unconnected drive attribute: vpiHighZ, vpiPull0, vpiPull1
void CModule::UnconnectedDrive ( int  v)
inline

Set unconnected drive attribute.

Parameters
vunconnected drive attribute: vpiHighZ, vpiPull0, vpiPull1
int CModule::Unit ( )
inline

Get timescale unit.

Returns
unit: 0: s, -3: ms, -6: us, -9: ns, -12: ps, -15: fs
void CModule::Unit ( int  v)
inline

Set timescale unit.

Parameters
vprecision: 0: s, -3: ms, -6: us, -9: ns, -12: ps, -15: fs

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