clash-prelude
CAES Language for Synchronous Hardware - Prelude library
| Version on this page: | 0.10.14 |
| LTS Haskell 24.18: | 1.8.3 |
| Stackage Nightly 2025-07-14: | 1.8.2@rev:3 |
| Latest on Hackage: | 1.8.3 |
clash-prelude-0.10.14@sha256:40e78e58c546cb526615ba0c5658c6d6b6bdd7c6e5d7d07ff1b4053572f84cc5,7167Module documentation for 0.10.14
- CLaSH
- CLaSH.Annotations
- CLaSH.Class
- CLaSH.Examples
- CLaSH.Prelude
- CLaSH.Promoted
- CLaSH.Signal
- CLaSH.Sized
- CLaSH.Tutorial
CλaSH - A functional hardware description language
WARNING Only works with GHC-7.10.* (http://www.haskell.org/ghc/download_ghc_7_10_3)!
CλaSH (pronounced ‘clash’) is a functional hardware description language that borrows both its syntax and semantics from the functional programming language Haskell. The CλaSH compiler transforms these high-level descriptions to low-level synthesizable VHDL, Verilog, or SystemVerilog.
Features of CλaSH:
-
Strongly typed (like VHDL), yet with a very high degree of type inference, enabling both safe and fast prototying using consise descriptions (like Verilog).
-
Interactive REPL: load your designs in an interpreter and easily test all your component without needing to setup a test bench.
-
Higher-order functions, with type inference, result in designs that are fully parametric by default.
-
Synchronous sequential circuit design based on streams of values, called
Signals, lead to natural descriptions of feedback loops. -
Support for multiple clock domains, with type safe clock domain crossing.
Support
For updates and questions join the mailing list [email protected] or read the forum
Changes
Changelog for clash-prelude package
0.10.14 August 21st 2016
- Build against ghc-typelits-extra-0.2
0.10.13 August 18th 2016
- New features:
- Thanks to Joe Hermaszewski (@expipiplus1): Add an explicitly clocked
DSignal - Add a
Realinstance forFixed#158
- Thanks to Joe Hermaszewski (@expipiplus1): Add an explicitly clocked
- Fixes bugs:
- {BitVector;Index;Signed;Unsigned}
enumFromToand friends overflowed on values outsideIntrange #166
- {BitVector;Index;Signed;Unsigned}
0.10.12
- Fixes bugs:
Vecsunbundleis too strict, i.e.register (undefined :: Vec 2 Int)/=bundle . unbundle . register (undefined :: Vec 2 Int)
0.10.11 August 3rd 2016
- New features:
- Add strict version of:
sample,sampleN,fromList, andsimulate - Make
Signals<*>slightly stricter:- Feedback loops still work with this new implementation
- No more space-leaks when used in combination with the strict version of
sample,sampleN, andsimulate
- Add
NFDatainstances for the numeric types
- Add strict version of:
- Speed up arithmetic operations of
Signed,UnsignedandBitVector - Fixes bugs:
- CLaSH compiler sees internals of numeric types in their
Liftfunctions
- CLaSH compiler sees internals of numeric types in their
0.10.10 July 15th 2016
- Fixes bugs:
shrinkfunctions for numeric types throw exceptions #153- CLaSH compiler sees internals of numeric types in their Show functions
0.10.9 June 9th 2016
- Fixes bugs:
Eqinstance ofVecsometimes not synthesisable
0.10.8 June 7th 2016
- New features:
- Instances of
Datafor numeric types. - Instances of
Readfor {Index, Signed, Unsigned, Fixed} - Instances of
BitPackfor 3-8 tuples
- Instances of
0.10.7 April 7th 2016
- Support doctest-0.11.0
0.10.6 February 10th 2016
- Fixes bugs:
CLaSH.Prelude.DataFlow.parNDFis not lazy enough
0.10.5 January 13th 2016
- New features:
- Add
readNewtoCLaSH.Prelude.BlockRam: create a read-after-write blockRAM from a read-before-write blockRAM. popCountfunctions forBitVector,Signed, andUnsignedare now synthesisable.- Add
parNDFtoCLaSH.Prelude.DataFlow: compose N dataflow circuits in parallel. - Add and instance
Vec n aforLockStepinCLaSH.Prelude.DataFlow: have N dataflow circuits operate in lock-step.
- Add
0.10.4 December 11th 2015
- New features:
- Add
pureDFtoCLaSH.Prelude.DataFlow: lift combinational circuits toDataFlowcircuits. - Add
fifoDFtoCLaSH.Prelude.DataFlow: a simple FIFO buffer adhering to theDataFlowprotocol. loopDFno longer uses thelockStepandstepLockautomatically, and now includes a FIFO buffer on the feedback path.- Add
loopDF_nobuftoCLaSH.Prelude.DataFlow: a version ofloopDFwith no FIFO buffer on the feedback path. - Add
boolToBVtoCLaSH.CLass.BitPack: convertBooleans ton-bitBitVectors. ClockSourceinCLaSH.Annotations.TopEntitycan now have multiple clock inputs #33
- Add
- Bug fixes:
asyncRomFilereads file multiple times.
0.10.3 October 24th 2015
- Disable CPR analysis (See https://github.com/clash-lang/clash-compiler/commit/721fcfa9198925661cd836668705f817bddaae3c):
- GHC < 7.11: In all modules using
-fcpr-off - GHC >= 7.11: In
CLaSH.Signal.InternalandCLaSH.Prelude.RAMusing-fno-cpr-anal
- GHC < 7.11: In all modules using
0.10.2 October 21st 2015
- New features:
ExtendingNum,BitPack, andResizeinstance forIndex- Add
bv2i: convertBitVector ntoIndex (2^n) - Export type-level operations from ghc-typelits-extra
0.10.1 October 16th 2015
- New features:
- The
findfold p f, now has anSNat linstead of aProxy las its first argument. - Add
bv2vandv2bvfunctions that convert betweenVec n BitandBitVector n. - Add
smap: apply a function to every element of a vector and the element’s position (as an ‘SNat’ value) in the vector.
- The
0.10 October 3rd 2015
- New features:
- The Vec constructor
:>is now an explicitly bidirectional pattern synonym (the actual constructor has been renamed to Cons). As a result, pattern matching on:>is now synthesisable by the CLaSH compiler. - The function
<:is replaced by the the explicitly bidirectional pattern synonym:<. This allows you to pattern match on: “all but the last element of a vector” and “the last element” of the vector. Because it is a bidirectional pattern,:<can also be used as an expression that appends an element to the tail of a vector. - Add a
transposefunction inCLaSH.Sized.Vector. - Add
stencil1dandstensil2dstencil computation functions inCLaSH.Sized.Vector. - Add
permute,backpermute,scatter, andgatherpermutation functions inCLaSH.Sized.Vector. - Add specialised permutation functions
interleave,rotateLeft, androtateRightinCLaSH.Sized.Vector. sscanlandsscanrinCLaSH.Sized.Vectorare renamed topostscanland postscanrto be more in line with existing Haskell packages such asvectorandaccelerate`.- The
FoldableandTraversableinstances ofVecnow only works for non-empty vectors. - Where possible, members of the
Foldableinstance ofVecare described in terms offold, which builds a tree (of depthlog(n)) of computations, instead offoldrwhich had depthncomputations. This reduces the critical path length in your circuits when using these functions. maxIndexandlengthinCLaSH.Sized.Vectorreturn anIntinstead of anInteger.- Add functions that involve an index into a vector to the
CLaSH.Sized.Vectormodule:indices,indicesI,imap,izipWith,ifoldr,ifoldl,findIndex,elemIndex. CLaSH.Sized.Vector’sfold,dfold,vfold, andtoListare now synthesisable by the CLaSH compiler.
- The Vec constructor
0.9.3 September 21st 2015
- Fixes bugs:
- Cannot build against singletons-0.2
- Numerous documentation fixes
0.9.2 August 2nd 2015
- Disable strictness analysis in
CLaSH.Signal.Internal, this allows turning on strictness analysis in the GHC front-end of the CLaSH compiler.
0.9.1 June 26th 2015
- Updated documentation on data-file support on Altera/Quartus
0.9 June 25th 2015
- New features:
- Add operations on singleton natural numbers:
addSNat,subSNat,mulSNat, andpowSNat. - Add asynchronous RAM functions in
CLaSH.Prelude.RAM, which have an asynchronous/combinational read port. - Add ROM functions in modules
CLaSH.Prelude.ROMandCLaSH.Prelude.ROM.File, where the latter module contains functions that instantiate a ROM from the content specified in an external data-file. - Add BlockRam functions, in the
CLaSH.Prelude.BlockRam.Filemodule, whose content can be initialised with the content specified in an external data-file. assertnow takes an extraStringargument so you can distinguish oneassertfrom the others. Additionally,assert'is added which takes an additionalSClockargument. This is needed, becauseassertnow reports the clock cycle, and clock domain, when an assertion fails.defClkAlteraanddefClkXilinxare replaced by,altpllandalteraPllfor Altera clock sources, andclockWizardfor Xilinx clock sources. These names correspond to the names of the generator utilities in Quartus and ISE/Vivado.- Add Safe versions of the prelude modules:
CLaSH.Prelude.SafeandCLaSH.Prelude.Explicit.Safe - Add synchronizers in the
CLaSH.Prelude.Synchronizermodule
- Add operations on singleton natural numbers:
0.8 June 3rd 2015
- New features:
-
Make the (Bit)Vector argument the last argument for the following functions:
slice,setSlice,replaceBit,replace. The signatures for the above functions are now:slice :: BitPack a => SNat m -> SNat n -> a -> BitVector (m + 1 - n) setSlice :: BitPack a => SNat m -> SNat n -> BitVector (m + 1 - n) -> a -> a replaceBit :: Integral i => i -> Bit -> a -> a replace :: Integral i => i -> a -> Vec n a -> Vec n aThis allows for easier chaining, e.g.:
replaceBit 0 1 $ repleceBit 4 0 $ replaceBit 6 1 bv -
Until version 0.7.5, given
x :: Vec 8 Bitandy :: BitVector 8, it used to belast x == msb y. This is quite confusing when printing converted values. Until version 0.7.5 we would get:> 0x0F :: BitVector 8 0000_1111 > unpack 0x0F :: Vec 8 Bit <1,1,1,1,0,0,0,0>As of version 0.8, we have
head x == msb y:> 0x0F :: BitVector 8 0000_1111 > unpack 0x0F :: Vec 8 Bit <0,0,0,0,1,1,1,1>So converting for
Vectors ofBits toBitVectors is no longer index-preserving, but it is order-preserving. -
Add QuickCheck
ArbitaryandCoArbitaryinstances for all data types -
Add lens
Ixedinstances forBitVector,Signed,Unsigned, andVec
-
0.7.5 May 7th 2015
- New features:
- Moore machine combinators
0.7.4 *May 5th 2015
- New features:
- Add
TopEntityannotations
- Add
0.7.3 April 22nd 2015
- New features:
- Add the vector functions:
zip3,unzip3, andzipWith3 - Use version 0.2 of the
ghc-typelits-natnormalisepackage
- Add the vector functions:
0.7.2 April 20th 2015
- New features:
- Support for GHC 7.10 => only works with GHC 7.10 and higher
- Use http://hackage.haskell.org/package/ghc-typelits-natnormalise typechecker plugin for better type-level natural number handling
0.7.1 March 25th 2015
- Fixes bugs:
- Fix laziness bug in Vector.(!!) and Vector.replace
0.7 March 13th 2015
-
New features:
- Switch types of
bundleandbundle', andunbundleandunbundle'. - Rename all explicitly clocked versions of Signal functions, to the primed
name of the implicitly clocked Signal functions. E.g.
cregisteris now calledregister'(where the implicitly clocked function is callledregister) - Add new instances for
DSignal - Add experimental
antiDelayfunction forDSignal - Generalize lifted functions over Signals (e.g. (.==.))
- Switch types of
-
Fixes bugs:
- Faster versions of Vector.(!!) and Vector.replace
0.6.0.1 November 17th 2014
- Fixes bugs:
- Add missing ‘CLaSH.Sized.BitVector’ module to .cabal file.
0.6 November 17th 2014
-
New features:
- Add
Fractionalinstance forFixed#9 - Make indexing/subscript of
Vecascending #4 - Add separate
BitVectortype, which has a descending index. - Add bit indexing operators, including the index/subscript operator
(!). - Add bit reduction operators:
reduceOr,reduceAnd,reduceOr. - Rename
BitVectorclass toBitPackwithpackandunpackclass methods. - Rename
Packclass toBundlewithbundleandunbundleclass methods. - Strip all
Vecfunctions from theirvprefix, i.e.vmap->map. - Rename
Vecindexing operator from(!)to(!!). - Combine
AddandMultclass intoExtendingNumclass. - Add extend and truncate methods to the
Resizeclass. - Add
SaturatingNumclass with saturating numeric operators. - Add multitude of lifted
Signaloperators, i.e.(.==.) :: Eq a => Signal a -> Signal a -> Signal Bool - Add
CLaSH.Signal.Delayedwith functions and data types for delay-annotated signals to support safe synchronisation. - Add
CLASH.Prelude.DataFlowwith functions and data types to create self-synchronising circuits based on data-flow principles.
- Add
-
Fixes bugs:
- Remove deprecated ‘Arrow’ instance for and related functions for
Comp#5
- Remove deprecated ‘Arrow’ instance for and related functions for
0.5.1 June 5th 2014
-
New features:
-
Fixes bugs:
0.5 April 3rd 2014
- Add explicitly clocked synchronous signals for multi-clock circuits
0.4.1 March 27th 2014
- Add saturation to fixed-point operators
- Finalize most documentation
0.4 March 20th 2014
- Add fixed-point integers
- Extend documentation
- ‘bit’ and ‘testBit’ functions give run-time errors on out-of-bound positions
0.3 March 14th 2014
- Add Documentation
- Easy SNat literals for 0..1024, e.g. d4 = snat :: SNat 4
- Fix blockRamPow2
0.2 March 5th 2014
- Initial release