Crate moore_svlog[−][src]
Expand description
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
An abstract syntax tree for SystemVerilog.
The categorizing lexer. Tokenizes an input stream of characters, yielding a stream of newline, whitespace, comment, symbol, and text tokens.
The high-level intermediate representation for SystemVerilog.
A lexical analyzer for SystemVerilog files, based on IEEE 1800-2009, section 5.
The medium-level intermediate representation for SystemVerilog.
A parser for the SystemVerilog language. Based on IEEE 1800-2009.
A mapping from a pattern expression’s arguments to the underlying type’s fields.
A list of ports on a node, with ANSI/non-ANSI styles resolved.
A preprocessor for SystemVerilog files that takes the raw stream of tokens generated by a lexer and performs include and macro resolution.
Name resolution.
A resolved syntax tree.
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.
A generalized SystemVerilog type system.
Type checking and computation.
Representation of constant values and their operations
Macros
Assert that a condition holds, or emit a bug diagnostic and panic.
Assert that two types are identical, or emit a bug diagnostic and panic.
Emit a bug diagnostic and panic.
Structs
The arguments passed to the accessed_nodes
query.
The arguments passed to the canonicalize_ports
query.
The arguments passed to the cast_expr_type
query.
The arguments passed to the cast_type
query.
A code generator.
The arguments passed to the const_mir_rvalue_int
query.
The arguments passed to the const_mir_rvalue
query.
The arguments passed to the const_mir_rvalue_string
query.
The arguments passed to the constant_value_of
query.
The arguments passed to the disamb_kind
query.
The arguments passed to the disamb_type_or_expr
query.
The arguments passed to the generated_scope
query.
The arenas that allocate things in the global context.
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.
The lookup tables for a global context.
The arguments passed to the hierarchical_rib
query.
The arguments passed to the hir_of_expr
query.
The arguments passed to the hir_of_interface
query.
The arguments passed to the hir_of_module
query.
The arguments passed to the hir_of
query.
Instantiation details
The arguments passed to the inst_details
query.
Instantiation target details
The arguments passed to the inst_target_details
query.
A visitor that emits instantiation details diagnostics.
The arguments passed to the is_constant
query.
The arguments passed to the local_rib
query.
The arguments passed to the map_pattern
query.
The arguments passed to the map_to_type_or_error
query.
The arguments passed to the map_to_type
query.
The arguments passed to the mir_assignment_from_concurrent
query.
The arguments passed to the mir_assignment_from_procedural
query.
The arguments passed to the mir_lvalue
query.
The arguments passed to the mir_rvalue
query.
The arguments passed to the mir_simplify_assignment
query.
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.
The arguments passed to the nameck
query.
The arguments passed to the need_operation_type
query.
The arguments passed to the need_self_determined_type
query.
The arguments passed to the need_type_context
query.
A node id with corresponding parameter environment.
The arguments passed to the operation_type
query.
The arguments passed to the packed_type_from_ast
query.
A parameter environment.
A parameter environment.
The arguments passed to the param_env
query.
A port mapping.
The arguments passed to the port_mapping
query.
A collection of query caches and runtime data for a QueryDatabase
.
A node reference.
The arguments passed to the resolve_downwards
query.
The arguments passed to the resolve_field_access
query.
The arguments passed to the resolve_hierarchical_or_error
query.
The arguments passed to the resolve_hierarchical
query.
The arguments passed to the resolve_imported_scope
query.
The arguments passed to the resolve_inst_target
query.
The arguments passed to the resolve_local_or_error
query.
The arguments passed to the resolve_local
query.
The arguments passed to the resolve_namespace_or_error
query.
The arguments passed to the resolve_namespace
query.
The arguments passed to the resolve_node
query.
The arguments passed to the resolve_upwards
query.
The arguments passed to the scope_location
query.
The arguments passed to the self_determined_type
query.
A span of locations within a source file, expressed as a half-open interval
of bytes [begin,end)
.
A wrapper that associates a span with a value.
The arguments passed to the struct_def
query.
The arguments passed to the type_context
query.
The arguments passed to the type_default_value
query.
The arguments passed to the type_of_expr
query.
The arguments passed to the type_of_ext_port
query.
The arguments passed to the type_of_inst
query.
The arguments passed to the type_of_int_port
query.
The arguments passed to the type_of_net_decl
query.
The arguments passed to the type_of_port_decl
query.
The arguments passed to the type_of
query.
The arguments passed to the type_of_struct_member
query.
The arguments passed to the type_of_value_param
query.
The arguments passed to the type_of_var_decl
query.
The arguments passed to the unpacked_type_from_ast
query.
Enums
A binding in a parameter environment.
A location that implies a parameter environment.
A location that implies a port mapping.
A tag identifying any of the queries in QueryDatabase
.
Traits
The fundamental compiler context.
A helper trait to allow for easy wrapping of node IDs.
A collection of compiler queries.
Type Definitions
A general result returned by the queries.