[−][src]Crate moore_svlog
The SystemVerilog implementation of the moore compiler.
This crate implements a query-based compiler for the SystemVerilog language. It strives to be a complete implementation of IEEE 1800-2017, mapping any input source text to the equivalent LLHD code.
The implementation uses different representations of the source text for different parts of the compilation. Such a scheme is necessary due to the very messy nature of SystemVerilog, with its strange mixture of static and dynamic typing. Although the compiler uses queries to be able to handle the more involved and loopy dependencies, the representations form a rough chain of processing that each construct flows through (albeit each at its own pace):
- AST: Abstract Syntax Tree emitted by the parser in the
syntax
crate. - RST: Resolved Syntax Tree which has ambiguities in the grammar resolved. This is possible by building name resolution scopes and defs on the AST representation, and resolving names to disambiguate things in the grammar.
- HIR: The High-level Intermediate Representation, which does things
like taking the list of constructs in a module body and separating them
into lists of declarations, instances, parameters, etc. Also tries to get
rid of syntactic sugar where appropriate. Type-checking is performed on
this representation, and
ParamEnv
is used to represent different parametrizations of the same HIR module/interface. - MIR: The Medium-level Intermediate Representation, which has all implicit casting operations and parametrizations made explicit and fully unrolled. At this point most SystemVerilog craziness has been resolved and the nodes are crisp and have a clean, fully checked type.
- LLHD: The Low-level Hardware Description, emitted as the final step during code generation.
Re-exports
pub extern crate moore_svlog_syntax as syntax; |
Modules
ast | An abstract syntax tree for SystemVerilog. |
cat | The categorizing lexer. Tokenizes an input stream of characters, yielding a stream of newline, whitespace, comment, symbol, and text tokens. |
hir | The high-level intermediate representation for SystemVerilog. |
lexer | A lexical analyzer for SystemVerilog files, based on IEEE 1800-2009, section 5. |
mir | The medium-level intermediate representation for SystemVerilog. |
parser | A parser for the SystemVerilog language. Based on IEEE 1800-2009. |
pattern_mapping | A mapping from a pattern expression's arguments to the underlying type's fields. |
port_list | A list of ports on a node, with ANSI/non-ANSI styles resolved. |
preproc | A preprocessor for SystemVerilog files that takes the raw stream of tokens generated by a lexer and performs include and macro resolution. |
resolver | Name resolution. |
rst | A resolved syntax tree. |
token | Defines all tokens that may result from performing lexical analysis on a SystemVerilog source file. This module is inspired heavily by the tokens used in the Rust compiler. |
ty | A generalized SystemVerilog type system. |
typeck | Type checking and computation. |
value | Representation of constant values and their operations |
Macros
assert_span | Assert that a condition holds, or emit a bug diagnostic and panic. |
assert_type | Assert that two types are identical, or emit a bug diagnostic and panic. |
bug_span | Emit a bug diagnostic and panic. |
Structs
AccessedNodesQueryKey | The arguments passed to the |
CanonicalizePortsQueryKey | The arguments passed to the |
CastExprTypeQueryKey | The arguments passed to the |
CastTypeQueryKey | The arguments passed to the |
CodeGenerator | A code generator. |
ConstMirRvalueIntQueryKey | The arguments passed to the |
ConstMirRvalueQueryKey | The arguments passed to the |
ConstMirRvalueStringQueryKey | The arguments passed to the |
ConstantValueOfQueryKey | The arguments passed to the |
DisambKindQueryKey | The arguments passed to the |
DisambTypeOrExprQueryKey | The arguments passed to the |
GeneratedScopeQueryKey | The arguments passed to the |
GlobalArenas | The arenas that allocate things in the global context. |
GlobalContext | The central data structure of the compiler. It stores references to various arenas and tables that store the results of the various computations that have been performed. |
GlobalTables | The lookup tables for a global context. |
HierarchicalRibQueryKey | The arguments passed to the |
HirOfExprQueryKey | The arguments passed to the |
HirOfInterfaceQueryKey | The arguments passed to the |
HirOfModuleQueryKey | The arguments passed to the |
HirOfQueryKey | The arguments passed to the |
InstDetails | Instantiation details |
InstDetailsQueryKey | The arguments passed to the |
InstTargetDetails | Instantiation target details |
InstTargetDetailsQueryKey | The arguments passed to the |
InstVerbosityVisitor | A visitor that emits instantiation details diagnostics. |
IsConstantQueryKey | The arguments passed to the |
LocalRibQueryKey | The arguments passed to the |
MapPatternQueryKey | The arguments passed to the |
MapToTypeOrErrorQueryKey | The arguments passed to the |
MapToTypeQueryKey | The arguments passed to the |
MirAssignmentFromConcurrentQueryKey | The arguments passed to the |
MirAssignmentFromProceduralQueryKey | The arguments passed to the |
MirLvalueQueryKey | The arguments passed to the |
MirRvalueQueryKey | The arguments passed to the |
MirSimplifyAssignmentQueryKey | The arguments passed to the |
Name | A name is a lightweight 32 bit tag that refers to a string in a name table. During parsing, encountered strings are inserted into the name table and only the corresponding tag is kept in the token. Names which have their most significant bit set represent case sensitive names, such as for extended identifiers. |
NameckQueryKey | The arguments passed to the |
NeedOperationTypeQueryKey | The arguments passed to the |
NeedSelfDeterminedTypeQueryKey | The arguments passed to the |
NeedTypeContextQueryKey | The arguments passed to the |
NodeEnvId | A node id with corresponding parameter environment. |
OperationTypeQueryKey | The arguments passed to the |
PackedTypeFromAstQueryKey | The arguments passed to the |
ParamEnv | A parameter environment. |
ParamEnvData | A parameter environment. |
ParamEnvQueryKey | The arguments passed to the |
PortMapping | A port mapping. |
PortMappingQueryKey | The arguments passed to the |
QueryStorage | A collection of query caches and runtime data for a |
Ref | A node reference. |
ResolveDownwardsQueryKey | The arguments passed to the |
ResolveFieldAccessQueryKey | The arguments passed to the |
ResolveHierarchicalOrErrorQueryKey | The arguments passed to the |
ResolveHierarchicalQueryKey | The arguments passed to the |
ResolveImportedScopeQueryKey | The arguments passed to the |
ResolveInstTargetQueryKey | The arguments passed to the |
ResolveLocalOrErrorQueryKey | The arguments passed to the |
ResolveLocalQueryKey | The arguments passed to the |
ResolveNamespaceOrErrorQueryKey | The arguments passed to the |
ResolveNamespaceQueryKey | The arguments passed to the |
ResolveNodeQueryKey | The arguments passed to the |
ResolveUpwardsQueryKey | The arguments passed to the |
ScopeLocationQueryKey | The arguments passed to the |
SelfDeterminedTypeQueryKey | The arguments passed to the |
Span | A span of locations within a source file, expressed as a half-open interval
of bytes |
Spanned | A wrapper that associates a span with a value. |
StructDefQueryKey | The arguments passed to the |
TypeContextQueryKey | The arguments passed to the |
TypeDefaultValueQueryKey | The arguments passed to the |
TypeOfExprQueryKey | The arguments passed to the |
TypeOfExtPortQueryKey | The arguments passed to the |
TypeOfInstQueryKey | The arguments passed to the |
TypeOfIntPortQueryKey | The arguments passed to the |
TypeOfNetDeclQueryKey | The arguments passed to the |
TypeOfPortDeclQueryKey | The arguments passed to the |
TypeOfQueryKey | The arguments passed to the |
TypeOfStructMemberQueryKey | The arguments passed to the |
TypeOfValueParamQueryKey | The arguments passed to the |
TypeOfVarDeclQueryKey | The arguments passed to the |
UnpackedTypeFromAstQueryKey | The arguments passed to the |
Enums
ParamEnvBinding | A binding in a parameter environment. |
ParamEnvSource | A location that implies a parameter environment. |
PortMappingSource | A location that implies a port mapping. |
QueryTag | A tag identifying any of the queries in |
Traits
Context | The fundamental compiler context. |
IntoNodeEnvId | A helper trait to allow for easy wrapping of node IDs. |
QueryDatabase | A collection of compiler queries. |
Type Definitions
Result | A general result returned by the queries. |