Pack

Overview
The pack function is used to convert (or pack) various Bit data types, such as Bool, Int or UInt into a  (Bit#(n)) type.

Examples:

 Bit#(1)  rsValid    = pack(idctvalid);

typedef enum { Red, Green, Blue } Color deriving (Eq);
   instance Bits#(Color, 2);
   function Bits#(2) pack (Color c);
       if      (c == Red)   return 3;
       else if (c == Green) return 2;
       else                 return 1;   // (c == Blue)
   endfunction: pack
Comments