Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
authorChristiaan Baaij <christiaan.baaij@gmail.com>
Mon, 13 Jul 2009 10:01:00 +0000 (12:01 +0200)
committerChristiaan Baaij <christiaan.baaij@gmail.com>
Mon, 13 Jul 2009 10:01:00 +0000 (12:01 +0200)
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Generate proper VHDL for top level bindings with no arguments.
  Use is_local_var for limiting appsimpl and letsimpl.
  Add newline at the end of file.
  Add is_local_var predicate.
  Santize comment dashes position.
  Normalize all used global binders.

CoreTools.hs
VHDLTools.hs
VHDLTypes.hs

index bd6f329c537ea93842bf5b221998cf47fb69085c..3bfe1a156dfc89826e6070d7255a854ad514add6 100644 (file)
@@ -38,9 +38,10 @@ import Pretty
 
 -- | Evaluate a core Type representing type level int from the tfp
 -- library to a real int.
-eval_tfp_int :: Type.Type -> Int
-eval_tfp_int ty =
+eval_tfp_int :: HscTypes.HscEnv -> Type.Type -> Int
+eval_tfp_int env ty =
   unsafeRunGhc $ do
+    GHC.setSession env
     -- Automatically import modules for any fully qualified identifiers
     setDynFlag DynFlags.Opt_ImplicitImportQualified
 
index 1e6e5bc1d09e6a956bb5b53fc7039e2985afb406..e7c598d498d322222821bdaf091422ca778e5f96 100644 (file)
@@ -473,9 +473,8 @@ mkHType ty = do
               case elem_htype_either of
                 -- Could create element type
                 Right elem_htype -> do
-                  env <- getA vsHscEnv
-                  let norm_ty = normalise_tfp_int env (tfvec_len_ty ty)
-                  return $ Right $ VecType (OrdType norm_ty) elem_htype
+                  len <- tfp_to_int (tfvec_len_ty ty)
+                  return $ Right $ VecType len elem_htype
                 -- Could not create element type
                 Left err -> return $ Left $ 
                   "VHDLTools.mkHType: Can not construct vectortype for elementtype: " ++ pprString el_ty  ++ "\n"
@@ -527,10 +526,12 @@ isReprType ty = do
 tfp_to_int :: Type.Type -> TypeSession Int
 tfp_to_int ty = do
   lens <- getA vsTfpInts
-  let existing_len = Map.lookup (OrdType ty) lens
+  hscenv <- getA vsHscEnv
+  let norm_ty = normalise_tfp_int hscenv ty
+  let existing_len = Map.lookup (OrdType norm_ty) lens
   case existing_len of
     Just len -> return len
     Nothing -> do
-      let new_len = eval_tfp_int ty
-      modA vsTfpInts (Map.insert (OrdType ty) (new_len))
+      let new_len = eval_tfp_int hscenv ty
+      modA vsTfpInts (Map.insert (OrdType norm_ty) (new_len))
       return new_len
\ No newline at end of file
index b4c1d6981c2f757df4fb7c5049375aa4845bcb59..5562c6a7a0db0fc6cf9eb10654ce88f36fc7a343 100644 (file)
@@ -41,7 +41,7 @@ instance Ord OrdType where
 
 data HType = StdType OrdType |
              ADTType String [HType] |
-             VecType OrdType HType |
+             VecType Int HType |
              SizedWType Int |
              RangedWType Int |
              SizedIType Int |