projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2090dc0
)
Add some comments.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Wed, 3 Mar 2010 11:48:15 +0000
(12:48 +0100)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Wed, 3 Mar 2010 11:48:15 +0000
(12:48 +0100)
cλash/CLasH/VHDL/VHDLTools.hs
patch
|
blob
|
history
diff --git
a/cλash/CLasH/VHDL/VHDLTools.hs
b/cλash/CLasH/VHDL/VHDLTools.hs
index 7ac35a474a6412bb00d086f208fc7d264d8a20e0..2dd0a48edcd397f8cfcc9e2f37adfe1f7f26dcdd 100644
(file)
--- a/
cλash/CLasH/VHDL/VHDLTools.hs
+++ b/
cλash/CLasH/VHDL/VHDLTools.hs
@@
-304,6
+304,8
@@
isReprType ty = do
Left _ -> False
Right _ -> True
Left _ -> False
Right _ -> True
+-- | Turn a Core type into a HType, returning an error using the given
+-- error string if the type was not representable.
mkHType :: (TypedThing t, Outputable.Outputable t) =>
String -> t -> TypeSession HType
mkHType msg ty = do
mkHType :: (TypedThing t, Outputable.Outputable t) =>
String -> t -> TypeSession HType
mkHType msg ty = do
@@
-312,6
+314,8
@@
mkHType msg ty = do
Right htype -> return htype
Left err -> error $ msg ++ err
Right htype -> return htype
Left err -> error $ msg ++ err
+-- | Turn a Core type into a HType. Returns either an error message if
+-- the type was not representable, or the HType generated.
mkHTypeEither :: (TypedThing t, Outputable.Outputable t) =>
t -> TypeSession (Either String HType)
mkHTypeEither tything =
mkHTypeEither :: (TypedThing t, Outputable.Outputable t) =>
t -> TypeSession (Either String HType)
mkHTypeEither tything =
@@
-486,6
+490,7
@@
mkVectorTy (VecType len elHType) = do
mapM_ (\(id, subprog) -> MonadState.modify tsTypeFuns $ Map.insert (UVecType elHType, id) ((mkVHDLExtId id), subprog)) vecShowFuns
let ty_def = AST.SubtypeIn vec_id (Just range)
return (Just (ty_id, Just $ Right ty_def))
mapM_ (\(id, subprog) -> MonadState.modify tsTypeFuns $ Map.insert (UVecType elHType, id) ((mkVHDLExtId id), subprog)) vecShowFuns
let ty_def = AST.SubtypeIn vec_id (Just range)
return (Just (ty_id, Just $ Right ty_def))
+ -- Vector of empty elements becomes empty itself.
Nothing -> return Nothing
mkVectorTy htype = error $ "\nVHDLTools.mkVectorTy: Called for HType that is not a VecType: " ++ show htype
Nothing -> return Nothing
mkVectorTy htype = error $ "\nVHDLTools.mkVectorTy: Called for HType that is not a VecType: " ++ show htype