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

Copyright(C) 2013-2016, University of Twente
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellUnsafe
LanguageHaskell2010
Extensions
  • UndecidableInstances
  • MonoLocalBinds
  • TemplateHaskell
  • TypeFamilies
  • DataKinds
  • DeriveDataTypeable
  • MultiParamTypeClasses
  • MagicHash
  • KindSignatures
  • TypeOperators
  • ExplicitNamespaces

CLaSH.Sized.Internal.Index

Contents

Description

 

Synopsis

Datatypes

newtype Index n Source

Arbitrary-bounded unsigned integer represented by ceil(log_2(n)) bits.

Given an upper bound n, an Index n number has a range of: [0 .. n-1]

>>> maxBound :: Index 8
7
>>> minBound :: Index 8
0
>>> read (show (maxBound :: Index 8)) :: Index 8
7
>>> 1 + 2 :: Index 8
3
>>> 2 + 6 :: Index 8
*** Exception: CLaSH.Sized.Index: result 8 is out of bounds: [0..7]
>>> 1 - 3 :: Index 8
*** Exception: CLaSH.Sized.Index: result -2 is out of bounds: [0..7]
>>> 2 * 3 :: Index 8
6
>>> 2 * 4 :: Index 8
*** Exception: CLaSH.Sized.Index: result 8 is out of bounds: [0..7]

Constructors

I

The constructor, I, and the field, unsafeToInteger, are not synthesisable.

Instances

Resize Index Source 
KnownNat n => Bounded (Index n) Source 
KnownNat n => Enum (Index n) Source

The functions: enumFrom, enumFromThen, enumFromTo, and enumFromThenTo, are not synthesisable.

Eq (Index n) Source 
KnownNat n => Integral (Index n) Source 
Typeable Nat n => Data (Index n) Source 
KnownNat n => Num (Index n) Source

Operators report an error on overflow and underflow

Ord (Index n) Source 
KnownNat n => Read (Index n) Source

None of the Read class' methods are synthesisable.

KnownNat n => Real (Index n) Source 
Show (Index n) Source 
KnownNat n => Arbitrary (Index n) Source 
KnownNat n => CoArbitrary (Index n) Source 
KnownNat n => Default (Index n) Source 
KnownNat n => Lift (Index n) Source 
KnownNat n => BitPack (Index n) Source 
Bundle (Index n) Source 
ExtendingNum (Index m) (Index n) Source 
type Unbundled' clk (Index n) = Signal' clk (Index n) 
type BitSize (Index n) = CLog 2 n Source 
type AResult (Index m) (Index n) = Index ((-) ((+) m n) 1) Source 
type MResult (Index m) (Index n) = Index ((+) (* ((-) m 1) ((-) n 1)) 1) Source 

Type classes

BitConvert

Eq

eq# :: Index n -> Index n -> Bool Source

neq# :: Index n -> Index n -> Bool Source

Ord

lt# :: Index n -> Index n -> Bool Source

ge# :: Index n -> Index n -> Bool Source

gt# :: Index n -> Index n -> Bool Source

le# :: Index n -> Index n -> Bool Source

Enum (not synthesisable)

enumFromTo# :: KnownNat n => Index n -> Index n -> [Index n] Source

enumFromThenTo# :: KnownNat n => Index n -> Index n -> Index n -> [Index n] Source

Bounded

Num

(+#) :: KnownNat n => Index n -> Index n -> Index n Source

(-#) :: KnownNat n => Index n -> Index n -> Index n Source

(*#) :: KnownNat n => Index n -> Index n -> Index n Source

ExtendingNum

plus# :: Index m -> Index n -> Index ((m + n) - 1) Source

minus# :: Index m -> Index n -> Index ((m + n) - 1) Source

times# :: Index m -> Index n -> Index (((m - 1) * (n - 1)) + 1) Source

Integral

quot# :: Index n -> Index n -> Index n Source

rem# :: Index n -> Index n -> Index n Source

Resize