Skip to content

Instantly share code, notes, and snippets.

@naoto-ogawa
Created January 14, 2018 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto-ogawa/2684b9ba07d4dd5caa87e9373e999c0d to your computer and use it in GitHub Desktop.
Save naoto-ogawa/2684b9ba07d4dd5caa87e9373e999c0d to your computer and use it in GitHub Desktop.
Not gate
{-# LANGUAGE ImplicitParams #-}
module Clash01 where
import Clash.Prelude
notL :: Bool -> Bool
notL = not
notTF s i = (not i, not i)
notM :: (?rst::Reset domain synchronous, ?clk::Clock domain gated) => Signal domain Bool -> Signal domain Bool
notM = mealy notTF False
topEntity
:: SystemClockReset
=> Signal System Bool
-> Signal System Bool
topEntity = notM
{-# NOINLINE topEntity #-}
testBench :: Signal System Bool
testBench = done'
where
testInput = stimuliGenerator $(listToVecTH [True , False, True , True , False, False])
expectedOutput = outputVerifier $(listToVecTH [False, True , False, False, True , True ])
done = expectedOutput (topEntity testInput)
done' = withClockReset (tbSystemClockGen (not <$> done')) systemResetGen done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment