Fix todo's in the introduction chapter.
[matthijs/master-project/report.git] / Chapters / Introduction.tex
index 6080bc02d007860ad2b2084b0b70ba142acec784..f88b2257affdd9b5167b45e33edd60e33fd1c88d 100644 (file)
@@ -1,5 +1,4 @@
 \chapter[chap:introduction]{Introduction}
-\fixme{No chapter number?}
 This thesis describes the result and process of my work during my
 Master's assignment. In these pages, I will try to introduce the world
 of hardware descriptions, the world of functional languages and
@@ -7,25 +6,24 @@ compilers and introduce the hardware description language Cλash that will
 connect these worlds and puts a step towards making hardware programming
 on the whole easier, more maintainable and generally more pleasant.
 
-\section{Research goals}
+% Use \subject to hide this section from the toc
+\subject{Research goals}
   This research started out with the notion that a functional program is very
   easy to interpret as a hardware description. A functional program typically
   does no assumptions about evaluation order and does not have any side
   effects. This fits hardware nicely, since the evaluation order for hardware
   is simply everything in parallel.
 
-  As a motivating example, consider the following simple functional
-  program:\footnote[notfinalsyntax]{Note that this example is not in the final
-  Cλash syntax}
+  As a motivating example, consider the simple functional program shown in
+  \in{example}[ex:AndWord]\footnote[notfinalsyntax]{Note that this example is not in the final
+  Cλash syntax}. This is a very natural way to describe a lot of parallel not
+  ports, that perform a bitwise not on a bitvector. The example also shows an
+  image of the architecture described.
 
-\starttyping
-notword :: [Bit] -> [Bit]
-notword = map not
-\stoptyping
-
-  This is a very natural way to describe a lot of parallel not ports, that
-  perform a bitwise not on a bitvector. The architecture described would look
-  like the following:
+  \startbuffer[AndWord]
+    notword :: [Bit] -> [Bit]
+    notword = map not
+  \stopbuffer
 
   \startuseMPgraphic{AndWord}
     % Create objects
@@ -60,32 +58,35 @@ notword = map not
     % Draw a dotted line between the middle operations
     ncline(a2)(a3) "linestyle(dashed withdots)", "arrows(-)";
   \stopuseMPgraphic
-  \useMPgraphic{AndWord}
-  \todo{Float graphic?}
-
-  Slightly more complicated is the following incremental summation of
-  values:\note[notfinalsyntax]
-
-\starttyping
-sum :: [Int] -> [Int]
-sum = sum' 0
-
-sum' :: Int -> [Int] -> [Int]
-sum' acc [] = []
-sum' acc (x:xs) = acc' : (sum' acc' xs)
-  where acc' = x + acc
-\stoptyping
-
-  Here we see a recursive function \hs{sum'} that recurses over a list and
-  takes an accumulator argument that stores the sum so far. On each step of
-  the recusion, another number from the input vector is added to the
+  \placeexample[here][ex:AndWord]{Simple architecture that inverts a vector of bits.}
+    \startcombination[2*1]
+      {\typebufferlam{AndWord}}{Haskell description of the architecture.}
+      {\boxedgraphic{AndWord}}{The architecture described by the Haskell description.}
+    \stopcombination
+
+  Slightly more complicated is the incremental summation of
+  values show in \in{example}[ex:RecursiveSum]\note[notfinalsyntax].
+
+  In this example we see a recursive function \hs{sum'} that recurses over a
+  list and takes an accumulator argument that stores the sum so far. On each
+  step of the recusion, another number from the input vector is added to the
   accumulator and each intermediate step returns its result.
 
-  So, this is a nice description of a series of sequential adders that produce
+  This is a nice description of a series of sequential adders that produce
   the incremental sums of a vector of numbers. For an input list of length 4,
-  this is the corresponding architecture:
+  the corresponding architecture is show in the example.
+
+  \startbuffer[RecursiveSum]
+    sum :: [Int] -> [Int]
+    sum = sum' 0
 
-  \startMPcode
+    sum' :: Int -> [Int] -> [Int]
+    sum' acc [] = []
+    sum' acc (x:xs) = acc' : (sum' acc' xs)
+      where acc' = x + acc
+  \stopbuffer
+
+  \startuseMPgraphic{RecursiveSum}
     save inp, a, zero, out;
     % Create objects
     newCircle.inp(btex $\overrightarrow{input}$ etex) "framed(false)";
@@ -129,13 +130,20 @@ sum' acc (x:xs) = acc' : (sum' acc' xs)
     ncline(a3)(a4);
     ncline(a4)(out);
     drawObj(out);
-  \stopMPcode
+  \stopuseMPgraphic
+
+  \placeexample[here][ex:RecursiveSum]{A recursive description that sums values.}
+    \startcombination[2*1]
+      {\typebufferlam{RecursiveSum}}{Haskell description of the architecture.}
+      {\boxedgraphic{RecursiveSum}}{The architecture described by the Haskell description.}
+    \stopcombination
+
 
   Or... is this the description of a single accumulating adder, that will add
   one element of each input each clock cycle and has a reset value of 0? In
-  that case, we would have described this architecture:
+  that case, we would have described the architecture show in \in{example}[ex:RecursiveSumAlt]
 
-  \startMPcode
+  \startuseMPgraphic{RecursiveSumAlt}
     save reg, inp, a, out;
     newReg.reg("") "dx(4mm)", "dy(6mm)", "reflect(true)";
     newCircle.inp(btex $input$ etex) "framed(false)";
@@ -160,7 +168,10 @@ sum' acc (x:xs) = acc' : (sum' acc' xs)
     % reg.out to a
     nccurve(reg)(a) "posA(out)", "angleA(180)", "angleB(-30)";
     ncline(a)(out);
-  \stopMPcode
+  \stopuseMPgraphic
+
+  \placeexample[here][ex:RecursiveSumAlt]{An alternative interpretation of the description in \in{example}[ex:RecursiveSum]}
+    {\boxedgraphic{RecursiveSumAlt}}
 
   The distinction in possible interpretations we see here, is an important
   distinction in this research. In the first figure, the recursion in the code
@@ -176,7 +187,6 @@ sum' acc (x:xs) = acc' : (sum' acc' xs)
   efficient way to describe hardware.
 
   This leads us to the following research question:
-  \todo{Include Haskell in questions?}
 
   % Slightly bigger font, some extra spacing.
   \setupquotation[style=tfb,spacebefore=5mm]
@@ -199,8 +209,6 @@ sum' acc (x:xs) = acc' : (sum' acc' xs)
     \item How to interpret higher order descriptions?
   \stopitemize
 
-  \todo{Introduce Cλash?}
-
   In addition to looking at designing a hardware description language, we
   will also implement a prototype to test drive our ideas. This prototype will
   translate hardware descriptions written in the Haskell functional language
@@ -208,9 +216,27 @@ sum' acc (x:xs) = acc' : (sum' acc' xs)
   reasons for choosing these languages are detailed in section
   \in{}[sec:prototype:input] and \in{}[sec:prototype:output] respectively.
 
-\section{Outline}
-
-\fxnote{This section needs updating}
+  \placeintermezzo{}{
+    \startframedtext[width=8cm,background=box,frame=no]
+    \startalignment[center]
+      {\tfa The name Cλash}
+    \stopalignment
+    \blank[medium]
+    The name Cλash more-or-less expands to CAES language for hardware
+    descriptions, where CAES refers to the research chair where this
+    project was undertaken (Computer Architectures for Embedded
+    Systems). The lambda in the name is of course a reference to the
+    lambda abstraction, which is an essential element of most functional
+    languages (and is also prominent in the Haskell logo).
+    \stopframedtext
+  }
+
+  The result of this research will thus be a prototype compiler and a language
+  that it can compile, to which we will refer to as the Cλash system and Cλash
+  language for short, or simply Cλash.
+
+% Use \subject to hide this section from the toc
+\subject{Outline}
 In the first chapter, we will sketch the context for this research.
 The current state and history of hardware description languages will be
 briefly discussed, as well as the state and history of functional
@@ -232,6 +258,10 @@ way of doing program transformations was required. Doing ad-hoc interpretation
 of the hardware description proved non-scalable. These transformations and
 their application are the subject of the fourth chapter.
 
-The final chapter sketches ideas for further research, which are many. Some of
+The next chapter sketches ideas for further research, which are many. Some of
 them have seen some initial exploration and could provide a basis for future
 work in this area.
+
+Finally, we present our conclusions.
+
+% vim: set sw=2 sts=2 expandtab: