Guest User

Untitled

a guest
Dec 11th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. module Test where
  2. import Clash.Prelude
  3.  
  4. -- this just puts zeros in front of the bit vector
  5. f :: KnownNat a => BitVector a -> BitVector (a + 1)
  6. f bv = zeroExtend bv
  7.  
  8. -- this gets the length of a bit vector, as an SNat
  9. g :: KnownNat a => BitVector a -> SNat a
  10. g _ = SNat
  11.  
  12. -- this gets the length of *any* 'thing with known size that can become
  13. -- a bitvector'
  14. h :: (BitPack a, BitSize a ~ n, KnownNat n) => a -> SNat n
  15. h _ = SNat
Add Comment
Please, Sign In to add comment