CIRCT 24.0.0git
Loading...
Searching...
No Matches
LowerLayers.cpp File Reference
#include "circt/Dialect/Emit/EmitOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/Namespace.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HierPathCache.h"
#include "circt/Dialect/HW/InnerSymbolNamespace.h"
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Support/Utils.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Mutex.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for LowerLayers.cpp:

Go to the source code of this file.

Classes

class  LowerLayersPass

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
namespace  circt::firrtl

Macros

#define DEBUG_TYPE   "firrtl-lower-layers"
#define GEN_PASS_DEF_LOWERLAYERS

Typedefs

using InnerRefMap

Functions

static void appendName (StringRef name, SmallString< 32 > &output, bool toLower=false, Delimiter delimiter=Delimiter::BindFile)
static void appendName (const ArrayRef< FlatSymbolRefAttr > &names, SmallString< 32 > &output, bool toLower=false, Delimiter delimiter=Delimiter::BindFile)
static void appendName (SymbolRefAttr name, SmallString< 32 > &output, bool toLower=false, Delimiter delimiter=Delimiter::BindFile)
static SmallString< 32 > moduleNameForLayer (StringRef moduleName, SymbolRefAttr layerName)
 For a layer @A::@B::@C in module Module, the generated module is called Module_A_B_C.
static SmallString< 32 > hierPathNameForLayer (StringRef moduleName, SymbolRefAttr layerName)
static SmallString< 32 > instanceNameForLayer (SymbolRefAttr layerName)
 For a layerblock @A::@B::@C, the generated instance is called a_b_c.
static SmallString< 32 > fileNameForLayer (StringRef moduleName, StringAttr root, ArrayRef< FlatSymbolRefAttr > nested)
static SmallString< 32 > fileNameForLayer (StringRef moduleName, SymbolRefAttr layerName)
 For all layerblocks @A::@B::@C in a module called Module, the output filename is layers-Module-A-B-C.sv.
static SmallString< 32 > guardMacroNameForLayer (StringRef moduleName, SymbolRefAttr layerName)
 For all layerblocks @A::@B::@C in a module called Module, the include-guard macro is layers_Module_A_B_C.
static SmallString< 32 > macroNameForLayer (StringRef circuitName, ArrayRef< FlatSymbolRefAttr > layerName)
 For a layerblock @A::@B::@C, the verilog macro is A_B_C.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-lower-layers"

Definition at line 28 of file LowerLayers.cpp.

◆ GEN_PASS_DEF_LOWERLAYERS

#define GEN_PASS_DEF_LOWERLAYERS

Definition at line 32 of file LowerLayers.cpp.

Typedef Documentation

◆ InnerRefMap

using InnerRefMap
Initial value:
DenseMap<hw::InnerRefAttr, std::pair<hw::InnerSymAttr, StringAttr>>

Definition at line 76 of file LowerLayers.cpp.

Function Documentation

◆ appendName() [1/3]

void appendName ( const ArrayRef< FlatSymbolRefAttr > & names,
SmallString< 32 > & output,
bool toLower = false,
Delimiter delimiter = Delimiter::BindFile )
static

Definition at line 97 of file LowerLayers.cpp.

References appendName().

◆ appendName() [2/3]

void appendName ( StringRef name,
SmallString< 32 > & output,
bool toLower = false,
Delimiter delimiter = Delimiter::BindFile )
static

◆ appendName() [3/3]

void appendName ( SymbolRefAttr name,
SmallString< 32 > & output,
bool toLower = false,
Delimiter delimiter = Delimiter::BindFile )
static

Definition at line 104 of file LowerLayers.cpp.

References appendName().

◆ fileNameForLayer() [1/2]

SmallString< 32 > fileNameForLayer ( StringRef moduleName,
StringAttr root,
ArrayRef< FlatSymbolRefAttr > nested )
static

◆ fileNameForLayer() [2/2]

SmallString< 32 > fileNameForLayer ( StringRef moduleName,
SymbolRefAttr layerName )
static

For all layerblocks @A::@B::@C in a module called Module, the output filename is layers-Module-A-B-C.sv.

Definition at line 155 of file LowerLayers.cpp.

References fileNameForLayer().

◆ guardMacroNameForLayer()

SmallString< 32 > guardMacroNameForLayer ( StringRef moduleName,
SymbolRefAttr layerName )
static

For all layerblocks @A::@B::@C in a module called Module, the include-guard macro is layers_Module_A_B_C.

Definition at line 163 of file LowerLayers.cpp.

References appendName().

Referenced by LowerLayersPass::buildBindFile().

◆ hierPathNameForLayer()

SmallString< 32 > hierPathNameForLayer ( StringRef moduleName,
SymbolRefAttr layerName )
static

Definition at line 123 of file LowerLayers.cpp.

References appendName().

Referenced by LowerLayersPass::preprocessModule().

◆ instanceNameForLayer()

SmallString< 32 > instanceNameForLayer ( SymbolRefAttr layerName)
static

For a layerblock @A::@B::@C, the generated instance is called a_b_c.

Definition at line 135 of file LowerLayers.cpp.

References appendName().

Referenced by LowerLayersPass::runOnModuleBody().

◆ macroNameForLayer()

SmallString< 32 > macroNameForLayer ( StringRef circuitName,
ArrayRef< FlatSymbolRefAttr > layerName )
static

For a layerblock @A::@B::@C, the verilog macro is A_B_C.

Definition at line 174 of file LowerLayers.cpp.

References appendName().

Referenced by LowerLayersPass::preprocessLayers().

◆ moduleNameForLayer()

SmallString< 32 > moduleNameForLayer ( StringRef moduleName,
SymbolRefAttr layerName )
static

For a layer @A::@B::@C in module Module, the generated module is called Module_A_B_C.

Definition at line 113 of file LowerLayers.cpp.

References appendName().

Referenced by LowerLayersPass::preprocessModule().