playground/haskell/clash-unsorted/mux.hs

21 lines
392 B
Haskell

import Clash.Prelude
foo :: Bool -> a -> a -> a
foo False x y = x
foo True x y = y
topEntity
:: (Clock System,
Reset System,
Enable System)
-> Signal System Bool
-> Signal System Int
-> Signal System Int
-> Signal System Int
topEntity sel a b = exposeClockResetEnable $ (mux foo) <$> a <*> b
mux [True] [1] [2]
mux (pure True :-) (1 :-) (2 :-)
mux (True) (1) (2)