blarney
Copyright(c) Matthew Naylor 2019
(c) Alexandre Joannou 2019
LicenseMIT
Maintainermattfn@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred

Blarney.Core.Bits

Description

Any type in the Bits class can be represented in hardware at runtime. For example, values of a type in the Bits class can be stored in a register, or carried along a wire. The Bits class supports generic deriving.

Documentation

class Bits a where Source #

Minimal complete definition

Nothing

Associated Types

type SizeOf a :: Nat Source #

Type-level size of bit-vector

type SizeOf a = GSizeOf (Rep a)

Methods

sizeOf :: a -> Int Source #

Value-level size of bit-vector

default sizeOf :: (Generic a, GBits (Rep a), GSizeOf (Rep a) ~ SizeOf a) => a -> Int Source #

pack :: a -> Bit (SizeOf a) Source #

Convert to a bit-vector

default pack :: (Generic a, GBits (Rep a), GSizeOf (Rep a) ~ SizeOf a) => a -> Bit (SizeOf a) Source #

unpack :: Bit (SizeOf a) -> a Source #

Convert from a bit-vector

default unpack :: (Generic a, GBits (Rep a), GSizeOf (Rep a) ~ SizeOf a) => Bit (SizeOf a) -> a Source #

nameBits :: String -> a -> a Source #

Name a Bits

default nameBits :: (Generic a, GBits (Rep a), GSizeOf (Rep a) ~ SizeOf a) => String -> a -> a Source #

Instances

Instances details
Bits () # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf () :: Nat Source #

Methods

sizeOf :: () -> Int Source #

pack :: () -> Bit (SizeOf ()) Source #

unpack :: Bit (SizeOf ()) -> () Source #

nameBits :: String -> () -> () Source #

KnownNat n => Bits (Bit n) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (Bit n) :: Nat Source #

Methods

sizeOf :: Bit n -> Int Source #

pack :: Bit n -> Bit (SizeOf (Bit n)) Source #

unpack :: Bit (SizeOf (Bit n)) -> Bit n Source #

nameBits :: String -> Bit n -> Bit n Source #

KnownNat n => Bits (Signed n) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (Signed n) :: Nat Source #

Bits t => Bits (Option t) # 
Instance details

Defined in Blarney.Option

Associated Types

type SizeOf (Option t) :: Nat Source #

IsTaggedUnion (TaggedUnion fields) => Bits (TaggedUnion fields) #

Bits instance for tagged unions

Instance details

Defined in Blarney.TaggedUnion

Associated Types

type SizeOf (TaggedUnion fields) :: Nat Source #

Methods

sizeOf :: TaggedUnion fields -> Int Source #

pack :: TaggedUnion fields -> Bit (SizeOf (TaggedUnion fields)) Source #

unpack :: Bit (SizeOf (TaggedUnion fields)) -> TaggedUnion fields Source #

nameBits :: String -> TaggedUnion fields -> TaggedUnion fields Source #

(KnownNat n, Bits a) => Bits (Vec n a) # 
Instance details

Defined in Blarney.Vector

Associated Types

type SizeOf (Vec n a) :: Nat Source #

Methods

sizeOf :: Vec n a -> Int Source #

pack :: Vec n a -> Bit (SizeOf (Vec n a)) Source #

unpack :: Bit (SizeOf (Vec n a)) -> Vec n a Source #

nameBits :: String -> Vec n a -> Vec n a Source #

(Bits a, Bits b) => Bits (a, b) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b) :: Nat Source #

Methods

sizeOf :: (a, b) -> Int Source #

pack :: (a, b) -> Bit (SizeOf (a, b)) Source #

unpack :: Bit (SizeOf (a, b)) -> (a, b) Source #

nameBits :: String -> (a, b) -> (a, b) Source #

(Bits a, Bits b, Bits c) => Bits (a, b, c) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b, c) :: Nat Source #

Methods

sizeOf :: (a, b, c) -> Int Source #

pack :: (a, b, c) -> Bit (SizeOf (a, b, c)) Source #

unpack :: Bit (SizeOf (a, b, c)) -> (a, b, c) Source #

nameBits :: String -> (a, b, c) -> (a, b, c) Source #

(Bits a, Bits b, Bits c, Bits d) => Bits (a, b, c, d) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b, c, d) :: Nat Source #

Methods

sizeOf :: (a, b, c, d) -> Int Source #

pack :: (a, b, c, d) -> Bit (SizeOf (a, b, c, d)) Source #

unpack :: Bit (SizeOf (a, b, c, d)) -> (a, b, c, d) Source #

nameBits :: String -> (a, b, c, d) -> (a, b, c, d) Source #

(Bits a, Bits b, Bits c, Bits d, Bits e) => Bits (a, b, c, d, e) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b, c, d, e) :: Nat Source #

Methods

sizeOf :: (a, b, c, d, e) -> Int Source #

pack :: (a, b, c, d, e) -> Bit (SizeOf (a, b, c, d, e)) Source #

unpack :: Bit (SizeOf (a, b, c, d, e)) -> (a, b, c, d, e) Source #

nameBits :: String -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

(Bits a, Bits b, Bits c, Bits d, Bits e, Bits f) => Bits (a, b, c, d, e, f) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b, c, d, e, f) :: Nat Source #

Methods

sizeOf :: (a, b, c, d, e, f) -> Int Source #

pack :: (a, b, c, d, e, f) -> Bit (SizeOf (a, b, c, d, e, f)) Source #

unpack :: Bit (SizeOf (a, b, c, d, e, f)) -> (a, b, c, d, e, f) Source #

nameBits :: String -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

(Bits a, Bits b, Bits c, Bits d, Bits e, Bits f, Bits g) => Bits (a, b, c, d, e, f, g) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type SizeOf (a, b, c, d, e, f, g) :: Nat Source #

Methods

sizeOf :: (a, b, c, d, e, f, g) -> Int Source #

pack :: (a, b, c, d, e, f, g) -> Bit (SizeOf (a, b, c, d, e, f, g)) Source #

unpack :: Bit (SizeOf (a, b, c, d, e, f, g)) -> (a, b, c, d, e, f, g) Source #

nameBits :: String -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

class GBits f where Source #

Associated Types

type GSizeOf f :: Nat Source #

Methods

gsizeOf :: f a -> Int Source #

gpack :: f a -> Bit (GSizeOf f) Source #

gunpack :: Bit (GSizeOf f) -> f a Source #

gnameBits :: String -> f a -> f a Source #

Instances

Instances details
GBits (U1 :: k -> Type) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type GSizeOf U1 :: Nat Source #

Methods

gsizeOf :: forall (a :: k0). U1 a -> Int Source #

gpack :: forall (a :: k0). U1 a -> Bit (GSizeOf U1) Source #

gunpack :: forall (a :: k0). Bit (GSizeOf U1) -> U1 a Source #

gnameBits :: forall (a :: k0). String -> U1 a -> U1 a Source #

(GBits a, GBits b) => GBits (a :*: b :: k -> Type) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type GSizeOf (a :*: b) :: Nat Source #

Methods

gsizeOf :: forall (a0 :: k0). (a :*: b) a0 -> Int Source #

gpack :: forall (a0 :: k0). (a :*: b) a0 -> Bit (GSizeOf (a :*: b)) Source #

gunpack :: forall (a0 :: k0). Bit (GSizeOf (a :*: b)) -> (a :*: b) a0 Source #

gnameBits :: forall (a0 :: k0). String -> (a :*: b) a0 -> (a :*: b) a0 Source #

Bits a => GBits (K1 i a :: k -> Type) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type GSizeOf (K1 i a) :: Nat Source #

Methods

gsizeOf :: forall (a0 :: k0). K1 i a a0 -> Int Source #

gpack :: forall (a0 :: k0). K1 i a a0 -> Bit (GSizeOf (K1 i a)) Source #

gunpack :: forall (a0 :: k0). Bit (GSizeOf (K1 i a)) -> K1 i a a0 Source #

gnameBits :: forall (a0 :: k0). String -> K1 i a a0 -> K1 i a a0 Source #

GBits a => GBits (M1 i c a :: k -> Type) # 
Instance details

Defined in Blarney.Core.Bits

Associated Types

type GSizeOf (M1 i c a) :: Nat Source #

Methods

gsizeOf :: forall (a0 :: k0). M1 i c a a0 -> Int Source #

gpack :: forall (a0 :: k0). M1 i c a a0 -> Bit (GSizeOf (M1 i c a)) Source #

gunpack :: forall (a0 :: k0). Bit (GSizeOf (M1 i c a)) -> M1 i c a a0 Source #

gnameBits :: forall (a0 :: k0). String -> M1 i c a a0 -> M1 i c a a0 Source #