clash-lib-1.8.4: Clash: a functional hardware description language - As a library

Copyright | (C) 2012-2016 University of Twente 2017 Myrtle Software Ltd 2017-2018 Google Inc. 2020-2022 QBayLogic B.V. 2022 Google Inc.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | None
Language | Haskell2010

Clash.Netlist.Expr

Description

Functions for expression manipulation

Synopsis

- bits :: HasCallStack => Size -> Expr -> Either Expr (Tree [Bool])
- toBits :: Bits a => Int -> a -> [Bool]
- fromBits :: Bits a => [Bool] -> a

# Documentation

bits :: HasCallStack => Size -> Expr -> Either Expr (Tree [Bool]) Source #

Turns a constant expression of known bitsize into their corresponding bitstream representation, arranged as a tree that corresponds to the structure of the expression.

NOTE: This conversion serves as a best effort approach and can be considered a hack. Fully featured constant expression evaluation is not available in clash yet and will replace this implementation once it is officially supported.

toBits :: Bits a => Int -> a -> [Bool] Source #

Turns values into bitstreams of known length. If the bit stream requires more bits for representing the given value, then only the suffix of the corresponding bitstream gets returned.

fromBits :: Bits a => [Bool] -> a Source #

Turns bitstreams into values.