Automatic generation of EFSMs and HLDDs for functional ATPG