Implement toHex supporting don't-care bits

Previously, don't-care bits would trigger an infinite loop during the elaboration phase.