X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=blobdiff_plain;f=clash%2FCLasH%2FVHDL%2FGenerate.hs;fp=clash%2FCLasH%2FVHDL%2FGenerate.hs;h=06bc2655cec986b48e5257a71e99d3a04ab33588;hp=191ae9cf5a6e9242b54d6bbcec17047ac3c3bbfb;hb=f69e59a92472c3a827ac25b52ab5d70895e19b7e;hpb=e82d5210946093b03d9c46b7ffbcb556304e5b0b diff --git a/clash/CLasH/VHDL/Generate.hs b/clash/CLasH/VHDL/Generate.hs index 191ae9c..06bc265 100644 --- 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 - 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"