aig 0.2 → 0.2.1
raw patch · 3 files changed
+25/−28 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.AIG.Operations: mapM :: Monad m => (a -> m b) -> BV a -> m (BV b)
+ Data.AIG.Interface: networkOutputCount :: Network l g -> Int
+ Data.AIG.Operations: instance Foldable BV
+ Data.AIG.Operations: instance Traversable BV
Files
- aig.cabal +2/−12
- src/Data/AIG/Interface.hs +8/−3
- src/Data/AIG/Operations.hs +15/−13
aig.cabal view
@@ -1,10 +1,10 @@ Name: aig-Version: 0.2+Version: 0.2.1 License: BSD3 License-file: LICENSE Author: Galois Inc. Maintainer: jhendrix@galois.com-Copyright: (c) 2014 Galois Inc.+Copyright: (c) 2014-2015 Galois Inc. Category: Data build-type: Simple cabal-Version: >= 1.10@@ -19,11 +19,6 @@ These interfaces allow clients to write code that can create and use AIGs without depending on a particular AIG package. --- Ugh. Temporary fix to make Hackage happy.---flag enable-hpc--- Description: Collect HPC coverage information.--- Default: False- source-repository head type: git location: https://github.com/GaloisInc/aig.git@@ -38,13 +33,8 @@ default-Language: Haskell2010 ghc-options: -Wall -fno-ignore-asserts -O2- ghc-prof-options: -prof -auto-all -caf-all build-depends: base == 4.*, mtl, vector, QuickCheck >= 2.7---- Ugh. Temporary fix to make Hackage happy.--- if flag(enable-hpc)--- ghc-options: -fhpc -hpcdir .hpc
src/Data/AIG/Interface.hs view
@@ -25,7 +25,7 @@ , SomeGraph(..) , Network(..) , networkInputCount-+ , networkOutputCount -- * Literal representations , LitView(..) , LitTree(..)@@ -275,13 +275,18 @@ | c === (falseLit g) = \_x y -> y | otherwise = \x y -> join $ pure (mux g c) <*> x <*> y --- | A network is an and-inverstor graph paired with it's outputs,--- thus representing a complete combinational circuit.+-- | A network is an and-invertor graph paired with it's outputs,+-- thus representing a complete combinational circuit. data Network l g where Network :: IsAIG l g => g s -> [l s] -> Network l g +-- | Get number of inputs associated with current network. networkInputCount :: Network l g -> IO Int networkInputCount (Network g _) = inputCount g++-- | Number of outputs associated with a network.+networkOutputCount :: Network l g -> Int+networkOutputCount (Network _ o) = length o -- | Some graph quantifies over the state phantom variable for a graph. data SomeGraph g where
src/Data/AIG/Operations.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE ScopedTypeVariables #-}- {- | Module : Data.AIG.Operations Copyright : (c) Galois, Inc. 2014@@ -11,7 +9,10 @@ A collection of higher-level operations (mostly 2's complement arithmetic operations) that can be built from the primitive And-Inverter Graph interface. -}-+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE ScopedTypeVariables #-} module Data.AIG.Operations ( -- * Bitvectors BV@@ -25,7 +26,6 @@ , drop , slice , sliceRev- , mapM , zipWith , zipWithM , msb@@ -119,10 +119,13 @@ import qualified Control.Monad import Control.Monad.State hiding (zipWithM, replicateM, mapM) import Data.Bits ((.|.), setBit, shiftL, testBit)+import Data.Foldable (Foldable)+import Data.Traversable (Traversable) import qualified Data.Vector as V import qualified Data.Vector.Generic.Mutable as MV -import Prelude hiding (and, concat, length, not, or, replicate, splitAt, tail, (++), take, drop, zipWith, mapM)+import Prelude+ hiding (and, concat, length, not, or, replicate, splitAt, tail, (++), take, drop, zipWith, mapM) import qualified Prelude import Data.AIG.Interface@@ -131,10 +134,13 @@ -- | A BitVector consists of a sequence of symbolic bits and can be used -- for symbolic machine-word arithmetic. newtype BV l = BV { unBV :: V.Vector l }- deriving (Eq, Ord, Show)--instance Functor BV where- fmap f (BV v) = BV (f <$> v)+ deriving ( Eq+ , Ord+ , Show+ , Functor+ , Foldable+ , Traversable+ ) -- | Empty bitvector empty :: BV l@@ -267,10 +273,6 @@ -> BV l sliceRev (BV v) i n = BV (V.slice i' n v) where i' = V.length v - i - n---- | Apply a monadic operation to each element of a bitvector in sequence-mapM :: Monad m => (a -> m b) -> BV a -> m (BV b)-mapM f (BV x) = V.mapM f x >>= return . BV -- | Combine two bitvectors with a bitwise function zipWith :: (l -> l -> l) -> BV l -> BV l -> BV l