clash-prelude-1.8.4: Clash: a functional hardware description language - Prelude library

Copyright | (C) 2019 Andrew Lelechenko
License | MIT
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | None
Language | Haskell2010

Clash.Sized.Internal.Mod

Description

This module contains code from: https://hackage.haskell.org/package/mod and has the following license:

Copyright (c) 2019 Andrew Lelechenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Synopsis

- subMod :: Natural -> Natural -> Natural -> Natural
- addMod :: Natural -> Natural -> Natural -> Natural
- mulMod :: Natural -> Natural -> Natural -> Natural
- mulMod2 :: Natural -> Natural -> Natural -> Natural
- negateMod :: Natural -> Natural -> Natural
- complementMod :: Natural -> Natural -> Natural
- maskMod :: Natural -> Natural -> Natural
- bigNatToNat :: BigNat# -> Natural
- subIfGe :: BigNat# -> BigNat# -> Natural
- brokenInvariant :: a

# Documentation

subMod :: Natural -> Natural -> Natural -> Natural Source #

modular subtraction

addMod :: Natural -> Natural -> Natural -> Natural Source #

modular addition

mulMod :: Natural -> Natural -> Natural -> Natural Source #

modular multiplication

mulMod2 :: Natural -> Natural -> Natural -> Natural Source #

modular multiplication for powers of 2, takes a mask instead of a wrap-around point

negateMod :: Natural -> Natural -> Natural Source #

modular negations

complementMod :: Natural -> Natural -> Natural Source #

Given a size in bits, return a function that complements the bits in a `Natural` up to that size.

maskMod :: Natural -> Natural -> Natural Source #

Keep all the bits up to a certain size

bigNatToNat :: BigNat# -> Natural Source #

subIfGe :: BigNat# -> BigNat# -> Natural Source #

brokenInvariant :: a Source #