\section{Lexical elements}
+\subsection{Characters}
+
+The characters accepted in an RTLIL file are those encodable in 8 bits. Unicode is not supported. For maximum safety, limit characters to the 7-bit ASCII range $[0,127]$.
+
\subsection{Identifiers}
There are two types of identifiers in RTLIL:
\end{itemize}
\begin{indentgrammar}{<autogen-id>}
-<id> ::= <public-id> | <autogen-id> | <dotted-id>
+<id> ::= <public-id> | <autogen-id>
<public-id> ::= "\textbackslash" <nonws>$+$
<autogen-id> ::= "\textdollar" <nonws>$+$
\end{indentgrammar}
+A \texttt{nonws} character is any character other than a space (ASCII 32), tab (ASCII 9), newline (ASCII 10), or carriage return (ASCII 13).
+
\subsection{Values}
A \textit{value} consists of a width in bits and a bit representation, most significant bit first. Bits may be any of:
\item \texttt{-}: A don't care value
\end{itemize}
-An \textit{integer} is simply a signed integer value in decimal format.
+An \textit{integer} is simply a signed integer value in decimal format. \textbf{Warning:} Integer constants are limited to 32 bits. That is, they may only be in the range $[-2147483648, 2147483648)$. Integers outside this range will result in an error.
\begin{indentgrammar}{<binary-digit>}
<value> ::= <decimal-digit>$+$ \texttt{\textbf{'}} <binary-digit>$*$
+<decimal-digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
+
<binary-digit> ::= "0" | "1" | "x" | "z" | "m" | "-"
<integer> ::= "-"$?$ <decimal-digit>$+$
Declares an attribute with the given identifier and value.
-\textbf{Warning:} Integer constants greater than 32 bits are silently truncated to 32 bits and treated as unsigned.
-
\begin{indentgrammar}{<attr-stmt>}
<attr-stmt> ::= "attribute" <id> <constant> <eol>
\end{indentgrammar}
A signal is anything that can be applied to a cell port, i.e. a constant value, all bits or a selection of bits from a wire, or concatenations of those.
+\textbf{Warning:} When an integer constant is a sigspec, it is always 32 bits wide, 2's complement. For example, a constant of $-1$ is the same as \texttt{32'11111111111111111111111111111111}, while a constant of $1$ is the same as \texttt{32'1}.
+
See Sec.~\ref{sec:rtlil_sigspec} for an overview of signal specifications.
\begin{indentgrammar}{<sigspec>}