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:
e82d521
)
rotate alternatives of a case-statement if there is a default case
author
christiaanb
<christiaan.baaij@gmail.com>
Wed, 23 Jun 2010 10:05:35 +0000
(12:05 +0200)
committer
christiaanb
<christiaan.baaij@gmail.com>
Wed, 23 Jun 2010 10:05:35 +0000
(12:05 +0200)
clash/CLasH/VHDL/Generate.hs
patch
|
blob
|
history
diff --git
a/clash/CLasH/VHDL/Generate.hs
b/clash/CLasH/VHDL/Generate.hs
index 191ae9cf5a6e9242b54d6bbcec17047ac3c3bbfb..06bc2655cec986b48e5257a71e99d3a04ab33588 100644
(file)
--- a/
clash/CLasH/VHDL/Generate.hs
+++ b/
clash/CLasH/VHDL/Generate.hs
@@
-311,7
+311,11
@@
mkConcSm (bndr, expr@(CoreSyn.Case (CoreSyn.Var scrut) _ _ alts)) = do
-- alternatives.
let cond_exprs = map (\x -> cmp AST.:=: x) altcons
-- Rotate expressions to the left, so 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 left, so that the expression related to the default case is the last
- exprs <- MonadState.lift tsType $ mapM (varToVHDLExpr . (\(_,_,CoreSyn.Var expr) -> expr)) ((tail alts) ++ [head alts])
+ let alts' = case alts of
+ ((CoreSyn.DEFAULT,_,_):_) -> ((tail alts) ++ [head alts])
+ otherwise -> alts
+
+ exprs <- MonadState.lift tsType $ mapM (varToVHDLExpr . (\(_,_,CoreSyn.Var expr) -> expr)) alts' --((tail alts) ++ [head alts])
return ([mkAltsAssign (Left bndr) cond_exprs exprs], [])
mkConcSm (_, CoreSyn.Case _ _ _ _) = error "\nVHDL.mkConcSm: Not in normal form: Case statement does not have a simple variable as scrutinee"
return ([mkAltsAssign (Left bndr) cond_exprs exprs], [])
mkConcSm (_, CoreSyn.Case _ _ _ _) = error "\nVHDL.mkConcSm: Not in normal form: Case statement does not have a simple variable as scrutinee"