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 (from parent 1:
ce37751
)
Always rotate alternatives of case-statements. Original bug was caused by reverse...
author
christiaanb
<christiaan.baaij@gmail.com>
Thu, 24 Jun 2010 09:34:01 +0000
(11:34 +0200)
committer
christiaanb
<christiaan.baaij@gmail.com>
Thu, 24 Jun 2010 09:34:01 +0000
(11:34 +0200)
clash/CLasH/VHDL/Generate.hs
patch
|
blob
|
history
diff --git
a/clash/CLasH/VHDL/Generate.hs
b/clash/CLasH/VHDL/Generate.hs
index 2fea7a3a38565a09866276b7b4a0a307e3fa01c7..b6aa8c63a1a39d3bc58cdf47d7b00ac1c9f8eb9b 100644
(file)
--- a/
clash/CLasH/VHDL/Generate.hs
+++ b/
clash/CLasH/VHDL/Generate.hs
@@
-301,7
+301,7
@@
mkConcSm (bndr, expr@(CoreSyn.Case (CoreSyn.Var scrut) _ _ alts)) = do
let enums = [AST.PrimLit "'1'", AST.PrimLit "'0'"]
return (enums, scrut_expr)
(BuiltinType "Bool") -> do
let enums = [AST.PrimLit "'1'", AST.PrimLit "'0'"]
return (enums, scrut_expr)
(BuiltinType "Bool") -> do
- let enums = [AST.PrimLit "
true", AST.PrimLit "fals
e"]
+ let enums = [AST.PrimLit "
false", AST.PrimLit "tru
e"]
return (enums, scrut_expr)
_ -> error $ "\nSelector case on weird scrutinee: " ++ pprString scrut ++ " scrutinee type: " ++ pprString (Id.idType scrut)
-- Omit first condition, which is the default. Look up each altcon in
return (enums, scrut_expr)
_ -> error $ "\nSelector case on weird scrutinee: " ++ pprString scrut ++ " scrutinee type: " ++ pprString (Id.idType scrut)
-- Omit first condition, which is the default. Look up each altcon in
@@
-311,11
+311,7
@@
mkConcSm (bndr, expr@(CoreSyn.Case (CoreSyn.Var scrut) _ _ alts)) = do
-- alternatives.
let cond_exprs = map (\x -> cmp AST.:=: x) altcons
-- Rotate expressions to the leftso that the expression related to the default case is the last
-- alternatives.
let cond_exprs = map (\x -> cmp AST.:=: x) altcons
-- Rotate expressions to the leftso that the expression related to the default case is the last
- -- Does NOT apply when there is no DEFAULT case and there are no binders
- let alts' = if ((any (\(_,x,_) -> not (null x)) alts) || ((\(x,_,_)->x) (head alts)) == CoreSyn.DEFAULT ) then
- ((tail alts) ++ [head alts])
- else
- alts
+ let alts' = (tail alts) ++ [head alts]
exprs <- MonadState.lift tsType $ mapM (varToVHDLExpr . (\(_,_,CoreSyn.Var expr) -> expr)) alts' --((tail alts) ++ [head alts])
return ([mkAltsAssign (Left bndr) cond_exprs exprs], [])
exprs <- MonadState.lift tsType $ mapM (varToVHDLExpr . (\(_,_,CoreSyn.Var expr) -> expr)) alts' --((tail alts) ++ [head alts])
return ([mkAltsAssign (Left bndr) cond_exprs exprs], [])