Last active
October 19, 2015 13:45
-
-
Save christiaanb/62538faa13a6f7029f11 to your computer and use it in GitHub Desktop.
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
module BitPalindrome3 where | |
import CLaSH.Prelude | |
-- evenPalindrome :: (Eq a, KnownNat m) => Vec (m + m) a -> Bool | |
evenPalindrome v = l == reverse r | |
where | |
(l,r) = splitAtI v | |
-- unevenPalindrome :: (Eq a, KnownNat m) => Vec (m + (m + 1)) a -> Bool | |
unevenPalindrome v = l == reverse (tail r) | |
where | |
(l,r) = splitAtI v | |
topEntity :: BitVector 8 -> Bool | |
topEntity = evenPalindrome . bv2v | |
-- topEntity :: BitVector 9 -> Bool | |
-- topEntity = unevenPalindrome . bv2v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment