<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cores(self):
 """Generate the set of all cores in the system. Yields ------ (x, y, p, :py:class:`~rig.machine_control.consts.AppState`) A core in the machine, and its state. Cores related to a specific chip are yielded consecutively in ascending order of core number. """

        for (x, y), chip_info in iteritems(self):
            for p, state in enumerate(chip_info.core_states):
                yield (x, y, p, state)