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

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

Clash.Netlist

Description

Create Netlists out of normalized CoreHW Terms

Synopsis

Documentation

genNetlist Source #

Arguments

:: BindingMap

Global binders

-> [(TmName, Type, Maybe TopEntity, Maybe TmName)]

All the TopEntities

-> PrimMap BlackBoxTemplate

Primitive definitions

-> HashMap TyConOccName TyCon

TyCon cache

-> (HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType))

Hardcoded Type -> HWType translator

-> [(String, FilePath)]

Set of collected data-files

-> Int

IntWordInteger bit-width

-> (IdType -> Identifier -> Identifier)

valid identifiers

-> (IdType -> Identifier -> Identifier -> Identifier)

extend valid identifiers

-> [Identifier]

Seen components

-> FilePath

HDL dir

-> TmOccName

Name of the topEntity

-> IO ([(SrcSpan, Component)], [(String, FilePath)], [Identifier]) 

Generate a hierarchical netlist out of a set of global binders with topEntity at the top.

runNetlistMonad Source #

Arguments

:: BindingMap

Global binders

-> HashMap TmOccName (Type, Maybe TopEntity)

TopEntity annotations

-> PrimMap BlackBoxTemplate

Primitive Definitions

-> HashMap TyConOccName TyCon

TyCon cache

-> (HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType))

Hardcode Type -> HWType translator

-> [(String, FilePath)]

Set of collected data-files

-> Int

IntWordInteger bit-width

-> (IdType -> Identifier -> Identifier)

valid identifiers

-> (IdType -> Identifier -> Identifier -> Identifier)

extend valid identifiers

-> [Identifier]

Seen components

-> FilePath

HDL dir

-> NetlistMonad a

Action to run

-> IO (a, NetlistState) 

Run a NetlistMonad action in a given environment

genComponent Source #

Arguments

:: TmOccName

Name of the function

-> NetlistMonad (SrcSpan, Component) 

Generate a component for a given function (caching)

genComponentT Source #

Arguments

:: TmOccName

Name of the function

-> Term

Corresponding term

-> NetlistMonad (SrcSpan, Component) 

Generate a component for a given function

mkDeclarations Source #

Arguments

:: Id

LHS of the let-binder

-> Term

RHS of the let-binder

-> NetlistMonad [Declaration] 

Generate a list of Declarations for a let-binder, return an empty list if the bound expression is represented by 0 bits

mkDeclarations' Source #

Arguments

:: Id

LHS of the let-binder

-> Term

RHS of the let-binder

-> NetlistMonad [Declaration] 

Generate a list of Declarations for a let-binder

mkSelection :: Id -> Term -> Type -> [Alt] -> NetlistMonad [Declaration] Source #

Generate a declaration that selects an alternative based on the value of the scrutinee

mkFunApp Source #

Arguments

:: Id

LHS of the let-binder

-> TmName

Name of the applied function

-> [Term]

Function arguments

-> NetlistMonad [Declaration] 

Generate a list of Declarations for a let-binder where the RHS is a function application

mkExpr Source #

Arguments

:: Bool

Treat BlackBox expression as declaration

-> Either Identifier Id

Id to assign the result to

-> Type

Type of the LHS of the let-binder

-> Term

Term to convert to an expression

-> NetlistMonad (Expr, [Declaration])

Returned expression and a list of generate BlackBox declarations

Generate an expression for a term occurring on the RHS of a let-binder

mkProjection Source #

Arguments

:: Bool

Projection must bind to a simple variable

-> Either Identifier Id

The signal to which the projection is (potentially) assigned

-> Term

The subject/scrutinee of the projection

-> Type

The type of the result

-> Alt

The field to be projected

-> NetlistMonad (Expr, [Declaration]) 

Generate an expression that projects a field out of a data-constructor.

Works for both product types, as sum-of-product types.

mkDcApplication Source #

Arguments

:: HWType

HWType of the LHS of the let-binder

-> Either Identifier Id

Id to assign the result to

-> DataCon

Applied DataCon

-> [Term]

DataCon Arguments

-> NetlistMonad (Expr, [Declaration])

Returned expression and a list of generate BlackBox declarations

Generate an expression for a DataCon application occurring on the RHS of a let-binder