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:
3a92b8b
)
Enum are now integer typedefs instead of unsigned subtypedefs
author
christiaanb
<christiaan.baaij@gmail.com>
Mon, 21 Jun 2010 11:32:58 +0000
(13:32 +0200)
committer
christiaanb
<christiaan.baaij@gmail.com>
Mon, 21 Jun 2010 11:32:58 +0000
(13:32 +0200)
clash/CLasH/VHDL/VHDLTools.hs
patch
|
blob
|
history
diff --git
a/clash/CLasH/VHDL/VHDLTools.hs
b/clash/CLasH/VHDL/VHDLTools.hs
index 521aa0850b0243d08c3623581a696e351b02f2fc..507fe3b995d0a2de4c3809cb524b3df163717802 100644
(file)
--- a/
clash/CLasH/VHDL/VHDLTools.hs
+++ b/
clash/CLasH/VHDL/VHDLTools.hs
@@
-495,13
+495,11
@@
mkTyconTy htype =
return $ Just (ty_id, Just $ Left ty_def)
(EnumType tycon dcs) -> do
let ty_id = mkVHDLExtId tycon
return $ Just (ty_id, Just $ Left ty_def)
(EnumType tycon dcs) -> do
let ty_id = mkVHDLExtId tycon
- let possibilaties = case (length dcs) of 1 -> 1; x -> (x-1)
- let bitsize = floor (logBase 2 (fromInteger (toInteger possibilaties)))
- let range = AST.ConstraintIndex $ AST.IndexConstraint [AST.DownRange (AST.PrimLit $ show bitsize) (AST.PrimLit "0")]
- let ty_def = AST.SubtypeIn unsignedTM (Just range)
+ let range = AST.SubTypeRange (AST.PrimLit "0") (AST.PrimLit $ show (length dcs))
+ let ty_def = AST.TDI $ AST.IntegerTypeDef range
let enumShow = mkEnumShow dcs ty_id
MonadState.modify tsTypeFuns $ Map.insert (htype, showIdString) (showId, enumShow)
let enumShow = mkEnumShow dcs ty_id
MonadState.modify tsTypeFuns $ Map.insert (htype, showIdString) (showId, enumShow)
- return $ Just (ty_id, Just $
Righ
t ty_def)
+ return $ Just (ty_id, Just $
Lef
t ty_def)
otherwise -> error $ "\nVHDLTools.mkTyconTy: Called for HType that is neiter a AggrType or EnumType: " ++ show htype
-- | Create a VHDL vector type
otherwise -> error $ "\nVHDLTools.mkTyconTy: Called for HType that is neiter a AggrType or EnumType: " ++ show htype
-- | Create a VHDL vector type