diff options
author | Yann Herklotz <git@ymhg.org> | 2019-05-13 20:50:01 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-05-13 20:50:01 +0100 |
commit | 76e9b994258d9af87868ba9f420db4ee1c29de67 (patch) | |
tree | f11b3729582a21ea31555a9106d2190e180e2ce9 /src/VeriFuzz/Verilog/AST.hs | |
parent | 3ddfc0111566113b3ec15725cb5ced6dea531a3a (diff) | |
download | verismith-76e9b994258d9af87868ba9f420db4ee1c29de67.tar.gz verismith-76e9b994258d9af87868ba9f420db4ee1c29de67.zip |
Format with brittany
Diffstat (limited to 'src/VeriFuzz/Verilog/AST.hs')
-rw-r--r-- | src/VeriFuzz/Verilog/AST.hs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/VeriFuzz/Verilog/AST.hs b/src/VeriFuzz/Verilog/AST.hs index 1957cb5..52155db 100644 --- a/src/VeriFuzz/Verilog/AST.hs +++ b/src/VeriFuzz/Verilog/AST.hs @@ -270,23 +270,25 @@ data ConstExpr = ConstNum { _constNum :: {-# UNPACK #-} !BitVec } deriving (Eq, Show, Ord, Data) constToExpr :: ConstExpr -> Expr -constToExpr (ConstNum a) = Number a -constToExpr (ParamId a) = Id a -constToExpr (ConstConcat a) = Concat $ fmap constToExpr a -constToExpr (ConstUnOp a b) = UnOp a $ constToExpr b +constToExpr (ConstNum a ) = Number a +constToExpr (ParamId a ) = Id a +constToExpr (ConstConcat a ) = Concat $ fmap constToExpr a +constToExpr (ConstUnOp a b ) = UnOp a $ constToExpr b constToExpr (ConstBinOp a b c) = BinOp (constToExpr a) b $ constToExpr c -constToExpr (ConstCond a b c) = Cond (constToExpr a) (constToExpr b) $ constToExpr c +constToExpr (ConstCond a b c) = + Cond (constToExpr a) (constToExpr b) $ constToExpr c constToExpr (ConstStr a) = Str a exprToConst :: Expr -> ConstExpr -exprToConst (Number a) = ConstNum a -exprToConst (Id a) = ParamId a -exprToConst (Concat a) = ConstConcat $ fmap exprToConst a -exprToConst (UnOp a b) = ConstUnOp a $ exprToConst b +exprToConst (Number a ) = ConstNum a +exprToConst (Id a ) = ParamId a +exprToConst (Concat a ) = ConstConcat $ fmap exprToConst a +exprToConst (UnOp a b ) = ConstUnOp a $ exprToConst b exprToConst (BinOp a b c) = ConstBinOp (exprToConst a) b $ exprToConst c -exprToConst (Cond a b c) = ConstCond (exprToConst a) (exprToConst b) $ exprToConst c +exprToConst (Cond a b c) = + ConstCond (exprToConst a) (exprToConst b) $ exprToConst c exprToConst (Str a) = ConstStr a -exprToConst _ = error "Not a constant expression" +exprToConst _ = error "Not a constant expression" instance Num ConstExpr where a + b = ConstBinOp a BinPlus b |