当前位置:网站首页>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 .
边栏推荐
- 列表的使用
- 共用体(union)详解【C语言】
- Implementation scheme of distributed transaction
- Missing value filling in data analysis (focus on multiple interpolation method, miseforest)
- I2C总线时序详解
- 程序员老鸟都会搞错的问题 C语言基础 指针和数组
- MySQL数据库面试题
- Kaggle competition two Sigma connect: rental listing inquiries (xgboost)
- ESP学习问题记录
- 【ESP32学习-1】Arduino ESP32开发环境搭建
猜你喜欢
随机推荐
ES6语法总结--上篇(基础篇)
Internet protocol details
[Kerberos] deeply understand the Kerberos ticket life cycle
冒泡排序【C语言】
There are three iPhone se 2022 models in the Eurasian Economic Commission database
Détails du Protocole Internet
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries(XGBoost)
Dead loop in FreeRTOS task function
Correspondence between STM32 model and contex M
C language, log print file name, function name, line number, date and time
Pytorch-温度预测
JS object and event learning notes
【ESP32学习-2】esp32地址映射
STM32型号与Contex m对应关系
Machine learning -- linear regression (sklearn)
Feature of sklearn_ extraction. text. CountVectorizer / TfidVectorizer
Yarn installation and use
[CDH] modify the default port 7180 of cloudera manager in cdh/cdp environment
使用LinkedHashMap实现一个LRU算法的缓存
Common regular expression collation