clash-lib-1.2.0: CAES Language for Synchronous Hardware - As a Library

Copyright(C) 2012-2016 University of Twente
2017 Myrtle Software Ltd
2018 Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <>
Safe HaskellNone



Utility functions to generate Primitives



generatePrimMap Source #


:: 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

decodeOrErr Source #


:: (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.

getFunctionPlurality Source #


:: HasCallStack 
=> CompiledPrimitive 
-> [Either Term Type]

Arguments passed to blackbox

-> Type

Result type

-> 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.