Created
March 4, 2019 20:50
-
-
Save TheZoq2/4a617e1737bc0fdbddfb4a2ef3d51ce0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test where | |
import Clash.Prelude | |
import Clash.Explicit.Testbench | |
delay2 :: (KnownNat n, HiddenClockReset domain gated synchronous) => DSignal domain n Int -> DSignal domain (n + 2) Int | |
delay2 = delayedI | |
add1 :: | |
(Num a , KnownNat n, HiddenClockReset domain gated synchronous) | |
=> DSignal domain n (Maybe a) | |
-> DSignal domain (n + 1) (Maybe a) | |
add1 a = | |
delayedI $ fmap (fmap (1 +)) a | |
add1Module :: (HiddenClockReset domain gated synchronous) => | |
Signal domain (Unsigned 8) -> Signal domain (Maybe (Unsigned 8)) | |
add1Module input = | |
toSignal $ add1 $ fromSignal $ fmap Just input | |
{-# ANN topEntity | |
(Synthesize | |
{ t_name = "PlTest" | |
, t_inputs = [ PortName "clk" | |
, PortName "rst" | |
, PortName "data_in" | |
] | |
, t_output = PortName "data_out" | |
}) #-} | |
topEntity | |
:: Clock System Source | |
-> Reset System Asynchronous | |
-> Signal System (Unsigned 8) | |
-> Signal System (Maybe (Unsigned 8)) | |
topEntity = exposeClockReset add1Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment