From: Matthijs Kooijman Date: Tue, 3 Feb 2009 10:10:46 +0000 (+0100) Subject: Let mkIfaceSigDecs and createSignalAssignments handle Unused values. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=baeffe32403198471adb33c2aadd0312cf8eb410;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Let mkIfaceSigDecs and createSignalAssignments handle Unused values. --- diff --git a/Translator.hs b/Translator.hs index f54dcf3..363ffe2 100644 --- a/Translator.hs +++ b/Translator.hs @@ -45,7 +45,7 @@ main = --core <- GHC.compileToCoreSimplified "Adders.hs" core <- GHC.compileToCoreSimplified "Adders.hs" --liftIO $ printBinds (cm_binds core) - let binds = Maybe.mapMaybe (findBind (cm_binds core)) ["shalf_adder"] + let binds = Maybe.mapMaybe (findBind (cm_binds core)) ["dff"] liftIO $ printBinds binds -- Turn bind into VHDL let (vhdl, sess) = State.runState (mkVHDL binds) (VHDLSession 0 []) @@ -412,6 +412,10 @@ mkIfaceSigDecs mode (Single (port_id, ty)) = mkIfaceSigDecs mode (Tuple ports) = concat $ map (mkIfaceSigDecs mode) ports +-- Unused values (state) don't generate ports +mkIfaceSigDecs mode Unused = + [] + -- Create concurrent assignments of one map of signals to another. The maps -- should have a similar form. createSignalAssignments :: @@ -433,6 +437,14 @@ createSignalAssignments (Single (dst, _)) (Single (src, _)) = createSignalAssignments (Tuple dsts) (Tuple srcs) = concat $ zipWith createSignalAssignments dsts srcs +createSignalAssignments Unused (Single (src, _)) = + -- Write state + [] + +createSignalAssignments (Single (src, _)) Unused = + -- Read state + [] + createSignalAssignments dst src = error $ "Non matching source and destination: " ++ show dst ++ "\nand\n" ++ show src