diff --git a/src/Convert/ForDecl.hs b/src/Convert/ForDecl.hs index 8eb9d93..df7c563 100644 --- a/src/Convert/ForDecl.hs +++ b/src/Convert/ForDecl.hs @@ -31,7 +31,7 @@ convertStmt (For (Left inits) cc asgns stmt) = initAsgns ++ [For (Right [(lhs, expr)]) cc asgns stmt] where - splitDecls = map splitDecl inits + splitDecls = map splitDecl $ filter (not . isComment) inits decls = map fst splitDecls initAsgns = map asgnStmt $ init $ map snd splitDecls (lhs, expr) = snd $ last splitDecls @@ -54,6 +54,10 @@ splitDecl (Variable d t ident a e) = splitDecl decl = error $ "invalid for loop decl: " ++ show decl +isComment :: Decl -> Bool +isComment CommentDecl{} = True +isComment _ = False + asgnStmt :: (LHS, Expr) -> Stmt asgnStmt = uncurry $ Asgn AsgnOpEq Nothing diff --git a/test/lib/functions.sh b/test/lib/functions.sh index 57583a0..0e74990 100644 --- a/test/lib/functions.sh +++ b/test/lib/functions.sh @@ -58,6 +58,8 @@ assertConverts() { diff $ac_tmpb $ac_tmpc > /dev/null assertTrue "conversion of $ac_file not stable after the second iteration" $? fi + $SV2V -v $ac_file 2> /dev/null > /dev/null + assertTrue "verbose conversion of $ac_file failed" $? # using sed to remove quoted strings filtered=`sed -E 's/"([^"]|\")+"//g' $ac_tmpa` # check for various things iverilog accepts which we don't want to output