netlist-0.2: Netlist AST

Portabilitynon-portable
Stabilityexperimental
Maintainerpweaver@signalicorp.com

Language.Netlist.Util

Description

Utility functions for constructing Netlist AST elements.

Synopsis

Documentation

data Direction Source

Constructors

Up 
Down 

makeRange :: Direction -> Size -> Maybe RangeSource

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

exprConcat :: [Expr] -> ExprSource

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

statements :: [Stmt] -> StmtSource

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 -> DeclSource

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.