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
$date 2022-07-20T11:42:42 $end
$version Generated by Clash 1.7.0 $end
$comment No comment $end
$timescale 5000000ps $end
$scope module logic $end
$var wire 64 ! clockSignal500 $end
$var wire 64 " clockSignal0 $end
$upscope $end
$enddefinitions $end
#0
module LiftIOPlugin where
import GHC.Builtin.Names (ioTyConName)
import GHC.Core.Coercion (mkUnivCo)
import GHC.Core.Coercion.Axiom (Role (Nominal))
import GHC.Core.Predicate (EqRel (NomEq), Pred (EqPred), classifyPredType)
import GHC.Core.TyCo.Rep (UnivCoProvenance (PluginProv))
import GHC.Core.TyCon (tyConName)
import GHC.Core.Type (isTyVarTy, splitTyConApp_maybe)
import GHC.Driver.Plugins (Plugin (..), defaultPlugin, purePlugin)
{-# LANGUAGE ImplicitParams, RankNTypes, DataKinds,
TypeApplications, ScopedTypeVariables, KindSignatures,
ConstraintKinds, AllowAmbiguousTypes #-}
module NewHidden where
import qualified GHC.Classes
import GHC.TypeLits
import Unsafe.Coerce
type Hidden (x :: Symbol) a = GHC.Classes.IP x a
@christiaanb
christiaanb / gist:7d59800fb49170102a0453513fac4126
Created July 5, 2018 12:19
plugins + TH + GHC 8.6rc1 = fail
WARNING in hptSomeThingsBelowUs
missing module GHC.TypeLits.KnownNat.Solver
Probable cause: out-of-date interface files
[34 of 67] Compiling Clash.Signal.Bundle ( src/Clash/Signal/Bundle.hs, /home/christiaan/devel/clash-prelude/dist-newstyle/build/x86_64-linux/ghc-8.6.0.20180627/clash-prelude-0.99/build/Clash/Signal/Bundle.o )
src/Clash/Signal/Bundle.hs:1:1: fatal:
cannot find object file for module ‘GHC.TypeLits.KnownNat.Solver’
while linking an interpreted expression
{-# LANGUAGE FlexibleInstances #-}
module HKDClash where
import Clash.Prelude
import Data.Functor.Identity
type family HKD f a where
HKD Identity a = a
HKD f a = f a
module UART where
import CLaSH.Prelude
import qualified Data.List as L
type Byte = Unsigned 8
data TxState
= TxIdle
| TxStart (Unsigned 8)

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.
module FIR_transposed where
import CLaSH.Prelude
-- "Normal"
fir1 coeffs us x = (us',y)
where
us' = (x +>> us)
y = fold (+) (zipWith (*) us coeffs)
-- 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
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTSyntax #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
module SerialDecoder where
import CLaSH.Prelude
import CLaSH.Prelude.DataFlow