unpack

unpack converts from  Bit#(n) to various types including Bool, Int, and UInt.

Examples


 Int#(10) src_step    = unpack(config6[9:0]);
 Bool     src_rdy_en  = unpack(config6[16]);


 function Color unpack (Bits#(2) x);
         if      (x == 3) return Red;
         else if (x == 2) return Green;
         else if (x == 1) return Blue;
         else $error("Illegal code 0 for unpacking a Color'');
     endfunction: unpack
Comments