clash-lib-1.4.6: Clash: a functional hardware description language - As a library
Safe HaskellNone
LanguageHaskell2010

Clash.Driver.Manifest

Description

Functions to read, write, and handle manifest files.

Synopsis

Documentation

data ManifestPort Source #

Constructors

ManifestPort 

Fields

  • mpName :: Text

    Port name (as rendered in HDL)

  • mpTypeName :: Text

    Type name (as rendered in HDL)

  • mpWidth :: Int

    Port width in bits

  • mpIsClock :: Bool

    Is this port a clock?

  • mpDomain :: Maybe Text

    Domain this port belongs to. This is currently only included for clock, reset, and enable ports. TODO: add to all ports originally defined as a Signal too.

data Manifest Source #

Information about the generated HDL between (sub)runs of the compiler

Constructors

Manifest 

Fields

  • manifestHash :: Int

    Hash of the TopEntity and all its dependencies.

    TODO: This is currently calculated using hash, but this function wasn't really designed to give any performance (in the collision / crypto sense) guarantees. We should switch to a proper hashing algo like SHA256.

  • successFlags :: (Int, Int, Bool)

    Compiler flags used to achieve successful compilation:

    • opt_inlineLimit
    • opt_specLimit
    • opt_floatSupport
  • inPorts :: [ManifestPort]
     
  • outPorts :: [ManifestPort]
     
  • componentNames :: [Text]

    Names of all the generated components for the TopEntity (does not include the names of the components of the TestBench accompanying the TopEntity).

    This list is reverse topologically sorted. I.e., a component might depend on any component listed before it, but not after it.

  • topComponent :: Text

    Design entry point. This is usually the component annotated with a TopEntity annotation.

  • fileNames :: [(FilePath, ByteString)]

    Names and hashes of all the generated files for the TopEntity. Hashes are SHA256.

  • domains :: HashMap Text VDomainConfiguration

    Domains encountered in design

  • transitiveDependencies :: [Text]

    Dependencies of this design (fully qualified binder names). Is a transitive closure of all dependencies.

data UnexpectedModification Source #

Constructors

Modified FilePath

Clash generated file was modified

Added FilePath

Non-clash generated file was added

Removed FilePath

Clash generated file was removed

mkManifestPort Source #

Arguments

:: Backend backend 
=> backend

Backend used to lookup port type names

-> Identifier

Port name

-> HWType

Port type

-> ManifestPort 

manifestFilename :: IsString a => a Source #

Filename manifest file should be written to and read from

mkManifest Source #

Arguments

:: Backend backend 
=> backend

Backend used to lookup port type names

-> HashMap Text VDomainConfiguration

Domains encountered in design

-> ClashOpts

Options Clash was run with

-> Component

Component of top entity

-> [Component]

All other entities

-> [Id]

Names of dependencies (transitive closure)

-> [(FilePath, ByteString)]

Files and their hashes

-> Int

Hash returned by readFreshManifest

-> Manifest

New manifest

pprintUnexpectedModification :: UnexpectedModification -> String Source #

Pretty print an unexpected modification as a list item.

pprintUnexpectedModifications :: Int -> [UnexpectedModification] -> String Source #

Pretty print a list of unexpected modifications. Print a maximum of n modifications.

readFreshManifest Source #

Arguments

:: [TopEntityT]

This top entity plus all that depend on it.

-> (BindingMap, Id)

Core expressions and entry point. Any changes in the call graph will trigger a recompile.

-> CompiledPrimMap

Any changes in any primitive will trigger a recompile.

-> ClashOpts

Certain options will trigger recompiles if changed

-> UTCTime

Clash modification date

-> FilePath

Path to manifest file.

-> IO (Maybe [UnexpectedModification], Maybe Manifest, Int)

( Nothing if no manifest file was found , Nothing on stale cache, disabled cache, or not manifest file found )

Reads a manifest file. Does not return manifest file if:

  • Caching is disabled through -fclash-no-cache.
  • Manifest could not be found.
  • Cache is stale. This could be triggered by any of the given arguments.

Raises an exception if the manifest file or any of the files it is referring to was inaccessible.

isUserModified :: FilePath -> Manifest -> IO [UnexpectedModification] Source #

Determines whether the HDL directory the given LocatedManifest was found in contains any user made modifications. This is used by Clash to protect the user against lost work.

readManifest :: FilePath -> IO (Maybe Manifest) Source #

Read a manifest file from disk. Returns Nothing if file does not exist. Any other IO exception is re-raised.

writeManifest :: FilePath -> Manifest -> IO () Source #

Write manifest file to disk

serializeManifest :: Manifest -> Text Source #

Serialize a manifest.

TODO: This should really yield a ByteString.