Skip to content

Commit a80462f

Browse files
authored
Merge pull request #5339 from rocallahan/fast-rtlil-parser
Rewrite the RTLIL parser for efficiency
2 parents b7a7281 + 915ad94 commit a80462f

File tree

8 files changed

+806
-793
lines changed

8 files changed

+806
-793
lines changed

docs/source/appendix/rtlil_text.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ significant bit first. Bits may be any of:
6363
- ``m``: A marked bit (internal use only)
6464
- ``-``: A don't care value
6565

66+
When the bit representation has fewer bits than the width, it is padded to the width with
67+
the most significant explicit bit, or ``0`` if the most significant explicit bit is ``1``,
68+
or ``x`` if there are no explicit bits.
69+
6670
An *integer* is simply a signed integer value in decimal format. **Warning:**
6771
Integer constants are limited to 32 bits. That is, they may only be in the range
6872
:math:`[-2147483648, 2147483648)`. Integers outside this range will result in an
@@ -133,6 +137,7 @@ wires, memories, cells, processes, and connections.
133137
<module> ::= <attr-stmt>* <module-stmt> <module-body> <module-end-stmt>
134138
<module-stmt> ::= module <id> <eol>
135139
<module-body> ::= (<param-stmt>
140+
| <conn-stmt>
136141
| <wire>
137142
| <memory>
138143
| <cell>
@@ -170,6 +175,11 @@ See :ref:`sec:rtlil_sigspec` for an overview of signal specifications.
170175
| <sigspec> [ <integer> (:<integer>)? ]
171176
| { <sigspec>* }
172177
178+
When a ``<wire-id>`` is specified, the wire must have been previously declared.
179+
180+
When a signal slice is specified, the left-hand integer must be greather than or
181+
equal to the right-hand integer.
182+
173183
Connections
174184
^^^^^^^^^^^
175185

@@ -268,7 +278,7 @@ may have zero or more attributes.
268278
.. code:: BNF
269279
270280
<switch> ::= <switch-stmt> <case>* <switch-end-stmt>
271-
<switch-stmt> := <attr-stmt>* switch <sigspec> <eol>
281+
<switch-stmt> ::= <attr-stmt>* switch <sigspec> <eol>
272282
<case> ::= <attr-stmt>* <case-stmt> <case-body>
273283
<case-stmt> ::= case <compare>? <eol>
274284
<compare> ::= <sigspec> (, <sigspec>)*
@@ -295,3 +305,4 @@ be:
295305
| sync always <eol>
296306
<sync-type> ::= low | high | posedge | negedge | edge
297307
<update-stmt> ::= update <dest-sigspec> <src-sigspec> <eol>
308+
| <attr-stmt>* memwr <id> <sigspec> <sigspec> <sigspec> <constant> <eol>

frontends/rtlil/Makefile.inc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
2-
GENFILES += frontends/rtlil/rtlil_parser.tab.cc
3-
GENFILES += frontends/rtlil/rtlil_parser.tab.hh
4-
GENFILES += frontends/rtlil/rtlil_parser.output
5-
GENFILES += frontends/rtlil/rtlil_lexer.cc
6-
7-
frontends/rtlil/rtlil_parser.tab.cc: frontends/rtlil/rtlil_parser.y
8-
$(Q) mkdir -p $(dir $@)
9-
$(P) $(BISON) -o $@ -d -r all -b frontends/rtlil/rtlil_parser $<
10-
11-
frontends/rtlil/rtlil_parser.tab.hh: frontends/rtlil/rtlil_parser.tab.cc
12-
13-
frontends/rtlil/rtlil_lexer.cc: frontends/rtlil/rtlil_lexer.l
14-
$(Q) mkdir -p $(dir $@)
15-
$(P) flex -o frontends/rtlil/rtlil_lexer.cc $<
16-
17-
OBJS += frontends/rtlil/rtlil_parser.tab.o frontends/rtlil/rtlil_lexer.o
181
OBJS += frontends/rtlil/rtlil_frontend.o
19-

0 commit comments

Comments
 (0)