clash-prelude-1.0.0: CAES Language for Synchronous Hardware - Prelude library
Copyright(C) 2018 Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Annotations.BitRepresentation.Util

Description

 
Synopsis

Documentation

bitOrigins :: DataRepr' -> ConstrRepr' -> [BitOrigin] Source #

Given a type size and one of its constructor this function will yield a specification of which bits the whole type is made up of. I.e., a construction plan on how to make the whole data structure, given its individual constructor fields.

bitOrigins' :: DataRepr' -> ConstrRepr' -> [BitOrigin] Source #

Same as bitOrigins, but each item in result list represents a single bit.

bitRanges :: Integer -> [(Int, Int)] Source #

Determine consecutively set bits in word. Will produce ranges from high to low. Examples:

bitRanges 0b10 == [(1,1)] bitRanges 0b101 == [(2,2),(0,0)] bitRanges 0b10011001111 == [(10,10),(7,6),(3,0)]

data BitOrigin Source #

Result of various utilty functions. Indicates the origin of a certain bit: either a literal from the constructor (or an undefined bit), or from a literal.

Constructors

Lit [Bit]

Literal (high, low, undefind)

Field Int Int Int

Bits originate from a field. Field fieldnr from downto.

Instances

Instances details
Show BitOrigin Source # 
Instance details

Defined in Clash.Annotations.BitRepresentation.Util

data Bit Source #

Constructors

H

High

L

Low

U

Undefined

Instances

Instances details
Eq Bit Source # 
Instance details

Defined in Clash.Annotations.BitRepresentation.Util

Methods

(==) :: Bit -> Bit -> Bool #

(/=) :: Bit -> Bit -> Bool #

Show Bit Source # 
Instance details

Defined in Clash.Annotations.BitRepresentation.Util

Methods

showsPrec :: Int -> Bit -> ShowS #

show :: Bit -> String #

showList :: [Bit] -> ShowS #