From: Robert Baruch Date: Wed, 25 Nov 2020 17:53:39 +0000 (-0800) Subject: Clarifies use of integers, and character set. X-Git-Tag: working-ls180~181^2~4 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=09f6e9d6b6c45b164188c8cdcc75e9628e531bfa;p=yosys.git Clarifies use of integers, and character set. --- diff --git a/manual/CHAPTER_TextRtlil.tex b/manual/CHAPTER_TextRtlil.tex index ee77a987d..12b90a7f7 100644 --- a/manual/CHAPTER_TextRtlil.tex +++ b/manual/CHAPTER_TextRtlil.tex @@ -23,6 +23,10 @@ Finally, note that all statements (rules ending in \texttt{-stmt}) terminate in \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: @@ -33,13 +37,15 @@ There are two types of identifiers in RTLIL: \end{itemize} \begin{indentgrammar}{} - ::= | | + ::= | ::= "\textbackslash" $+$ ::= "\textdollar" $+$ \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: @@ -52,11 +58,13 @@ A \textit{value} consists of a width in bits and a bit representation, most sign \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}{} ::= $+$ \texttt{\textbf{'}} $*$ + ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" + ::= "0" | "1" | "x" | "z" | "m" | "-" ::= "-"$?$ $+$ @@ -128,8 +136,6 @@ Declares a module, with zero or more attributes, consisting of zero or more wire 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}{} ::= "attribute" \end{indentgrammar} @@ -138,6 +144,8 @@ Declares an attribute with the given identifier and value. 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}{}