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

Safe HaskellNone
LanguageHaskell2010

CLaSH.Normalize

Description

Turn CoreHW terms into normalized CoreHW Terms

Synopsis

Documentation

runNormalization Source

Arguments

:: DebugLevel

Level of debug messages to print

-> Supply

UniqueSupply

-> HashMap TmName (Type, Term)

Global Binders

-> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType))

Hardcoded Type -> HWType translator

-> HashMap TyConName TyCon

TyCon cache

-> (HashMap TyConName TyCon -> Term -> Term)

Hardcoded evaluator (delta-reduction)

-> NormalizeSession a

NormalizeSession to run

-> a 

Run a NormalizeSession in a given environment

rewriteExpr Source

Arguments

:: (String, NormRewrite)

Transformation to apply

-> (String, Term)

Term to transform

-> NormalizeSession Term 

Rewrite a term according to the provided transformation

checkNonRecursive Source

Arguments

:: TmName
topEntity
-> HashMap TmName (Type, Term)

List of normalized binders

-> HashMap TmName (Type, Term) 

Check if the call graph (second argument), starting at the topEnity (first argument) is non-recursive. Returns the list of normalized terms if call graph is indeed non-recursive, errors otherwise.

cleanupGraph :: TmName -> HashMap TmName (Type, Term) -> NormalizeSession (HashMap TmName (Type, Term)) Source

Perform general "clean up" of the normalized (non-recursive) function hierarchy. This includes:

  • Inlining functions that simply "wrap" another function

data CallTree Source

Constructors

CLeaf (TmName, (Type, Term)) 
CBranch (TmName, (Type, Term)) [CallTree] 

mkCallTree Source

Arguments

:: [TmName]

Visited

-> HashMap TmName (Type, Term)

Global binders

-> TmName

Root of the call graph

-> CallTree