def format_hex_width(value, width):
    """! @brief Formats the value as hex of the specified bit width.
    
    @param value Integer value to be formatted.
    @param width Bit width, must be one of 8, 16, 32, 64.
    @return String with (width / 8) hex digits. Does not have a "0x" prefix.
    """
    if width == 8:
        return '%02x' % value
    elif width == 16:
        return '%04x' % value
    elif width == 32:
        return '%08x' % value
    elif width == 64:
        return '%016x' % value
    else:
        raise ValueError('unrecognized register width (%d)' % width)
