当前位置:网站首页>Arm pc=pc+8 is the most understandable explanation
Arm pc=pc+8 is the most understandable explanation
2022-07-06 12:01:00 【csdndulala】
https://www.cnblogs.com/douzi2/p/4934202.html
Why is “PC = PC + 8”;
“PC = PC + 8” In fact, it's easy to get confused by writing like this .“PC = PC + 8” The real meaning should be :
Code address of execution place = PC - 8;
in other words ,”PC Address to “ leading “ Code address of execution place ”8 Bytes ;
in other words “PC = PC + 8” Second of PC, Actually, it means “ Code address of execution place ”
then , Understand why 8?
First ,arm The address width of is 4 Bytes , So every instruction executed ,PC It will add itself 4.
And an instruction must be completely arm absorption , It takes multiple steps , take arm7 For example, it adopts 3 Stage assembly line technology .
Assembly line , For our kind of play FPGA I can't be more familiar with , With 3 For the stage assembly line , Is to divide one thing into 3 A step , Each step is processed at the same time ,
The first two cycles are incubation period , Unable to produce results , After that, the results will continue to output .
Imagine , Instructions , Like products waiting to be processed , Running on the conveyor belt , and “FETCH”,“DECODE”,“EXECUTE”, Namely 3 A processing procedure .
1、 In the first cycle ,PC Point to the first program instruction , Carry out the value (FETCH),DECODE, and EXECUTE step “ In the air ”
2、 In the second cycle , next PC + 4,PC Point to the second program instruction to take value (FETCH),DECODE Processed in one cycle ,FETCH Instructions to ,EXECUTE Throw yourself into the air again .
3、 In the third cycle , still PC + 4,PC Point to the third program instruction to take value (FETCH),DECODE Processed in two cycles ,FETCH Instructions to ,
EXECUTE At this time , Processing in one cycle FETCH Instructions to , This instruction is also in the second cycle DECODE Instructions .
4、 Then every clock cycle ,EXECUTE It can be processed twice code, however PC Always ahead of it , That is to say : Code address of execution place = PC - 8;
and ARM9 By increasing the number of assembly lines , It simplifies the logic at all levels of the pipeline , Further improve the performance of the processor . use 5 Stage assembly line technology , But it's also “PC = PC + 8”,
Why is that ? Let's take a look at the picture :
We found that EXECUTE Still in the third step , And conform to : Code address of execution place = PC - 8; As long as you understand this, it's enough to read the code .
边栏推荐
- Word排版(小計)
- C语言回调函数【C语言】
- STM32 how to locate the code segment that causes hard fault
- Matlab learning and actual combat notes
- Machine learning -- linear regression (sklearn)
- Encodermappreduce notes
- RT thread API reference manual
- Vert. x: A simple login access demo (simple use of router)
- uCOS-III 的特点、任务状态、启动
- OPPO VOOC快充电路和协议
猜你喜欢
Reno7 60W超级闪充充电架构
STM32 how to locate the code segment that causes hard fault
分布式事务的实现方案
Several declarations about pointers [C language]
Mall project -- day09 -- order module
几个关于指针的声明【C语言】
MySQL数据库面试题
Detailed explanation of 5g working principle (explanation & illustration)
PyTorch四种常用优化器测试
Vert. x: A simple TCP client and server demo
随机推荐
The first simple case of GNN: Cora classification
Kaggle competition two Sigma connect: rental listing inquiries
Reno7 60W super flash charging architecture
Distribute wxWidgets application
Matlab learning and actual combat notes
TypeScript
Analysis of charging architecture of glory magic 3pro
Some concepts often asked in database interview
Correspondence between STM32 model and contex M
MySQL realizes read-write separation
Machine learning -- linear regression (sklearn)
数据分析之缺失值填充(重点讲解多重插值法Miceforest)
Redis面试题
arduino JSON数据信息解析
[mrctf2020] dolls
JS object and event learning notes
Gallery's image browsing and component learning
Small L's test paper
STM32 如何定位导致发生 hard fault 的代码段
互聯網協議詳解