Since its exact role and need is not clear yet, this transformation is
not yet specified.
- \subsubsection{Compiler generated top level binding inlining}
- TODO
+ \subsubsection{Top level binding inlining}
+ This transform takes simple top level bindings generated by the
+ \small{GHC} compiler. \small{GHC} sometimes generates very simple
+ \quote{wrapper} bindings, which are bound to just a variable
+ reference, or a partial application to constants or other variable
+ references.
+
+ Note that this transformation is completely optional. It is not
+ required to get any function into normal form, but it does help making
+ the resulting VHDL output easier to read (since it removes a bunch of
+ components that are really boring).
+
+ This transform takes any top level binding generated by the compiler,
+ whose normalized form contains only a single let binding.
+
+ \starttrans
+ x = λa0 ... λan.let y = E in y
+ ~
+ x
+ -------------------------------------- \lam{x} is generated by the compiler
+ λa0 ... λan.let y = E in y
+ \stoptrans
+
+ \startbuffer[from]
+ (+) :: Word -> Word -> Word
+ (+) = GHC.Num.(+) @Word $dNum
+ ~
+ (+) a b
+ \stopbuffer
+ \startbuffer[to]
+ GHC.Num.(+) @ Alu.Word $dNum a b
+ \stopbuffer
+
+ \transexample{Top level binding inlining}{from}{to}
+
+ Without this transformation, the (+) function would generate an
+ architecture which would just add its inputs. This generates a lot of
+ overhead in the VHDL, which is particularly annoying when browsing the
+ generated RTL schematic (especially since + is not allowed in VHDL
+ architecture names\footnote{Technically, it is allowed when using
+ extended identifiers, but it seems that none of the tooling likes
+ extended identifiers in filenames, so it effectively doesn't work}, so
+ the entity would be called \quote{w7aA7f} or something similarly
+ unreadable and autogenerated).
\subsection{Program structure}
These transformations are aimed at normalizing the overall structure