packages feed

clash-vexriscv-0.1: clash-vexriscv.cabal

cabal-version:       3.8
name:                clash-vexriscv
version:             0.1
synopsis:            VexRiscv CPU core for use in Clash designs
description:
  Provides the tooling to integrate a
  <https://github.com/SpinalHDL/VexRiscv VexRiscv> CPU core into a Clash
  design. The package does not offer a CPU directly; instead it provides
  Cabal @Setup.hs@ hooks that generate a CPU from a Scala-based
  configuration at build time, together with the Haskell bindings
  (FFI, blackboxes, simulation helpers) needed to use the resulting core
  from Clash.
License:             Apache-2.0
license-file:        LICENSE
author:              QBayLogic B.V.
maintainer:          devops@qbaylogic.com
Copyright:           Copyright © 2022 Google LLC
build-type:          Simple
category:            Development

extra-doc-files:
  README.md
  CHANGELOG.md

data-files:
  data/vexriscv/build.sbt
  data/vexriscv/ffi/*.cpp
  data/vexriscv/ffi/*.h
  data/vexriscv/lib/*.jar
  data/vexriscv/lib/*.py
  data/vexriscv/Makefile
  data/vexriscv/project/build.properties
  data/vexriscv/project/Dependencies.scala

common common-options
  default-extensions:
    BangPatterns
    BinaryLiterals
    ConstraintKinds
    DataKinds
    DefaultSignatures
    DeriveAnyClass
    DeriveDataTypeable
    DeriveFoldable
    DeriveFunctor
    DeriveGeneric
    DeriveLift
    DeriveTraversable
    DerivingStrategies
    InstanceSigs
    KindSignatures
    LambdaCase
    NoStarIsType
    PackageImports
    PolyKinds
    RankNTypes
    ScopedTypeVariables
    StandaloneDeriving
    TupleSections
    TypeApplications
    TypeFamilies
    TypeOperators
    ViewPatterns

    -- TemplateHaskell is used to support convenience functions such as
    -- 'listToVecTH' and 'bLit'.
    TemplateHaskell
    QuasiQuotes

    -- Prelude isn't imported by default as Clash offers Clash.Prelude
    NoImplicitPrelude

  -- See https://github.com/clash-lang/clash-compiler/pull/2511
  if impl(ghc >= 9.4)
    CPP-Options: -DCLASH_OPAQUE=OPAQUE
  else
    CPP-Options: -DCLASH_OPAQUE=NOINLINE

  ghc-options:
    -Wall -Wcompat

    -- Plugins to support type-level constraint solving on naturals
    -fplugin GHC.TypeLits.Extra.Solver
    -fplugin GHC.TypeLits.Normalise
    -fplugin GHC.TypeLits.KnownNat.Solver

    -- Clash needs access to the source code in compiled modules
    -fexpose-all-unfoldings

    -- Worker wrappers introduce unstable names for functions that might have
    -- blackboxes attached for them. You can disable this, but be sure to add
    -- a no-specialize pragma to every function with a blackbox.
    -fno-worker-wrapper
      -- clash-prelude will set suitable version bounds for the plugins
  build-depends:
    base >= 4.18 && < 4.22,
    clash-prelude >= 1.9.0,
    containers >= 0.6 && < 0.9,
    ghc-typelits-natnormalise,
    ghc-typelits-extra,
    ghc-typelits-knownnat,

  other-modules: Paths_clash_vexriscv
  autogen-modules: Paths_clash_vexriscv

library
  import: common-options
  hs-source-dirs: src
  default-language: Haskell2010
  exposed-modules:
    VexRiscv
    VexRiscv.BlackBox
    VexRiscv.ClockTicks
    VexRiscv.Paths
    VexRiscv.FFI
    VexRiscv.Internal
    VexRiscv.JtagTcpBridge
    VexRiscv.Random
    VexRiscv.Reset
    VexRiscv.Setup
    VexRiscv.VecToTuple

  build-depends:
    async,
    bytestring >= 0.10 && < 0.13,
    Cabal >= 3.14 && < 4,
    clash-lib,
    clash-prelude >= 1.10 && < 1.12,
    clash-protocols,
    containers,
    deepseq,
    directory >= 1.3 && < 1.4,
    extra,
    filepath,
    Glob,
    hashable,
    infinite-list,
    interpolate,
    mtl,
    network,
    pretty-show,
    process >= 1.6 && < 1.8,
    random,
    tagged,
    template-haskell,
    temporary,
    text,
  include-dirs: data/vexriscv
  cxx-sources: data/vexriscv/ffi/impl.cpp
  cxx-options: -std=c++11
  extra-libraries: stdc++

test-suite unittests
  import: common-options
  hs-source-dirs: tests/unittests
  default-language: Haskell2010
  type: exitcode-stdio-1.0
  main-is: main.hs
  ghc-options: -Wall -Wcompat -threaded -rtsopts
  other-modules:
    Tests.Extra
    Tests.VexRiscv.ClockTicks
    Tests.VexRiscv.Random
    Tests.VexRiscv.Reset
  build-depends:
    HUnit,
    base,
    clash-prelude-hedgehog,
    clash-vexriscv,
    bytestring,
    hedgehog >= 1.5 && < 1.8,
    tasty >= 1.4 && < 1.6,
    tasty-hedgehog,
    tasty-hunit,
    tasty-th,
    template-haskell,