Skip to content

Commit ec0432a

Browse files
committed
clash-cosim: Fixup files for formatting compatibility
1 parent 13fcd3a commit ec0432a

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

clash-cosim/Setup.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ blackboxObject
196196
-- ^ templateD
197197
-> Value
198198
blackboxObject bbname type_ templateD =
199-
#if MIN_VERSION_aeson(2,0,0)
200199
Object (KM.fromList [("BlackBox", Object (KM.fromList [
201-
#else
202-
Object (fromList [("BlackBox", Object (fromList [
203-
#endif
204200
("name", String $ Text.pack bbname)
205201
, ("kind", "Declaration")
206202
, ("type", String $ Text.pack type_)

clash-cosim/clash-cosim.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ flag pedantic
4444

4545
custom-setup
4646
-- ghc-options: -Wall -Werror
47-
setup-depends: aeson,
47+
setup-depends: aeson >= 2.0.0,
4848
base >= 4.10 && < 5,
4949
bytestring,
5050
Cabal,

clash-cosim/src/Clash/CoSim/CodeGeneration.hs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ arrowsR (t0:ts) t = arrow t0 (arrowsR ts t)
4747
applyE :: Foldable t => ExpQ -> t Name -> ExpQ
4848
applyE = foldl (\f x -> [| $f $(varE x) |])
4949

50+
maxNumberOfClocks :: IO Int
51+
maxNumberOfArgs :: IO Int
52+
#ifdef CABAL
53+
-- We're running in a CABAL environment, so we know this environment
54+
-- variable is set:
55+
maxNumberOfClocks = read <$> runIO (getEnv "COSIM_MAX_NUMBER_OF_CLOCKS")
56+
maxNumberOfArgs = read <$> runIO (getEnv "COSIM_MAX_NUMBER_OF_ARGUMENTS")
57+
#else
58+
maxNumberOfClocks = pure 1
59+
maxNumberOfArgs = pure 16
60+
#endif
5061
--------------------------------------
5162
---- CODE GENERATION -----------------
5263
--------------------------------------
@@ -56,16 +67,8 @@ applyE = foldl (\f x -> [| $f $(varE x) |])
5667
-- to 16.)
5768
coSimGen :: Q [Dec]
5869
coSimGen = do
59-
#ifdef CABAL
60-
-- We're running in a CABAL environment, so we know this environment
61-
-- variable is set:
62-
m <- read <$> runIO (getEnv "COSIM_MAX_NUMBER_OF_CLOCKS")
63-
n <- read <$> runIO (getEnv "COSIM_MAX_NUMBER_OF_ARGUMENTS")
64-
#else
65-
let m = 1
66-
let n = 16
67-
#endif
68-
70+
m <- maxNumberOfClocks
71+
n <- maxNumberOfArgs
6972

7073
concat <$> (sequence [coSimGen' clks args | clks <- [0..m], args <- [1..n]])
7174

0 commit comments

Comments
 (0)