Put CaseInv and PatternInv in the same float.
authorMatthijs Kooijman <matthijs@stdin.nl>
Tue, 8 Dec 2009 17:00:41 +0000 (18:00 +0100)
committerMatthijs Kooijman <matthijs@stdin.nl>
Tue, 8 Dec 2009 17:00:41 +0000 (18:00 +0100)
Chapters/HardwareDescription.tex

index 479dd400640b5dfa38de5a2c929d41ef79f75a54..cac03ed6c0de15d13d27e005eaa959b9d446ba2a 100644 (file)
@@ -253,7 +253,13 @@ and3 a b c = and (and a b) c
       False -> True
     \stopbuffer
 
       False -> True
     \stopbuffer
 
-    \startuseMPgraphic{CaseInv}
+    \startbuffer[PatternInv]
+    inv :: Bool -> Bool
+    inv True = False
+    inv False = True
+    \stopbuffer
+
+    \startuseMPgraphic{Inv}
       save in, truecmp, falseout, trueout, out, cmp, mux;
 
       % I/O ports
       save in, truecmp, falseout, trueout, out, cmp, mux;
 
       % I/O ports
@@ -287,7 +293,7 @@ and3 a b c = and (and a b) c
       ncline(mux)(out) "posA(out)";
     \stopuseMPgraphic
     
       ncline(mux)(out) "posA(out)";
     \stopuseMPgraphic
     
-    \startbuffer[CaseInvVHDL]
+    \startbuffer[InvVHDL]
       entity invComponent_0 is
            port (\xzAMo2\ : in boolean;
                  \reszAMuzAMu2\ : out boolean;
       entity invComponent_0 is
            port (\xzAMo2\ : in boolean;
                  \reszAMuzAMu2\ : out boolean;
@@ -303,25 +309,34 @@ and3 a b c = and (and a b) c
       end architecture structural; 
     \stopbuffer
 
       end architecture structural; 
     \stopbuffer
 
-    \placeexample[][ex:CaseInv]{Simple inverter.}
-      \startcombination[2*1]
-        {\typebufferhs{CaseInv}}{Haskell description using a Case expression.}
-        {\boxedgraphic{CaseInv}}{The architecture described by the Haskell description.}
-      \stopcombination
-
-    \placeexample[][ex:CaseInvVHDL]{\VHDL\ generated for \hs{inv} from
-    \in{example}[ex:CaseInv] and \in{example}[ex:PatternInv]}
-        {\typebuffervhdl{CaseInvVHDL}}
-
-    \startbuffer[PatternInv]
-    inv :: Bool -> Bool
-    inv True = False
-    inv False = True
-    \stopbuffer
+    \placeexample[][ex:Inv]{Simple inverter.}{
+      % Use placesidebyside, since nesting combinations doesn't seem to work
+      % here. This does break centering, but well...
+      \placesidebyside
+        % Use 2*2 instead of 1*2 to insert some extra space (\placesidebyside
+        % places stuff very close together)
+        {\startcombination[2*2]
+          {\typebufferhs{CaseInv}}{Haskell description using a Case expression.}
+          {}{}
+          {\typebufferhs{PatternInv}}{Haskell description using Pattern matching expression.}
+          {}{}
+        \stopcombination}
+        % Use a 1*1 combination to add a caption
+        {\startcombination[1*1]
+          {\boxedgraphic{Inv}}{The architecture described by the Haskell descriptions.}
+        \stopcombination}
+      }
 
 
-    \placeexample[][ex:PatternInv]{Simple inverter using pattern matching.
-    Describes the same architecture as \in{example}[ex:CaseInv].}
-        {\typebufferhs{PatternInv}}
+%    \placeexample[][ex:Inv]{Simple inverter.}{
+%        \startcombination[2*2]
+%          {\typebufferhs{CaseInv}}{Haskell description using a Case expression.}
+%          {}{}
+%          {\typebufferhs{PatternInv}}{Haskell description using Pattern matching expression.}
+%          {\boxedgraphic{Inv}}{The architecture described by the Haskell description.}
+%        \stopcombination
+%    }
+    \placeexample[][ex:InvVHDL]{\VHDL\ generated for \hs{inv} from \in{example}[ex:Inv]}
+        {\typebuffervhdl{InvVHDL}}
 
   \section{Types}
     Translation of two most basic functional concepts has been
 
   \section{Types}
     Translation of two most basic functional concepts has been