Skip to content

Instantly share code, notes, and snippets.

View christiaanb's full-sized avatar

Christiaan Baaij christiaanb

  • QBayLogic
  • Enschede, The Netherlands
View GitHub Profile
{-# LANGUAGE PartialTypeSignatures #-}
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
module MultiClockFifo where
import CLaSH.Prelude
import CLaSH.Prelude.Explicit
fifoMem wclk rclk addrSize waddr raddr winc wfull wdata =
asyncRam' wclk rclk
(d2 `powSNat` addrSize)
{-# LANGUAGE MultiParamTypeClasses, UndecidableInstances, FlexibleInstances #-}
module DF where
import CLaSH.Prelude hiding (parNDF, LockStep (..))
import CLaSH.Prelude.Explicit
import qualified Data.List as DL
-- The workaround begins here
parNDF :: (KnownSymbol nm, KnownNat rate, KnownNat n)
=> Vec n (DataFlow' ('Clk nm rate) aEn bEn a b)
module TestDF where
import CLaSH.Prelude
testDF :: (Eq b, Show b, KnownNat n, KnownNat m)
=> DataFlow Bool Bool a b
-> Vec n a -- ^ Inputs
-> Vec m b -- ^ Expected outputs
-> Signal Bool -- ^ 'True' indicates we're done with testing
testDF f testIn expOut =
{-# LANGUAGE RankNTypes, DataKinds, PolyKinds, GADTs, TypeFamilies,
FlexibleContexts, TemplateHaskell, ScopedTypeVariables,
UndecidableInstances, TypeOperators, FlexibleInstances #-}
import Data.Proxy
import GHC.Types
type KindOf (a :: k) = ('KProxy :: KProxy k)
data TyFun :: * -> * -> *
type family Apply (f :: TyFun k1 k2 -> *) (x :: k1) :: k2
~/devel/clash-compiler-ghc8 (ghc8)$ stack --stack-yaml=stack-ghc801.yaml build
clash-lib-0.7: build
Progre
-- While building package clash-lib-0.7 using:
/home/baaijcpr/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.24.0.0-ghc-8.0.0.20160411 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.0.0 build lib:clash-lib --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/baaijcpr/devel/clash-compiler-ghc8/.stack-work/logs/clash-lib-0.7.log
Preprocessing library clash-lib-0.7...
[ 8 of 44] Compiling CLaSH.Core.TyCon[boot] ( src/CLaSH/Core/TyCon.hs-boot, .stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/CLaSH/Core/TyCon.o-boot )
{-# LANGUAGE PatternSynonyms, ViewPatterns, TypeFamilies #-}
module Pat1 (Vec(Nil,(:>)), pattern (:>)) where
import qualified Control.Lens as Lens hiding (pattern (:>))
newtype Vec a = Vec {unvec :: [a]}
pattern Nil :: Vec a
pattern Nil = Vec []
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTSyntax #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
module SerialDecoder where
import CLaSH.Prelude
import CLaSH.Prelude.DataFlow
-- NOINLINE means it is a primitive
{-# LANGUAGE DataKinds, KindSignatures, GADTs, PatternSynonyms,
GeneralizedNewtypeDeriving, ImplicitParams, RecordWildCards,
TypeOperators #-}
module Signal where
import Control.Applicative
import Data.Reflection (reifyNat)
import GHC.TypeLits
module FIR_transposed where
import CLaSH.Prelude
-- "Normal"
fir1 coeffs us x = (us',y)
where
us' = (x +>> us)
y = fold (+) (zipWith (*) us coeffs)

Goal

Dynamic libraries (.so/.dll/.dylib) go into a single shared directory (per package database)

Things that need to be done

  • Split the library-dirs field of the package database into static-library-dirs and dynamic-library-dirs
  • Update Cabal and GHCs RPATH calculation mechanism to use the dynamic-library-dirs field of the package database
  • Reinvigorate haskell/cabal#3979 which adds a --dylibdir setting to Cabal, which specifies where dynamic libraries get copied
    • Update the Cabal RPATH calculation as mentioned above
    • Cabal's extralibdir configuration field gets added to both the static-library-dirs and dynamic-library-dirs fields of the package database.