Donor ground states of group IV and III-V semiconductors