A hardware-software co-simulator for embedded system design and debugging