当前位置:网站首页>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 .
边栏推荐
- Keyword inline (inline function) usage analysis [C language]
- RT thread API reference manual
- ESP8266通过arduino IED连接巴法云(TCP创客云)
- Detailed explanation of 5g working principle (explanation & illustration)
- Variable parameter principle of C language function: VA_ start、va_ Arg and VA_ end
- 电商数据分析--用户行为分析
- Matlab learning and actual combat notes
- Unit test - unittest framework
- 2020 WANGDING cup_ Rosefinch formation_ Web_ nmap
- Come and walk into the JVM
猜你喜欢
Kaggle competition two Sigma connect: rental listing inquiries (xgboost)
Basic use of pytest
Cannot change version of project facet Dynamic Web Module to 2.3.
Fashion-Gen: The Generative Fashion Dataset and Challenge 论文解读&数据集介绍
高通&MTK&麒麟 手機平臺USB3.0方案對比
Redis面试题
ToggleButton实现一个开关灯的效果
Mysql database interview questions
STM32 how to locate the code segment that causes hard fault
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
随机推荐
Principle and implementation of MySQL master-slave replication
The first simple case of GNN: Cora classification
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
Machine learning -- linear regression (sklearn)
MATLAB学习和实战 随手记
RT-Thread 线程的时间片轮询调度
RT-Thread的main线程“卡死”的一种可能原因及解决方案
imgcat使用心得
Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
Matlab learning and actual combat notes
MySQL START SLAVE Syntax
Word typesetting (subtotal)
ESP8266使用arduino连接阿里云物联网
Yarn installation and use
mysql实现读写分离
Variable star user module
Contiki源码+原理+功能+编程+移植+驱动+网络(转)
Fashion-Gen: The Generative Fashion Dataset and Challenge 论文解读&数据集介绍
Pytoch implements simple linear regression demo
共用体(union)详解【C语言】