clash-lib-1.7.0: 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.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Netlist.Expr

Description

Functions for expression manipulation

Synopsis

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.