Advertisement
Guest User

Untitled

a guest
Sep 25th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. component gray2bin "convert a gray-code input to binary";
  2.  
  3. pin in unsigned in "gray code in";
  4. pin out unsigned out "gray code out";
  5.  
  6. license "GPL";
  7. author "andy pugh";
  8. function _;
  9.  
  10. ;;
  11.  
  12. u32 mask;
  13. for(mask = in >> 1 ; mask != 0 ; mask = mask >> 1){
  14. out ^= mask;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement