From fe0f44b2f1609bb8d5097a85daec51e5f9ffdaf0 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 23 Jan 2019 19:35:52 +0000 Subject: Better AST generation from DAG --- src/VeriFuzz/Graph/ASTGen.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/VeriFuzz') diff --git a/src/VeriFuzz/Graph/ASTGen.hs b/src/VeriFuzz/Graph/ASTGen.hs index 30dee04..745d849 100644 --- a/src/VeriFuzz/Graph/ASTGen.hs +++ b/src/VeriFuzz/Graph/ASTGen.hs @@ -12,6 +12,7 @@ Generates the AST from the graph directly. module VeriFuzz.Graph.ASTGen where +import Control.Lens ((^..)) import Data.Foldable (fold) import Data.Graph.Inductive (LNode, Node) import qualified Data.Graph.Inductive as G @@ -73,7 +74,9 @@ genModuleDeclAST c = ModDecl i output ports items i = Identifier "gen_module" ports = genPortsAST inputsC c output = [Port Wire 90 "y"] - items = genAssignAST c ++ [ModCA . ContAssign "y" . fold $ portToExpr <$> ports] + a = genAssignAST c + items = a ++ [ModCA . ContAssign "y" . fold $ Id <$> assigns] + assigns = a ^.. traverse . _ModCA . contAssignNetLVal generateAST :: Circuit -> VerilogSrc generateAST c = VerilogSrc [Description $ genModuleDeclAST c] -- cgit