Support multiple alternative case expressions.
[matthijs/master-project/cλash.git] / Pretty.hs
index 6d495694f8a7fc4dab1fbe14b9378d550f67a8f7..6608f809088919db992ff7d5a57d62cb2ba623a4 100644 (file)
--- a/Pretty.hs
+++ b/Pretty.hs
@@ -51,8 +51,17 @@ instance Pretty FlatFunction where
 instance Pretty SigDef where
   pPrint (FApp func args res) =
     pPrint func <> text " : " <> pPrint args <> text " -> " <> pPrint res
-  pPrint (CondDef _ _ _ _) = text "TODO"
-  pPrint (UncondDef src dst) = text "TODO"
+  pPrint (CondDef cond true false res) = 
+    pPrint cond <> text " ? " <> pPrint true <> text " : " <> pPrint false <> text " -> " <> pPrint res
+  pPrint (UncondDef src dst) =
+    ppsrc src <> text " -> " <> pPrint dst
+    where
+      ppsrc (Left id) = pPrint id
+      ppsrc (Right expr) = pPrint expr
+
+instance Pretty SignalExpr where
+  pPrint (EqLit id lit) =
+    parens $ pPrint id <> text " = " <> text lit
 
 instance Pretty SignalInfo where
   pPrint (SignalInfo name use ty) =