netlist-0.3.1: Netlist AST

Copyright(c) Signali Corp. 2010
LicenseAll rights reserved
Maintainerpweaver@signalicorp.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell98

Language.Netlist.Util

Description

Utility functions for constructing Netlist AST elements.

Synopsis

Documentation

data Direction Source #

Constructors

Up 
Down 

makeRange :: Direction -> Size -> Maybe Range Source #

Given a direction and size, maybe generate a Range, where a size of 1 yields Nothing.

exprConcat :: [Expr] -> Expr Source #

Concatenate a list of expressions, unless there is just one expression.

statements :: [Stmt] -> Stmt Source #

Make a Seq statement from a list of statements, unless there is just one statement.

generateReg :: Expr -> Expr -> Maybe (Expr, Expr) -> Maybe (Expr, Expr) -> Maybe Expr -> Expr -> Decl Source #

generate a process declaration for a generic register based on the following:

  • the register name (as an expression)
  • clock expression
  • width of the register
  • optional asynchronous reset and initial value
  • optional clock enable
  • optional synchronous restart and initial value
  • optional load enable
  • when enabled, the expression to assign to the identifier

You can implement a shift register by passing in a concatenation for the register expression and the input expression, though that is not compatible with VHDL.