CIRCT
20.0.0git
|
Options which control the emission from CIRCT to Verilog. More...
#include <LoweringOptions.h>
Public Types | |
enum | { DEFAULT_TERM_LIMIT = 256 } |
This is the maximum number of terms in an expression before that expression spills a wire. More... | |
enum | { DEFAULT_LINE_LENGTH = 90 } |
This is the target width of lines in an emitted Verilog source file in columns. More... | |
enum | LocationInfoStyle { Plain , WrapInAtSquareBracket , None } |
This option controls emitted location information style. More... | |
enum | WireSpillingHeuristic : unsigned { SpillLargeTermsWithNamehints = 1 } |
This controls extra wire spilling performed in PrepareForEmission to improve readablitiy and debuggability. More... | |
enum | { DEFAULT_NAMEHINT_TERM_LIMIT = 3 } |
using | ErrorHandlerT = llvm::function_ref< void(llvm::Twine)> |
Error callback type used to indicate errors parsing the options string. More... | |
Public Member Functions | |
LoweringOptions ()=default | |
Create a LoweringOptions with the default values. More... | |
LoweringOptions (llvm::StringRef options, ErrorHandlerT errorHandler) | |
Create a LoweringOptions and read in options from a string, overriding only the set options in the string. More... | |
LoweringOptions (mlir::ModuleOp module) | |
Create a LoweringOptions with values loaded from an MLIR ModuleOp. More... | |
void | parse (llvm::StringRef options, ErrorHandlerT callback) |
Read in options from a string, overriding only the set options in the string. More... | |
std::string | toString () const |
Returns a string representation of the options. More... | |
void | setAsAttribute (mlir::ModuleOp module) |
Write the verilog emitter options to a module's attributes. More... | |
void | parseFromAttribute (mlir::ModuleOp module) |
Load any emitter options from the module. More... | |
bool | isWireSpillingHeuristicEnabled (WireSpillingHeuristic heurisic) const |
Static Public Member Functions | |
static mlir::StringAttr | getAttributeFrom (mlir::ModuleOp module) |
Return the value of the circt.loweringOptions in the specified module if present, or a null attribute if not. More... | |
Public Attributes | |
bool | noAlwaysComb = false |
If true, emits sv.alwayscomb as Verilog always @(*) statements. More... | |
bool | allowExprInEventControl = false |
If true, expressions are allowed in the sensitivity list of always statements, otherwise they are forced to be simple wires. More... | |
bool | disallowPackedArrays = false |
If true, eliminate packed arrays for tools that don't support them (e.g. More... | |
bool | disallowPackedStructAssignments = false |
If true, eliminate packed struct assignments in favor of a wire + assignments to the individual fields. More... | |
bool | disallowLocalVariables = false |
If true, do not emit SystemVerilog locally scoped "automatic" or logic declarations - emit top level wire and reg's instead. More... | |
bool | enforceVerifLabels = false |
If true, verification statements like assert , assume , and cover will always be emitted with a label. More... | |
unsigned | maximumNumberOfTermsPerExpression = DEFAULT_TERM_LIMIT |
unsigned | emittedLineLength = DEFAULT_LINE_LENGTH |
bool | explicitBitcast = false |
Add an explicit bitcast for avoiding bitwidth mismatch LINT errors. More... | |
bool | emitReplicatedOpsToHeader = false |
If true, replicated ops are emitted to a header file. More... | |
enum circt::LoweringOptions::LocationInfoStyle | locationInfoStyle = Plain |
bool | disallowPortDeclSharing = false |
If true, every port is declared separately (each includes direction and type (e.g., input [3:0] )). More... | |
bool | printDebugInfo = false |
Print debug info. More... | |
bool | disallowMuxInlining = false |
If true, every mux expression is spilled to a wire. More... | |
unsigned | wireSpillingHeuristicSet = 0 |
unsigned | wireSpillingNamehintTermLimit = DEFAULT_NAMEHINT_TERM_LIMIT |
bool | disallowExpressionInliningInPorts = false |
If true, every expression passed to an instance port is driven by a wire. More... | |
bool | mitigateVivadoArrayIndexConstPropBug = false |
If true, every expression used as an array index is driven by a wire, and the wire is marked as (* keep = "true" *) . More... | |
bool | emitWireInPorts = false |
If true, emit wire in port lists rather than nothing. More... | |
bool | emitBindComments = false |
If true, emit a comment wherever an instance wasn't printed, because it's emitted elsewhere as a bind. More... | |
bool | omitVersionComment = false |
If true, do not emit a version comment at the top of each verilog file. More... | |
bool | caseInsensitiveKeywords = false |
If true, then unique names that collide with keywords case insensitively. More... | |
bool | emitVerilogLocations = false |
If true, then update the the mlir to include output verilog locations. More... | |
bool | fixUpEmptyModules = false |
If true, add a dummy wire to empty modules to prevent tools from regarding the module as blackbox. More... | |
Options which control the emission from CIRCT to Verilog.
Definition at line 27 of file LoweringOptions.h.
using circt::LoweringOptions::ErrorHandlerT = llvm::function_ref<void(llvm::Twine)> |
Error callback type used to indicate errors parsing the options string.
Definition at line 29 of file LoweringOptions.h.
anonymous enum |
This is the maximum number of terms in an expression before that expression spills a wire.
Enumerator | |
---|---|
DEFAULT_TERM_LIMIT |
Definition at line 91 of file LoweringOptions.h.
anonymous enum |
This is the target width of lines in an emitted Verilog source file in columns.
Enumerator | |
---|---|
DEFAULT_LINE_LENGTH |
Definition at line 96 of file LoweringOptions.h.
anonymous enum |
Enumerator | |
---|---|
DEFAULT_NAMEHINT_TERM_LIMIT |
Definition at line 137 of file LoweringOptions.h.
This option controls emitted location information style.
Enumerator | |
---|---|
Plain | |
WrapInAtSquareBracket | |
None |
Definition at line 106 of file LoweringOptions.h.
enum circt::LoweringOptions::WireSpillingHeuristic : unsigned |
This controls extra wire spilling performed in PrepareForEmission to improve readablitiy and debuggability.
Enumerator | |
---|---|
SpillLargeTermsWithNamehints |
Definition at line 125 of file LoweringOptions.h.
|
default |
Create a LoweringOptions with the default values.
circt::LoweringOptions::LoweringOptions | ( | llvm::StringRef | options, |
ErrorHandlerT | errorHandler | ||
) |
Create a LoweringOptions and read in options from a string, overriding only the set options in the string.
LoweringOptions::LoweringOptions | ( | mlir::ModuleOp | module | ) |
Create a LoweringOptions with values loaded from an MLIR ModuleOp.
This loads a string attribute with the key circt.loweringOptions
. If there is an error parsing the attribute this will print an error using the ModuleOp.
Definition at line 29 of file LoweringOptions.cpp.
References parseFromAttribute().
|
static |
Return the value of the circt.loweringOptions
in the specified module if present, or a null attribute if not.
Definition at line 196 of file LoweringOptions.cpp.
Referenced by parseFromAttribute().
|
inline |
Definition at line 133 of file LoweringOptions.h.
References wireSpillingHeuristicSet.
Referenced by toString().
void LoweringOptions::parse | ( | llvm::StringRef | options, |
ErrorHandlerT | callback | ||
) |
Read in options from a string, overriding only the set options in the string.
Definition at line 52 of file LoweringOptions.cpp.
References allowExprInEventControl, caseInsensitiveKeywords, DEFAULT_LINE_LENGTH, DEFAULT_NAMEHINT_TERM_LIMIT, DEFAULT_TERM_LIMIT, disallowExpressionInliningInPorts, disallowLocalVariables, disallowMuxInlining, disallowPackedArrays, disallowPackedStructAssignments, disallowPortDeclSharing, emitBindComments, emitReplicatedOpsToHeader, emittedLineLength, emitVerilogLocations, emitWireInPorts, enforceVerifLabels, explicitBitcast, fixUpEmptyModules, locationInfoStyle, maximumNumberOfTermsPerExpression, mitigateVivadoArrayIndexConstPropBug, noAlwaysComb, omitVersionComment, parseLocationInfoStyle(), parseWireSpillingHeuristic(), printDebugInfo, wireSpillingHeuristicSet, and wireSpillingNamehintTermLimit.
Referenced by circt::LoweringOptionsParser::parse(), and parseFromAttribute().
void LoweringOptions::parseFromAttribute | ( | mlir::ModuleOp | module | ) |
Load any emitter options from the module.
If there is an error validating the attribute, this will print an error using the ModuleOp.
Definition at line 205 of file LoweringOptions.cpp.
References getAttributeFrom(), and parse().
Referenced by LoweringOptions().
void LoweringOptions::setAsAttribute | ( | mlir::ModuleOp | module | ) |
Write the verilog emitter options to a module's attributes.
Definition at line 200 of file LoweringOptions.cpp.
References circt::calyx::direction::get(), and toString().
std::string LoweringOptions::toString | ( | ) | const |
Returns a string representation of the options.
Definition at line 133 of file LoweringOptions.cpp.
References allowExprInEventControl, assert(), caseInsensitiveKeywords, DEFAULT_LINE_LENGTH, DEFAULT_TERM_LIMIT, disallowExpressionInliningInPorts, disallowLocalVariables, disallowMuxInlining, disallowPackedArrays, disallowPackedStructAssignments, disallowPortDeclSharing, emitBindComments, emitReplicatedOpsToHeader, emittedLineLength, emitVerilogLocations, emitWireInPorts, enforceVerifLabels, explicitBitcast, fixUpEmptyModules, isWireSpillingHeuristicEnabled(), locationInfoStyle, maximumNumberOfTermsPerExpression, mitigateVivadoArrayIndexConstPropBug, noAlwaysComb, omitVersionComment, and printDebugInfo.
Referenced by setAsAttribute().
bool circt::LoweringOptions::allowExprInEventControl = false |
If true, expressions are allowed in the sensitivity list of always
statements, otherwise they are forced to be simple wires.
Some EDA tools rely on these being simple wires.
Definition at line 69 of file LoweringOptions.h.
Referenced by isExpressionUnableToInline(), parse(), and toString().
bool circt::LoweringOptions::caseInsensitiveKeywords = false |
If true, then unique names that collide with keywords case insensitively.
This is used to avoid stricter lint warnings which, e.g., treat "REG" as a Verilog keyword.
Definition at line 165 of file LoweringOptions.h.
Referenced by circt::ExportVerilog::GlobalNameResolver::GlobalNameResolver(), parse(), and toString().
bool circt::LoweringOptions::disallowExpressionInliningInPorts = false |
If true, every expression passed to an instance port is driven by a wire.
Some lint tools dislike expressions being inlined into input ports so this option avoids such warnings.
Definition at line 143 of file LoweringOptions.h.
Referenced by legalizeHWModule(), parse(), and toString().
bool circt::LoweringOptions::disallowLocalVariables = false |
If true, do not emit SystemVerilog locally scoped "automatic" or logic declarations - emit top level wire and reg's instead.
Definition at line 81 of file LoweringOptions.h.
Referenced by legalizeHWModule(), parse(), and toString().
bool circt::LoweringOptions::disallowMuxInlining = false |
If true, every mux expression is spilled to a wire.
Definition at line 121 of file LoweringOptions.h.
Referenced by circt::ExportVerilog::isExpressionEmittedInline(), parse(), and toString().
bool circt::LoweringOptions::disallowPackedArrays = false |
If true, eliminate packed arrays for tools that don't support them (e.g.
Yosys).
Definition at line 73 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::disallowPackedStructAssignments = false |
If true, eliminate packed struct assignments in favor of a wire + assignments to the individual fields.
Definition at line 77 of file LoweringOptions.h.
Referenced by legalizeHWModule(), parse(), and toString().
bool circt::LoweringOptions::disallowPortDeclSharing = false |
If true, every port is declared separately (each includes direction and type (e.g., input [3:0]
)).
When false (default), ports share declarations when possible.
Definition at line 115 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::emitBindComments = false |
If true, emit a comment wherever an instance wasn't printed, because it's emitted elsewhere as a bind.
Definition at line 157 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::emitReplicatedOpsToHeader = false |
If true, replicated ops are emitted to a header file.
Definition at line 103 of file LoweringOptions.h.
Referenced by createSplitOutputFile(), exportSplitVerilogImpl(), exportVerilogImpl(), parse(), and toString().
unsigned circt::LoweringOptions::emittedLineLength = DEFAULT_LINE_LENGTH |
Definition at line 97 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::emitVerilogLocations = false |
If true, then update the the mlir to include output verilog locations.
Definition at line 168 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::emitWireInPorts = false |
If true, emit wire
in port lists rather than nothing.
Used in cases where `default_nettype is not set to wire.
Definition at line 153 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::enforceVerifLabels = false |
If true, verification statements like assert
, assume
, and cover
will always be emitted with a label.
If the statement has no label in the IR, a generic one will be created. Some EDA tools require verification statements to be labeled.
Definition at line 87 of file LoweringOptions.h.
Referenced by legalizeModuleLocalNames(), parse(), and toString().
bool circt::LoweringOptions::explicitBitcast = false |
Add an explicit bitcast for avoiding bitwidth mismatch LINT errors.
Definition at line 100 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::fixUpEmptyModules = false |
If true, add a dummy wire to empty modules to prevent tools from regarding the module as blackbox.
Definition at line 172 of file LoweringOptions.h.
Referenced by parse(), circt::ExportVerilog::prepareHWModule(), and toString().
enum circt::LoweringOptions::LocationInfoStyle circt::LoweringOptions::locationInfoStyle = Plain |
Referenced by parse(), and toString().
unsigned circt::LoweringOptions::maximumNumberOfTermsPerExpression = DEFAULT_TERM_LIMIT |
Definition at line 92 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::mitigateVivadoArrayIndexConstPropBug = false |
If true, every expression used as an array index is driven by a wire, and the wire is marked as (* keep = "true" *)
.
Certain versions of Vivado produce incorrect synthesis results for certain arithmetic ops inlined into the array index.
Definition at line 149 of file LoweringOptions.h.
Referenced by legalizeHWModule(), parse(), and toString().
bool circt::LoweringOptions::noAlwaysComb = false |
If true, emits sv.alwayscomb
as Verilog always @(*)
statements.
Otherwise, print them as always_comb
.
Definition at line 64 of file LoweringOptions.h.
Referenced by parse(), and toString().
bool circt::LoweringOptions::omitVersionComment = false |
If true, do not emit a version comment at the top of each verilog file.
Definition at line 160 of file LoweringOptions.h.
Referenced by circt::ExportVerilog::SharedEmitterState::collectOpsForFile(), parse(), and toString().
bool circt::LoweringOptions::printDebugInfo = false |
Print debug info.
Definition at line 118 of file LoweringOptions.h.
Referenced by parse(), and toString().
unsigned circt::LoweringOptions::wireSpillingHeuristicSet = 0 |
Definition at line 131 of file LoweringOptions.h.
Referenced by isWireSpillingHeuristicEnabled(), and parse().
unsigned circt::LoweringOptions::wireSpillingNamehintTermLimit = DEFAULT_NAMEHINT_TERM_LIMIT |
Definition at line 138 of file LoweringOptions.h.
Referenced by parse().