4 primary functions of a CPU
As it was mentioned before, CPU process instructions. Instructions are taken in process of decoding various data from programs. CPU has to implement 4 basic functions during instruction cycle: fetch, decode, execute, store.
Fetch
All the instructions are stored in memory. Each instruction has is address. The processor takes this address number from the program counter. Program counter is responsible for tracking what instructions CPU should execute next. So fetching basically means taking the instruction from the memory.
Decode
CPU understands instructions, that are written in Assembly programming language. All the programs, that must be executed, are translated to Assembly instructions. Different CPUs understand different instructions, so Assembly code must be decoded into binary instructions which are understandable to your CPU. This step is called decoding.
Execute
During the procedure of instruction execution, tree things can be done. Firstly, CPU can do some calculations. To execute calculations ALU is used. Secondly, CPU can move data from one memory location to another. And thirdly, CPU can jump to different address if it is needed. So basically, one of those three options is executed during this step.
Store
CPU must give some feedback after executing the instruction. The output data is written to the memory. In this phase program counter is incremented.