-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module DcFifo where | ||
|
||
import Clash.Explicit.Prelude | ||
import Clash.Explicit.Testbench | ||
|
||
import Data.Word (Word32) | ||
|
||
import Clash.Cores.Xilinx.DcFifo.Explicit | ||
|
||
createDomain vSystem{vName="P30", vPeriod=30000} | ||
createDomain vSystem{vName="P50", vPeriod=50000} | ||
|
||
tbOutput | ||
:: Clock P50 | ||
-> Clock P30 | ||
-> Signal P30 (BitVector 32) | ||
tbOutput wClk rClk = ignoreFor rClk resetGen enableGen d2 0 fifoOut | ||
where | ||
(XilinxFifo _ _ _ rdRstBusy isEmpty _ fifoOut) = dcFifo @4 defConfig wClk rClk resetGen inpSignal wrEna rdEna | ||
inpSignal = pure (pack (0xFFFF :: Word32)) | ||
wrEna = pure True | ||
rdEna = pure True | ||
|
||
tb | ||
:: (KnownNat n, 1 <= n) | ||
=> Vec n (BitVector 32) | ||
-> Signal P30 Bool | ||
tb expected = done | ||
where | ||
output = tbOutput wClk rClk | ||
(rClk, wClk) = (clockGen, clockGen) -- biTbClockGen (not <$> done) :: (Clock P30, Clock P50) | ||
done = outputVerifier' rClk resetGen expected output |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module DcFifoTop where | ||
|
||
import Clash.Explicit.Prelude | ||
|
||
import Clash.Cores.Xilinx.DcFifo.Explicit | ||
|
||
import DcFifo | ||
|
||
topEntity | ||
:: Clock P50 | ||
-> Clock P30 | ||
-> Signal P50 (BitVector 32) | ||
-> Signal P50 Bool | ||
-> Signal P30 Bool | ||
-> XilinxFifo P30 P50 7 32 | ||
topEntity wClk rdClk = dcFifo defConfig wClk rdClk resetGen | ||
{-# NOINLINE topEntity #-} | ||
|
||
testBench :: Signal P30 Bool | ||
testBench = tb $(listToVecTH $ sampleN 20 $ tbOutput clockGen clockGen) |