Making sure that it builds is annoying
This commit is contained in:
parent
7ac02ccb3c
commit
40ea83e76d
@ -1,5 +0,0 @@
|
|||||||
# Revision history for PPU
|
|
||||||
|
|
||||||
## 0.1.0.0 -- YYYY-mm-dd
|
|
||||||
|
|
||||||
* First version. Released on an unsuspecting world.
|
|
224
PPU.cabal
224
PPU.cabal
@ -1,130 +1,130 @@
|
|||||||
cabal-version: 3.4
|
cabal-version: 3.4
|
||||||
-- The cabal-version field refers to the version of the .cabal specification,
|
|
||||||
-- and can be different from the cabal-install (the tool) version and the
|
|
||||||
-- Cabal (the library) version you are using. As such, the Cabal (the library)
|
|
||||||
-- version used must be equal or greater than the version stated in this field.
|
|
||||||
-- Starting from the specification version 2.2, the cabal-version field must be
|
|
||||||
-- the first thing in the cabal file.
|
|
||||||
|
|
||||||
-- Initial package description 'PPU' generated by
|
|
||||||
-- 'cabal init'. For further documentation, see:
|
|
||||||
-- http://haskell.org/cabal/users-guide/
|
|
||||||
--
|
|
||||||
-- The name of the package.
|
|
||||||
name: PPU
|
name: PPU
|
||||||
|
version: 1.0
|
||||||
-- The package version.
|
|
||||||
-- See the Haskell package versioning policy (PVP) for standards
|
|
||||||
-- guiding when and how versions should be incremented.
|
|
||||||
-- https://pvp.haskell.org
|
|
||||||
-- PVP summary: +-+------- breaking API changes
|
|
||||||
-- | | +----- non-breaking API additions
|
|
||||||
-- | | | +--- code changes with no API change
|
|
||||||
version: 0.1.0.0
|
|
||||||
|
|
||||||
-- A short (one-line) description of the package.
|
|
||||||
synopsis: Pingu Processing Unit
|
|
||||||
|
|
||||||
-- A longer description of the package.
|
|
||||||
-- description:
|
|
||||||
|
|
||||||
-- URL for the project homepage or repository.
|
|
||||||
homepage: https://git.acorneroftheweb.com/pingu/ppu
|
|
||||||
|
|
||||||
-- The license under which the package is released.
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
author: Nor Führ <nor@acorneroftheweb.com>
|
||||||
|
maintainer: Nor Führ <nor@acorneroftheweb.com>
|
||||||
|
|
||||||
-- The file containing the license text.
|
common common-options
|
||||||
license-file: LICENSE
|
default-extensions:
|
||||||
|
BangPatterns
|
||||||
|
BinaryLiterals
|
||||||
|
ConstraintKinds
|
||||||
|
DataKinds
|
||||||
|
DefaultSignatures
|
||||||
|
DeriveAnyClass
|
||||||
|
DeriveDataTypeable
|
||||||
|
DeriveFoldable
|
||||||
|
DeriveFunctor
|
||||||
|
DeriveGeneric
|
||||||
|
DeriveLift
|
||||||
|
DeriveTraversable
|
||||||
|
DerivingStrategies
|
||||||
|
InstanceSigs
|
||||||
|
KindSignatures
|
||||||
|
LambdaCase
|
||||||
|
NoStarIsType
|
||||||
|
PolyKinds
|
||||||
|
RankNTypes
|
||||||
|
ScopedTypeVariables
|
||||||
|
StandaloneDeriving
|
||||||
|
TupleSections
|
||||||
|
TypeApplications
|
||||||
|
TypeFamilies
|
||||||
|
TypeOperators
|
||||||
|
ViewPatterns
|
||||||
|
|
||||||
-- The package author(s).
|
-- TemplateHaskell is used to support convenience functions such as
|
||||||
author: Nor Führ
|
-- 'listToVecTH' and 'bLit'.
|
||||||
|
TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
|
||||||
-- An email address to which users can send suggestions, bug reports, and patches.
|
-- Prelude isn't imported by default as Clash offers Clash.Prelude
|
||||||
maintainer: nor@acorneroftheweb.com
|
NoImplicitPrelude
|
||||||
|
ghc-options:
|
||||||
|
-Wall -Wcompat
|
||||||
|
-haddock
|
||||||
|
|
||||||
-- A copyright notice.
|
-- Plugins to support type-level constraint solving on naturals
|
||||||
-- copyright:
|
-fplugin GHC.TypeLits.Extra.Solver
|
||||||
build-type: Simple
|
-fplugin GHC.TypeLits.Normalise
|
||||||
|
-fplugin GHC.TypeLits.KnownNat.Solver
|
||||||
|
|
||||||
-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.
|
-- Clash needs access to the source code in compiled modules
|
||||||
extra-doc-files: CHANGELOG.md
|
-fexpose-all-unfoldings
|
||||||
|
|
||||||
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
|
-- Worker wrappers introduce unstable names for functions that might have
|
||||||
-- extra-source-files:
|
-- 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
|
||||||
|
|
||||||
|
-- Strict annotations - while sometimes preventing space leaks - trigger
|
||||||
|
-- optimizations Clash can't deal with. See:
|
||||||
|
--
|
||||||
|
-- https://github.com/clash-lang/clash-compiler/issues/2361
|
||||||
|
--
|
||||||
|
-- These flags disables these optimizations. Note that the fields will
|
||||||
|
-- remain strict.
|
||||||
|
-fno-unbox-small-strict-fields
|
||||||
|
-fno-unbox-strict-fields
|
||||||
|
build-depends:
|
||||||
|
base,
|
||||||
|
Cabal,
|
||||||
|
|
||||||
|
-- clash-prelude will set suitable version bounds for the plugins
|
||||||
|
clash-prelude >= 1.6.4 && < 1.8,
|
||||||
|
ghc-typelits-natnormalise,
|
||||||
|
ghc-typelits-extra,
|
||||||
|
ghc-typelits-knownnat,
|
||||||
|
|
||||||
common warnings
|
|
||||||
ghc-options: -Wall
|
|
||||||
|
|
||||||
library
|
library
|
||||||
-- Import common warning flags.
|
import: common-options
|
||||||
import: warnings
|
|
||||||
|
|
||||||
-- Modules exported by the library.
|
|
||||||
exposed-modules: MyLib
|
|
||||||
|
|
||||||
-- Modules included in this library but not exported.
|
|
||||||
-- other-modules:
|
|
||||||
|
|
||||||
-- LANGUAGE extensions used by modules in this package.
|
|
||||||
-- other-extensions:
|
|
||||||
|
|
||||||
-- Other library packages from which modules are imported.
|
|
||||||
build-depends: base ^>=4.17.0.0
|
|
||||||
|
|
||||||
-- Directories containing source files.
|
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
|
exposed-modules:
|
||||||
|
Example.Project
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
-- Base language which the package is written in.
|
-- Builds the executable 'clash', with PPU project in scope
|
||||||
default-language: GHC2021
|
executable clash
|
||||||
|
main-is: app/Clash.hs
|
||||||
|
default-language: Haskell2010
|
||||||
|
Build-Depends: base, clash-ghc, PPU
|
||||||
|
if !os(Windows)
|
||||||
|
ghc-options: -dynamic
|
||||||
|
|
||||||
executable PPU
|
-- Builds the executable 'clashi', with PPU project in scope
|
||||||
-- Import common warning flags.
|
executable clashi
|
||||||
import: warnings
|
main-is: app/Clashi.hs
|
||||||
|
default-language: Haskell2010
|
||||||
|
if !os(Windows)
|
||||||
|
ghc-options: -dynamic
|
||||||
|
build-depends: base, clash-ghc, PPU
|
||||||
|
|
||||||
-- .hs or .lhs file containing the Main module.
|
test-suite doctests
|
||||||
main-is: Main.hs
|
|
||||||
|
|
||||||
-- Modules included in this executable, other than Main.
|
|
||||||
-- other-modules:
|
|
||||||
|
|
||||||
-- LANGUAGE extensions used by modules in this package.
|
|
||||||
-- other-extensions:
|
|
||||||
|
|
||||||
-- Other library packages from which modules are imported.
|
|
||||||
build-depends:
|
|
||||||
base ^>=4.17.0.0,
|
|
||||||
PPU
|
|
||||||
|
|
||||||
-- Directories containing source files.
|
|
||||||
hs-source-dirs: app
|
|
||||||
|
|
||||||
-- Base language which the package is written in.
|
|
||||||
default-language: GHC2021
|
|
||||||
|
|
||||||
test-suite PPU-test
|
|
||||||
-- Import common warning flags.
|
|
||||||
import: warnings
|
|
||||||
|
|
||||||
-- Base language which the package is written in.
|
|
||||||
default-language: GHC2021
|
|
||||||
|
|
||||||
-- Modules included in this executable, other than Main.
|
|
||||||
-- other-modules:
|
|
||||||
|
|
||||||
-- LANGUAGE extensions used by modules in this package.
|
|
||||||
-- other-extensions:
|
|
||||||
|
|
||||||
-- The interface type and version of the test suite.
|
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
|
default-language: Haskell2010
|
||||||
-- Directories containing source files.
|
main-is: doctests.hs
|
||||||
hs-source-dirs: test
|
ghc-options: -Wall -Wcompat -threaded
|
||||||
|
hs-source-dirs: tests
|
||||||
-- The entrypoint to the test suite.
|
|
||||||
main-is: Main.hs
|
|
||||||
|
|
||||||
-- Test dependencies.
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base ^>=4.17.0.0,
|
base,
|
||||||
PPU
|
PPU,
|
||||||
|
doctest-parallel >= 0.2 && < 0.4,
|
||||||
|
|
||||||
|
test-suite test-library
|
||||||
|
import: common-options
|
||||||
|
default-language: Haskell2010
|
||||||
|
hs-source-dirs: tests
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
ghc-options: -threaded
|
||||||
|
main-is: unittests.hs
|
||||||
|
other-modules:
|
||||||
|
Tests.Example.Project
|
||||||
|
build-depends:
|
||||||
|
PPU,
|
||||||
|
QuickCheck,
|
||||||
|
hedgehog,
|
||||||
|
tasty >= 1.2 && < 1.5,
|
||||||
|
tasty-hedgehog,
|
||||||
|
tasty-th
|
||||||
|
6
app/Clash.hs
Normal file
6
app/Clash.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import Clash.Main (defaultMain)
|
||||||
|
import Prelude
|
||||||
|
import System.Environment (getArgs)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = getArgs >>= defaultMain
|
6
app/Clashi.hs
Normal file
6
app/Clashi.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import Clash.Main (defaultMain)
|
||||||
|
import Prelude
|
||||||
|
import System.Environment (getArgs)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = getArgs >>= defaultMain . ("--interactive":)
|
@ -1,8 +0,0 @@
|
|||||||
module Main where
|
|
||||||
|
|
||||||
import qualified MyLib (someFunc)
|
|
||||||
|
|
||||||
main :: IO ()
|
|
||||||
main = do
|
|
||||||
putStrLn "Hello, Haskell!"
|
|
||||||
MyLib.someFunc
|
|
13
cabal.project
Normal file
13
cabal.project
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
packages:
|
||||||
|
PPU.cabal
|
||||||
|
|
||||||
|
write-ghc-environment-files: always
|
||||||
|
|
||||||
|
-- Eliminates the need for `--enable-tests`, which is needed for HLS.
|
||||||
|
tests: true
|
||||||
|
|
||||||
|
-- Works around: https://github.com/recursion-schemes/recursion-schemes/issues/128. This
|
||||||
|
-- shouldn't harm (runtime) performance of Clash, as we only use recursion-schemes with
|
||||||
|
-- TemplateHaskell.
|
||||||
|
package recursion-schemes
|
||||||
|
optimization: 0
|
19
src/Example/Project.hs
Normal file
19
src/Example/Project.hs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module Example.Project (topEntity, plus) where
|
||||||
|
|
||||||
|
import Clash.Prelude
|
||||||
|
|
||||||
|
-- | Add two numbers. Example:
|
||||||
|
--
|
||||||
|
-- >>> plus 3 5
|
||||||
|
-- 8
|
||||||
|
plus :: Signed 8 -> Signed 8 -> Signed 8
|
||||||
|
plus a b = a + b
|
||||||
|
|
||||||
|
-- | 'topEntity' is Clash's equivalent of 'main' in other programming
|
||||||
|
-- languages. Clash will look for it when compiling 'Example.Project'
|
||||||
|
-- and translate it to HDL. While polymorphism can be used freely in
|
||||||
|
-- Clash projects, a 'topEntity' must be monomorphic and must use non-
|
||||||
|
-- recursive types. Or, to put it hand-wavily, a 'topEntity' must be
|
||||||
|
-- translatable to a static number of wires.
|
||||||
|
topEntity :: Signed 8 -> Signed 8 -> Signed 8
|
||||||
|
topEntity = plus
|
@ -1,4 +0,0 @@
|
|||||||
module MyLib (someFunc) where
|
|
||||||
|
|
||||||
someFunc :: IO ()
|
|
||||||
someFunc = putStrLn "someFunc"
|
|
7
stack.yaml
Normal file
7
stack.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
resolver: lts-19.33
|
||||||
|
|
||||||
|
extra-deps:
|
||||||
|
- clash-ghc-1.6.4
|
||||||
|
- clash-prelude-1.6.4
|
||||||
|
- clash-lib-1.6.4
|
||||||
|
- concurrent-supply-0.1.8
|
40
stack.yaml.lock
Normal file
40
stack.yaml.lock
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# This file was autogenerated by Stack.
|
||||||
|
# You should not edit this file by hand.
|
||||||
|
# For more information, please see the documentation at:
|
||||||
|
# https://docs.haskellstack.org/en/stable/lock_files
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- completed:
|
||||||
|
hackage: clash-ghc-1.6.4@sha256:43e4c9c949bf9623633f08bb09bb4495578b517be4e99140d9ea22dd2a9cd13b,9042
|
||||||
|
pantry-tree:
|
||||||
|
sha256: 9484d37cd6c8cb0217a02cf020b6398dbe1a68fa332472b40cfb511ce54a743a
|
||||||
|
size: 3634
|
||||||
|
original:
|
||||||
|
hackage: clash-ghc-1.6.4
|
||||||
|
- completed:
|
||||||
|
hackage: clash-prelude-1.6.4@sha256:67b5c26ad7c712e23f5d54187d691cbb007931a89b4aabd4a738c307d71b2a27,17249
|
||||||
|
pantry-tree:
|
||||||
|
sha256: b12774016a4f9bd456ecdf7bc1e5182d33ef4ac9e16db0f344d27189a26bfe2d
|
||||||
|
size: 13292
|
||||||
|
original:
|
||||||
|
hackage: clash-prelude-1.6.4
|
||||||
|
- completed:
|
||||||
|
hackage: clash-lib-1.6.4@sha256:336e57d424852f2ad9285b6fa820e634f32d39d52755d3245d5f4ac04ea37f85,13688
|
||||||
|
pantry-tree:
|
||||||
|
sha256: 750ffc9d2f5ed3690f6a2a7da46090970594dbbcf8a6b55d785e8f809b4dfbf1
|
||||||
|
size: 22460
|
||||||
|
original:
|
||||||
|
hackage: clash-lib-1.6.4
|
||||||
|
- completed:
|
||||||
|
hackage: concurrent-supply-0.1.8@sha256:9373f4868ad28936a7b93781b214ef4afdeacf377ef4ac729583073491c9f9fb,1627
|
||||||
|
pantry-tree:
|
||||||
|
sha256: bdfaa167ae3249f858ba248aea2e9b97ab9b13af6e68c73b7c3192e717e11b83
|
||||||
|
size: 400
|
||||||
|
original:
|
||||||
|
hackage: concurrent-supply-0.1.8
|
||||||
|
snapshots:
|
||||||
|
- completed:
|
||||||
|
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
|
||||||
|
size: 619204
|
||||||
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
|
||||||
|
original: lts-19.33
|
@ -1,4 +0,0 @@
|
|||||||
module Main (main) where
|
|
||||||
|
|
||||||
main :: IO ()
|
|
||||||
main = putStrLn "Test suite not yet implemented."
|
|
26
tests/Tests/Example/Project.hs
Normal file
26
tests/Tests/Example/Project.hs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
module Tests.Example.Project where
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Test.Tasty
|
||||||
|
import Test.Tasty.TH
|
||||||
|
import Test.Tasty.Hedgehog
|
||||||
|
|
||||||
|
import Hedgehog ((===))
|
||||||
|
import qualified Hedgehog as H
|
||||||
|
import qualified Hedgehog.Gen as Gen
|
||||||
|
import qualified Hedgehog.Range as Range
|
||||||
|
|
||||||
|
import Example.Project (plus)
|
||||||
|
|
||||||
|
prop_plusIsCommutative :: H.Property
|
||||||
|
prop_plusIsCommutative = H.property $ do
|
||||||
|
a <- H.forAll (Gen.integral (Range.linear minBound maxBound))
|
||||||
|
b <- H.forAll (Gen.integral (Range.linear minBound maxBound))
|
||||||
|
plus a b === plus b a
|
||||||
|
|
||||||
|
tests :: TestTree
|
||||||
|
tests = $(testGroupGenerator)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = defaultMain tests
|
8
tests/doctests.hs
Normal file
8
tests/doctests.hs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module Main where
|
||||||
|
|
||||||
|
import System.Environment (getArgs)
|
||||||
|
import Test.DocTest (mainFromCabal)
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = mainFromCabal "simple" =<< getArgs
|
||||||
|
|
10
tests/unittests.hs
Normal file
10
tests/unittests.hs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Test.Tasty
|
||||||
|
|
||||||
|
import qualified Tests.Example.Project
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = defaultMain $ testGroup "."
|
||||||
|
[ Tests.Example.Project.tests
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user