-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2429 from clash-lang/ffi-fixes
Make `clash-ffi` a haskell library + FFI interface tests
- Loading branch information
Showing
32 changed files
with
3,916 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,50 +11,45 @@ author: QBayLogic B.V. | |
maintainer: [email protected] | ||
copyright: Copyright © 2022, QBayLogic B.V. | ||
category: Hardware | ||
build-type: Custom | ||
|
||
common basic-config | ||
common common-options | ||
default-language: Haskell2010 | ||
|
||
default-extensions: | ||
BangPatterns | ||
DeriveAnyClass | ||
DeriveGeneric | ||
DerivingStrategies | ||
GeneralizedNewtypeDeriving | ||
ScopedTypeVariables | ||
TypeApplications | ||
|
||
include-dirs: | ||
include | ||
|
||
ghc-options: | ||
-Wall -Wcompat | ||
|
||
build-depends: | ||
base >= 4.11 && < 4.17, | ||
bytestring >= 0.10 && < 0.12, | ||
clash-prelude >= 1.2 && < 1.8, | ||
deepseq >= 1.4 && < 1.5, | ||
include-dirs: include | ||
includes: vpi_user.h | ||
cpp-options: | ||
-DVERILOG=1 | ||
-DIVERILOG=1 | ||
-DVERILOG_2001=1 | ||
-DVERILOG_2005=1 | ||
-DVPI_VECVAL=1 | ||
|
||
library | ||
import: common-options | ||
default-extensions: | ||
BangPatterns | ||
DeriveAnyClass | ||
DeriveGeneric | ||
DerivingStrategies | ||
GeneralizedNewtypeDeriving | ||
build-depends: | ||
derive-storable >= 0.3 && < 0.4, | ||
derive-storable-plugin >= 0.2 && < 0.3, | ||
mtl >= 2.2 && < 2.3, | ||
|
||
other-modules: | ||
hs-source-dirs: src | ||
c-sources: cbits/entry_vpi.c | ||
exposed-modules: | ||
Clash.FFI.Monad | ||
Clash.FFI.View | ||
|
||
common vpi-config | ||
includes: | ||
vpi_user.h | ||
|
||
c-sources: | ||
cbits/entry_vpi.c | ||
|
||
cpp-options: | ||
-DVERILOG=1 | ||
|
||
other-modules: | ||
Clash.FFI.VPI.Callback | ||
Clash.FFI.VPI.Callback.Reason | ||
Clash.FFI.VPI.Control | ||
|
@@ -81,26 +76,33 @@ common vpi-config | |
Clash.FFI.VPI.Port.Direction | ||
Clash.FFI.VPI.Reg | ||
|
||
custom-setup | ||
setup-depends: | ||
base >= 4.11 && < 5, | ||
Cabal >= 2.4 && < 3.7, | ||
directory >= 1.3.6 && < 1.4, | ||
filepath >= 1.4.2 && < 1.5, | ||
|
||
-- To accomodate differences between different simulators when defining the | ||
-- generic interface, different foreign libraries are produced for each tool. | ||
-- The code is shared between all simulators and each library defines it's name | ||
-- and includes the source files it needs for it's interface. | ||
|
||
foreign-library clash-iverilog-vpi | ||
import: basic-config, vpi-config | ||
type: native-shared | ||
lib-version-info: 0:1:0 | ||
hs-source-dirs: src | ||
|
||
cpp-options: | ||
-DIVERILOG=1 | ||
-DVERILOG_2001=1 | ||
-DVERILOG_2005=1 | ||
-DVPI_VECVAL=1 | ||
executable ffi-interface-tests | ||
import: common-options | ||
default-extensions: | ||
DataKinds | ||
RankNTypes | ||
LambdaCase | ||
ViewPatterns | ||
TupleSections | ||
ImplicitParams | ||
FlexibleContexts | ||
FlexibleInstances | ||
MultiParamTypeClasses | ||
ExistentialQuantification | ||
hs-source-dirs: tests | ||
main-is: Main.hs | ||
other-modules: | ||
Clash.FFI.Test | ||
Clash.FFI.Test.Instances | ||
include-dirs: tests/cbits | ||
c-sources: | ||
tests/cbits/VPI.c | ||
tests/cbits/Test.c | ||
tests/cbits/Pipe.c | ||
tests/cbits/Print.c | ||
build-depends: | ||
, clash-ffi | ||
, smallcheck | ||
, tasty | ||
, tasty-hunit | ||
, tasty-smallcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2022 QBayLogic B.V. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
File renamed without changes.
Oops, something went wrong.