clash-lib-1.8.4: Clash: a functional hardware description language - As a library

Copyright | (C) 2012-2016 University of Twente 2016 Myrtle Software Ltd 2017 Google Inc. 2021-2023 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | None
Language | Haskell2010

Clash.Normalize

Description

Turn CoreHW terms into normalized CoreHW Terms

Synopsis

- runNormalization :: ClashEnv -> Supply -> BindingMap -> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) -> Evaluator -> Evaluator -> VarEnv Bool -> [Id] -> NormalizeSession a -> IO a
- normalize :: [Id] -> NormalizeSession BindingMap
- normalize' :: Id -> NormalizeSession ([Id], (Id, Binding Term))
- checkNonRecursive :: BindingMap -> BindingMap
- cleanupGraph :: Id -> BindingMap -> NormalizeSession BindingMap
- data CallTree
  - = CLeaf (Id, Binding Term)
  - | CBranch (Id, Binding Term) [CallTree]
- mkCallTree :: [Id] -> BindingMap -> Id -> Maybe CallTree
- stripArgs :: [Id] -> [Id] -> [Either Term Type] -> Maybe [Either Term Type]
- flattenNode :: CallTree -> NormalizeSession (Either CallTree ((Id, Term), [CallTree]))
- flattenCallTree :: CallTree -> NormalizeSession CallTree
- callTreeToList :: [Id] -> CallTree -> ([Id], [(Id, Binding Term)])

# Documentation

runNormalization Source #

Arguments

:: ClashEnv |
-> Supply | UniqueSupply
-> BindingMap | Global Binders
-> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) | Hardcoded Type -> HWType translator
-> Evaluator | Hardcoded evaluator for partial evaluation
-> Evaluator | Hardcoded evaluator for WHNF (old evaluator)
-> VarEnv Bool | Map telling whether a components is part of a recursive group
-> [Id] | topEntities
-> NormalizeSession a | NormalizeSession to run
-> IO a |

Run a NormalizeSession in a given environment

normalize :: [Id] -> NormalizeSession BindingMap Source #

normalize' :: Id -> NormalizeSession ([Id], (Id, Binding Term)) Source #

checkNonRecursive Source #

Arguments

:: BindingMap | List of normalized binders
-> BindingMap |

Check whether the normalized bindings are non-recursive. Errors when one of the components is recursive.

cleanupGraph :: Id -> BindingMap -> NormalizeSession BindingMap Source #

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

- Inlining functions that simply "wrap" another function

data CallTree Source #

A tree of identifiers and their bindings, with branches containing additional bindings which are used. See Clash.Driver.Types.Binding.

Constructors

CLeaf (Id, Binding Term) |
CBranch (Id, Binding Term) [CallTree] |

mkCallTree Source #

Arguments

:: [Id] | Visited
-> BindingMap | Global binders
-> Id | Root of the call graph
-> Maybe CallTree |

stripArgs :: [Id] -> [Id] -> [Either Term Type] -> Maybe [Either Term Type] Source #

flattenNode :: CallTree -> NormalizeSession (Either CallTree ((Id, Term), [CallTree])) Source #

flattenCallTree :: CallTree -> NormalizeSession CallTree Source #

callTreeToList :: [Id] -> CallTree -> ([Id], [(Id, Binding Term)]) Source #