Copyright | (C) 2012-2016 University of Twente 2017 Myrtle Software Ltd 2018 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Utility functions to generate Primitives
Synopsis
- generatePrimMap :: HasCallStack => [UnresolvedPrimitive] -> [(Text, PrimitiveGuard ())] -> [FilePath] -> IO ResolvedPrimMap
- hashCompiledPrimMap :: CompiledPrimMap -> Int
- constantArgs :: Text -> CompiledPrimitive -> Set Int
- decodeOrErr :: (HasCallStack, FromJSON a) => FilePath -> ByteString -> a
- getFunctionPlurality :: HasCallStack => CompiledPrimitive -> [Either Term Type] -> [Type] -> Int -> NetlistMonad Int
Documentation
:: HasCallStack | |
=> [UnresolvedPrimitive] | unresolved primitives found in annotations (in LoadModules and LoadInterfaceFiles) |
-> [(Text, PrimitiveGuard ())] | |
-> [FilePath] | Directories to search for primitive definitions |
-> IO ResolvedPrimMap |
Generate a set of primitives that are found in the primitive definition files in the given directories.
hashCompiledPrimMap :: CompiledPrimMap -> Int Source #
Hash a compiled primitive map. It needs a separate function (as opposed to
just hash
) as it might contain (obviously unhashable) Haskell functions. This
function takes the hash value stored with the function instead.
constantArgs :: Text -> CompiledPrimitive -> Set Int Source #
Determine what argument should be constant / literal
:: (HasCallStack, FromJSON a) | |
=> FilePath | Path read from (for error message) |
-> ByteString | Bytestring to parse |
-> a |
Parse a ByteString according to the given JSON template. Throws exception if it fails.
:: HasCallStack | |
=> CompiledPrimitive | |
-> [Either Term Type] | Arguments passed to blackbox |
-> [Type] | Result types |
-> Int | Argument number holding the function of interest |
-> NetlistMonad Int | Plurality of function. Defaults to 1. Does not err if argument isn't a function in the first place. State of monad will not be modified. |
Looks up the plurality of a function's function argument. See
functionPlurality
for more information. If not set, the returned plurality
will default to 1.