Skip to content

Instantly share code, notes, and snippets.

@christiaanb
Last active October 19, 2015 13:45
Show Gist options
  • Save christiaanb/62538faa13a6f7029f11 to your computer and use it in GitHub Desktop.
Save christiaanb/62538faa13a6f7029f11 to your computer and use it in GitHub Desktop.
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