Skip to content

Commit a377d7f

Browse files
authored
Revise preprocessing documentation in README
Updated the preprocessing section to clarify usage and moved example code.
1 parent 91165bc commit a377d7f

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,11 @@ As ordering of verilog modules in single or across multiple files is not preknow
122122
1. Parse modules, ports and parameters. Ignore instances and connectivity. Construct all interfaces.
123123
2. Reparse. Ignore ports and parameters. Parse instances and nets. Construct connectivity.
124124

125-
### Preprocessing output
126-
127-
You can generate preprocessed Verilog text (similar to `gcc -E`) through `VerilogConstructor`:
128-
129-
```c++
130-
VerilogConstructor constructor;
131-
// Write to a file.
132-
constructor.preprocessToPath("input.v", "output.pre.v");
133-
// Or get the text directly.
134-
std::string preprocessed = constructor.preprocessToString("input.v");
135-
```
125+
### Preprocessing
136126

137127
The parser pipeline now runs a lightweight preprocessor that supports the following directives:
138-
`define, `undef, `ifdef, `ifndef, `elsif, `else, `endif, `include, and `timescale
139-
(note: `timescale is consumed but not emitted to keep the parser output compatible).
128+
`define`, `undef`, `ifdef`, `ifndef`, `elsif`, `else`, `endif`, `include`, and `timescale`
129+
(note: `timescale` is consumed but not emitted to keep the parser output compatible).
140130

141131
Preprocessing is disabled by default. Enable it when needed, or disable it to compare performance:
142132

@@ -150,6 +140,18 @@ constructor.setPreprocessEnabled(false);
150140
constructor.parse("input.v");
151141
```
152142

143+
#### Preprocessing output
144+
145+
You can generate preprocessed Verilog text (similar to `gcc -E`) through `VerilogConstructor`:
146+
147+
```c++
148+
VerilogConstructor constructor;
149+
// Write to a file.
150+
constructor.preprocessToPath("input.v", "output.pre.v");
151+
// Or get the text directly.
152+
std::string preprocessed = constructor.preprocessToString("input.v");
153+
```
154+
153155
<div align="right">[ <a href="#naja-verilog">↑ Back to top ↑</a> ]</div>
154156

155157
## Callbacks

0 commit comments

Comments
 (0)