clash-prelude-0.9.3: CAES Language for Synchronous Hardware - Prelude library

Copyright(C) 2013-2015, University of Twente
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellTrustworthy
LanguageHaskell2010
Extensions
  • MonoLocalBinds
  • TypeFamilies
  • DataKinds
  • DefaultSignatures
  • MagicHash
  • KindSignatures
  • ExplicitNamespaces

CLaSH.Signal.Bundle

Description

The Product/Signal isomorphism

Synopsis

Documentation

class Bundle a where Source

Isomorphism between a Signal of a product type (e.g. a tuple) and a product type of Signal's.

Instances of Bundle must satisfy the following laws:

bundle' . unbundle' = id
unbundle' . bundle' = id

By default, bundle' and unbundle', are defined as the identity, that is, writing:

data D = A | B

instance Bundle D

is the same as:

data D = A | B

instance Bundle D where
  type Unbundled' clk D = Signal' clk D
  bundle'   _ s = s
  unbundle' _ s = s

Minimal complete definition

Nothing

Associated Types

type Unbundled' clk a Source

Methods

bundle' :: SClock clk -> Unbundled' clk a -> Signal' clk a Source

Example:

bundle' :: (Signal' clk a, Signal' clk b) -> Signal' clk (a,b)

However:

bundle' :: Signal' clk Bit -> Signal' clk Bit

unbundle' :: SClock clk -> Signal' clk a -> Unbundled' clk a Source

Example:

unbundle' :: Signal' clk (a,b) -> (Signal' clk a, Signal' clk b)

However:

unbundle' :: Signal' clk Bit -> Signal' clk Bit

Instances

Bundle Bool Source 
Bundle Double Source 
Bundle Float Source 
Bundle Int Source 
Bundle Integer Source 
Bundle () Source 
Bundle (Maybe a) Source 
Bundle (Index n) Source 
Bundle (BitVector n) Source 
Bundle (Signed n) Source 
Bundle (Unsigned n) Source 
Bundle (Either a b) Source 
Bundle (a, b) Source 
KnownNat n => Bundle (Vec n a) Source 
Bundle (a, b, c) Source 
Bundle (Fixed rep int frac) Source 
Bundle (a, b, c, d) Source 
Bundle (a, b, c, d, e) Source 
Bundle (a, b, c, d, e, f) Source 
Bundle (a, b, c, d, e, f, g) Source 
Bundle (a, b, c, d, e, f, g, h) Source