Skip to content

Commit

Permalink
Merge branch 'main' into cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
dopamane authored Jul 27, 2024
2 parents 8144848 + 5aa5020 commit 65a8617
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 656 deletions.
2 changes: 2 additions & 0 deletions bayeux.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ library
, serialport
, shake
, text
, yosys-rtl
hs-source-dirs: lib
default-language: Haskell2010

Expand Down Expand Up @@ -89,3 +90,4 @@ test-suite test
, tasty-hedgehog
, tasty-hunit
, text
, yosys-rtl
1 change: 1 addition & 0 deletions lib/Bayeux.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import System.FilePath
import System.Hardware.Serialport
import System.IO
import Text.Megaparsec hiding (parse)
import Yosys.Rtl

app :: Cli -> IO ()
app = \case
Expand Down
1 change: 1 addition & 0 deletions lib/Bayeux/Buffer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Data.Finite
import Data.String
import Data.Word
import GHC.TypeNats
import Yosys.Rtl

class MonadBuffer m where
buffer
Expand Down
2 changes: 1 addition & 1 deletion lib/Bayeux/Cell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ module Bayeux.Cell
) where

import Bayeux.Encode
import Bayeux.Rtl hiding (at, binary, mux, shift, shr, sshr, shl, unary)
import Bayeux.Signal
import Bayeux.Width
import Control.Monad
import Data.List.NonEmpty (NonEmpty(..), nonEmpty)
import Data.Maybe
import Prelude hiding (and, div, mod, not, or)
import Yosys.Rtl

-- | increment
inc :: Encode a => Width a => MonadSignal m => Sig a -> m (Sig a)
Expand Down
28 changes: 1 addition & 27 deletions lib/Bayeux/Encode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,10 @@ import Data.Array
import Data.Bits
import Data.Bool
import Data.Finite
import Data.String
import Data.Word
import GHC.TypeLits
import Prettyprinter hiding (width)
import Yosys.Rtl

data BinaryDigit = B0
| B1
| X
| Z
| M
| D
deriving (Eq, Read, Show)

instance Pretty BinaryDigit where
pretty = \case
B0 -> "0"
B1 -> "1"
X -> "x"
Z -> "z"
M -> "m"
D -> "-"

instance IsString BinaryDigit where
fromString = \case
"0" -> B0
"1" -> B1
"x" -> X
"z" -> Z
"m" -> M
_ -> D
class Encode a where
encode :: a -> [BinaryDigit]

Expand Down
2 changes: 1 addition & 1 deletion lib/Bayeux/Flow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ module Bayeux.Flow
( flow
) where

import Bayeux.Rtl
import Development.Shake
import Development.Shake.FilePath
import Data.Text (Text)
import qualified Data.Text.IO as TIO
import Prettyprinter
import Prettyprinter.Render.Text
import Yosys.Rtl

flow :: Bool -> Bool -> String -> File -> FilePath -> IO ()
flow prog clean name designFile pcfFile = shake shakeOptions{ shakeFiles = "_build" </> name } $ do
Expand Down
2 changes: 1 addition & 1 deletion lib/Bayeux/Ice40/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Bayeux.Ice40.IO
( sbIO
) where

import Bayeux.Rtl
import Yosys.Rtl

sbIO
:: CellId
Expand Down
1 change: 1 addition & 0 deletions lib/Bayeux/Ice40/Led.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Data.Array
import Data.Char
import Data.Finite
import Data.Word
import Yosys.Rtl

sbLeddaIp
:: SigSpec -- ^ leddcs
Expand Down
1 change: 1 addition & 0 deletions lib/Bayeux/Ice40/Rgb.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Bayeux.Signal
import Bayeux.Width
import Control.Monad.Writer
import Data.Word
import Yosys.Rtl

sbRgbaDrv
:: SigSpec -- ^ red pwm input
Expand Down
1 change: 1 addition & 0 deletions lib/Bayeux/Ice40/Spi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Data.Finite
import Data.String
import Data.Text (Text)
import Data.Word
import Yosys.Rtl

sbSpi
:: CellId
Expand Down
1 change: 1 addition & 0 deletions lib/Bayeux/Ice40/Spram.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Data.Array
import Data.Finite
import Data.String
import Data.Word
import Yosys.Rtl

spramC
:: CellId
Expand Down
Loading

0 comments on commit 65a8617

Please sign in to comment.