Four working cycles of instructions in the principle of computer organization

Implementation process

Execution process: After the address cycle, you need to judge whether there is an indirect address cycle. If not, you enter the execution cycle. During the execution cycle, you need to judge whether there is an interrupt program. If there is, respond to the interrupt: save the breakpoint and generate Interrupt service program entry, hardware shutdown point; if not, enter the next addressing cycle
Insert picture description here
. It takes up to four work cycles to complete an instruction: fetch cycle, inter-point cycle, execution cycle, interrupt cycle.Insert picture description here

Fetch cycle

Instruction cycle: the time required to fetch and execute an instruction (the time required to explain an instruction)

Insert picture description here

Goal: The address in the PC needs to be taken out and stored in the IR (instruction register)
①: first send the instruction address in the PC to the MAR (main memory address register)
②③: send to the access device through the address bus
④⑤⑥⑦⑧ The CU reads the data in the memory through the control bus and sends the data to the MDR through the data bus, and then to the IR.
⑨: CU will also add PC+1 to make PC point to the address of the next instruction

Instruction cycle with indirect addressing

Because of the different addressing modes, it may be indirect addressing. Therefore, to fetch the operand during the execution cycle, two memory accesses are required. The indirect address cycle is to fetch the address of the operand from the main memory. The execution cycle is to take out the operand and execute the corresponding operation and save the result in the given register. At this time, if we divide the instruction cycle into: address cycle, indirect address cycle, and execution cycle.

Insert picture description here

Instruction cycle with interrupt

If there is an interrupt during program execution, then an interrupt cycle must be added: if there is an interrupt request, we need to respond to the interrupt: save the power off, form the entry address of the interrupt service program, and turn off the hardware interrupt.

Insert picture description here

Interdigital cycle

Insert picture description here

The indirect address period is used to indicate that the address of the operand is stored in the IR or MDR. It is assumed here that it is stored in IR
①: MAR reads the data address in IR.
②③: Transfer to the memory through the address bus.
④⑤⑥⑦⑧: CU sends out a control signal, and reads the address through the control bus and puts it back into IR through the data bus.

Execution cycle

Different instructions have different micro-operations in the execution cycle.

Interrupt cycle

We need to know what we did in the interrupt cycle:

  1. Save breakpoint
  2. Generate the entry address of the interrupt service routine
  3. Hardware shutdown breakpoint
  4. CU determines which address of the memory unit to save the interrupt (saving the breakpoint is a write operation)
    Insert picture description here
①②③: Save the breakpoint, transfer the address in CU to MAR and then transfer it to the memory through the address bus.
④⑤⑥: Save the address of the current breakpoint. Where is the address of the current breakpoint—PC, so you need to transfer the address of the PC to the MDR to the memory via the data bus.
⑦⑧: The entry address of the interrupt program is given by the CU, and the CU directly puts the entry address into the PC

Reference article: https://blog.csdn.net/weixin_43978453/article/details/102964671

Guess you like

Origin blog.csdn.net/qq1350975694/article/details/107295307