Skip to content

Commit

Permalink
Remove Rgb monad
Browse files Browse the repository at this point in the history
  • Loading branch information
dopamane committed Jun 12, 2024
1 parent 3d6a5c6 commit dddc54c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Bayeux.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ app = \case
print $ close [] t

rgbCounter :: File
rgbCounter = compile prog
rgbCounter = cycleCompile prog

rgbCycle :: File
rgbCycle = cycleCompile cycleProg
12 changes: 6 additions & 6 deletions lib/Bayeux/RgbCounter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Bayeux.RgbCounter
( prog
, compile
-- , compile
, cycleProg
, cycleCompile
) where
Expand All @@ -24,7 +24,7 @@ prog = do
g <- c `at` 23
b <- c `at` 22
rgb r g b

{-
newtype Rgb a = Rgb{ unRgb :: Writer [ModuleBody] a }
deriving (Functor, Applicative, Monad, MonadWriter [ModuleBody])
Expand All @@ -50,9 +50,9 @@ instance MonadRgb Rgb where
, ModuleBodyWire $ Wire [] $ WireStmt [WireOptionOutput 4] "\\blue"
, ModuleBodyCell $ sbRgbaDrv r g b
]

compile :: Rgb a -> File
compile = top . execWriter . unRgb
-}
--compile :: Rgb a -> File
--compile = top . execWriter . unRgb

class MonadProcess m where
process :: (SigSpec -> m SigSpec) -> m SigSpec
Expand Down Expand Up @@ -96,7 +96,7 @@ newtype Rtl a = Rtl{ unRtl :: WriterT [ModuleBody] (State Integer) a }

instance MonadRgb Rtl where
ctr = do
tell $ [ModuleBodyWire $ Wire [] $ WireStmt [WireOptionInput 1] "\\clk"] <> counter 32 "\\$my_counter" "\\unused" "$my_counter" "$procStmt"
tell $ {-[ModuleBodyWire $ Wire [] $ WireStmt [WireOptionInput 1] "\\clk"] <>-} counter 32 "\\$my_counter" "\\unused" "$my_counter" "$procStmt"
return $ SigSpecWireId "\\$my_counter"

at sigSpec ix = do
Expand Down
4 changes: 2 additions & 2 deletions test/Test/Bayeux/RgbCounter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import Test.Tasty.Golden
tests :: [TestTree]
tests =
[ testGroup "pretty"
[ prettyTest "rgbcounter" $ compile prog
[ prettyTest "rgbcounter" $ cycleCompile prog
, prettyTest "rgbcycle" $ cycleCompile cycleProg
]
, testGroup "synth"
[ synthTest "rgbcounter" $ compile prog
[ synthTest "rgbcounter" $ cycleCompile prog
, synthTest "rgbcycle" $ cycleCompile cycleProg
]
]
Expand Down

0 comments on commit dddc54c

Please sign in to comment.