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

Safe HaskellNone




data Unsigned n Source

Arbitrary-width unsigned integer represented by n bits

Given n bits, an Unsigned n number has a range of: [0 .. 2^n-1]

NB: The Num operators perform wrap-around on overflow. If you want saturation on overflow, check out the satN2 function in CLaSH.Sized.Fixed.


Resize Unsigned

A resize operation that zero-extends on extension, and wraps on truncation.

Increasing the size of the number extends with zeros to the left. Truncating a number of length N to a length L just removes the left (most significant) N-L bits.

KnownNat n => Bounded (Unsigned n) 
KnownNat n => Enum (Unsigned n) 
Eq (Unsigned n) 
KnownNat n => Integral (Unsigned n) 
KnownNat n => Num (Unsigned n)

Operators do wrap-around on overflow

Ord (Unsigned n) 
KnownNat n => Real (Unsigned n) 
Show (Unsigned n) 
KnownNat n => Bits (Unsigned n) 
KnownNat n => FiniteBits (Unsigned n) 
KnownNat n => Default (Unsigned n) 
KnownNat n => Lift (Unsigned n) 
BitVector (Unsigned n) 
Pack (Unsigned n) 
CPack (Unsigned n) 
KnownNat ((+) m n) => Mult (Unsigned m) (Unsigned n) 
KnownNat (Max m n) => Add (Unsigned m) (Unsigned n) 
Typeable (Nat -> *) Unsigned 
type CSignalP clk (Unsigned n) = CSignal clk (Unsigned n) 
type BitSize (Unsigned n) = n 
type SignalP (Unsigned n) = Signal (Unsigned n) 
type MResult (Unsigned m) (Unsigned n) = Unsigned ((+) m n) 
type AResult (Unsigned m) (Unsigned n) = Unsigned (Max m n)