3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-19 10:52:03 +00:00

docs: fix verilog frontend internals

This commit is contained in:
Emil J. Tywoniak 2025-07-09 16:11:10 +02:00
parent 56058b3ed4
commit e690fb59f1

View file

@ -47,9 +47,9 @@ be found in :file:`frontends/verilog/verilog_lexer.l` in the Yosys source tree.
The lexer does little more than identifying all keywords and literals recognised The lexer does little more than identifying all keywords and literals recognised
by the Yosys Verilog frontend. by the Yosys Verilog frontend.
The lexer keeps track of the current location in the Verilog source code using The lexer keeps track of the current location in the Verilog source code with
some VerilogLexer member variables. These variables are used by the constructor of AST nodes a ``VerilogLexer::out_loc`` and uses it to construct parser-defined
to annotate each node with the source code location it originated from. symbol objects.
Finally the lexer identifies and handles special comments such as "``// synopsys Finally the lexer identifies and handles special comments such as "``// synopsys
translate_off``" and "``// synopsys full_case``". (It is recommended to use translate_off``" and "``// synopsys full_case``". (It is recommended to use
@ -178,11 +178,11 @@ properties:
- | Source code location - | Source code location
| Each ``AST::AstNode`` is automatically annotated with the current source | Each ``AST::AstNode`` is automatically annotated with the current source
code location by the ``AST::AstNode`` constructor. It is stored in the code location by the ``AST::AstNode`` constructor. The ``location`` type
``std::string filename`` and ``int linenum`` member variables. is a manual reimplementation of the bison-provided location type. This
type is defined at ``frontends/verilog/verilog_location.h``.
The ``AST::AstNode`` constructor can be called with up to two child nodes that The ``AST::AstNode`` constructor can be called with up to 4 child nodes. This
are automatically added to the list of child nodes for the new object. This
simplifies the creation of AST nodes for simple expressions a bit. For example simplifies the creation of AST nodes for simple expressions a bit. For example
the bison code for parsing multiplications: the bison code for parsing multiplications:
@ -205,7 +205,7 @@ tree respectively.
Transforming AST to RTLIL Transforming AST to RTLIL
------------------------- -------------------------
The AST Frontend converts a set of modules in AST representation to modules in The AST frontend converts a set of modules in AST representation to modules in
RTLIL representation and adds them to the current design. This is done in two RTLIL representation and adds them to the current design. This is done in two
steps: simplification and RTLIL generation. steps: simplification and RTLIL generation.