clash-prelude-1.2.1: CAES Language for Synchronous Hardware - Prelude library

Copyright(C) 2019 Andrew Lelechenko
LicenseMIT
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

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

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 :: Integer -> Natural -> Natural Source #

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

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

Keep all the bits up to a certain size