| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
ReWire.Bits
Synopsis
- type Lit = W 128
- zero :: Bit
- one :: Bit
- bit :: W 1 -> Bit
- toInteger :: forall (n :: Nat). W n -> Integer
- (@@) :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m) => W n -> (Integer, Integer) -> W m
- (@.) :: forall (n :: Nat). KnownNat n => W n -> Integer -> Bit
- lit :: forall (n :: Nat). KnownNat n => Integer -> W n
- resize :: forall (m :: Nat) (n :: Nat). KnownNat m => W n -> W m
- sext :: forall (m :: Nat) (n :: Natural). KnownNat m => W (1 + n) -> W (m + (1 + n))
- bitSlice :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m) => W n -> Integer -> Integer -> W m
- bitIndex :: forall (n :: Nat). KnownNat n => W n -> Integer -> Bit
- finBitSlice :: forall (m :: Nat) (n :: Nat). KnownNat m => W n -> Finite n -> Finite n -> W m
- finBitIndex :: forall (n :: Nat). W n -> Finite n -> Bit
- (+) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (-) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (*) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (/) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (%) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (**) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (&&&) :: Bool -> Bool -> Bool
- (|||) :: Bool -> Bool -> Bool
- (&&.) :: forall (n :: Nat). W n -> W n -> Bool
- (||.) :: forall (n :: Nat). W n -> W n -> Bool
- lnot :: forall (n :: Nat). W n -> Bit
- (.&.) :: forall (n :: Nat). W n -> W n -> W n
- (.|.) :: forall (n :: Nat). W n -> W n -> W n
- bnot :: forall (n :: Nat). W n -> W n
- (^) :: forall (n :: Nat). W n -> W n -> W n
- xor :: Bool -> Bool -> Bool
- (~^) :: forall (n :: Nat). W n -> W n -> W n
- (<<.) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (>>.) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- (>>>) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n
- rotR :: forall (m :: Nat). KnownNat m => W m -> W m -> W m
- rotL :: forall (m :: Nat). KnownNat m => W m -> W m -> W m
- (==) :: forall (n :: Nat). W n -> W n -> Bool
- (/=) :: forall (n :: Nat). W n -> W n -> Bool
- (>) :: forall (n :: Nat). W n -> W n -> Bool
- (>=) :: forall (n :: Nat). W n -> W n -> Bool
- (<) :: forall (n :: Nat). W n -> W n -> Bool
- (<=) :: forall (n :: Nat). W n -> W n -> Bool
- (<>) :: forall (n :: Nat) (m :: Nat). W n -> W m -> W (n + m)
- rAnd :: forall (n :: Nat). W n -> Bit
- rNAnd :: forall (n :: Natural). W (1 + n) -> Bit
- rOr :: forall (n :: Nat). W n -> Bit
- rNor :: forall (n :: Natural). W (1 + n) -> Bit
- rXOr :: forall (n :: Natural). W (1 + n) -> Bit
- rXNor :: forall (n :: Natural). W (1 + n) -> Bit
- msbit :: forall (n :: Natural). W (1 + n) -> Bit
- odd :: forall (n :: Natural). W (1 + n) -> Bool
- even :: forall (n :: Natural). W (1 + n) -> Bool
Documentation
toInteger :: forall (n :: Nat). W n -> Integer Source #
The unsigned value of a bit vector, as an Integer. A GHC-only convenience for simulation and testing: rwc does not compile uses of this function (Integer is a compile-time-literal-only type in the compiled fragment).
(@@) :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m) => W n -> (Integer, Integer) -> W m Source #
Project range of bits. a @@ (j, i) returns bits j (most significant) to i (least significant) from a (j >= i). The Integer arguments must be non-negative integer literals (after inlining).
(@.) :: forall (n :: Nat). KnownNat n => W n -> Integer -> Bit Source #
Project single bit. The Integer argument must be a non-negative integer literal (after inlining).
Primitive bitwise operations based on Verilog operators.
lit :: forall (n :: Nat). KnownNat n => Integer -> W n Source #
Interpret an Integer literal into a bit vector. Truncates most significant bits or zero-pads to make it fit.
resize :: forall (m :: Nat) (n :: Nat). KnownNat m => W n -> W m Source #
Resize bitvector, truncating or zero padding most significant bits.
sext :: forall (m :: Nat) (n :: Natural). KnownNat m => W (1 + n) -> W (m + (1 + n)) Source #
Sign-extend a bitvector by m bits (the result width is inferred
from the use site). Compiles to the idiomatic replicated-msb
concatenation.
bitSlice :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m) => W n -> Integer -> Integer -> W m Source #
finBitSlice :: forall (m :: Nat) (n :: Nat). KnownNat m => W n -> Finite n -> Finite n -> W m Source #
(/) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n infixl 8 Source #
Unsigned division. Division by zero yields all-ones (2^n - 1), following the SMT-LIB convention (compiled RTL, the interpreter, and the GHC implementation agree).
(%) :: forall (n :: Nat). KnownNat n => W n -> W n -> W n infixl 8 Source #
Unsigned modulus. A zero divisor yields the dividend, following the SMT-LIB convention (compiled RTL, the interpreter, and the GHC implementation agree).
xor :: Bool -> Bool -> Bool infixl 4 Source #
Logical xor, for Bit/Bool (using the built-in operator).