rewire-backend-2.8: A Haskell-to-Verilog/VHDL compiler, the Hyle backend
Safe HaskellSafe
LanguageHaskell2010

ReWire.Hyle.Interp

Description

The Hyle interpreter: a direct transcription of the denotational semantics in doc/hyle.md (sections 5 and 6). The device denotes a Mealy stream function: registers start at their initial values, outputs and next-register values are computed from the body's equations each cycle.

Programs containing instances (sequential externs) or calls to model-less combinational externs cannot be evaluated.

Synopsis

Documentation

interp :: forall (m :: Type -> Type). MonadError AstError m => Config -> Program -> MealyT m Ins Outs Source #

evalExp :: MonadError AstError m => IEnv -> HashMap Name BV -> Exp -> m BV Source #

evalOp :: MonadError AstError m => Annote -> Op -> [BV] -> m BV Source #

Primitive denotations (doc/hyle.md, section 5.2).

data IEnv Source #

Constructors

IEnv 

Fields

type Ins = HashMap Name Value Source #

Per-cycle input values and output bitvectors, by wire name.

type Outs = HashMap Name BV Source #

run :: MonadIO m => Config -> MealyT m Ins Outs -> [Ins] -> m [Outs] Source #

Runs non-interactively: given a stream of inputs, produces a stream of outputs.

subRange :: (Int, Int) -> BV -> BV Source #

The inclusive bit range [i, j] of a bitvector.

inputValue :: Size -> Ins -> Name -> Value Source #

The value driven onto an input wire for a cycle (interp-style inputs: missing wires are driven to zero; values are truncated to the wire width).

yamlPrefixes :: [Text] Source #

Per-cycle output records in the interpreter's YAML format: the first output prefixed with "- ", the rest indented, in port order.