当前位置:网站首页>Execution of procedures
Execution of procedures
2022-07-02 07:40:00 【Xiao Chen who wants money】
CPU When the command is executed :
1、 First ,CPU Read program counter (PC,program counter) The instruction that the pointer points to , Import it into the instruction register (IR, Instruction Register), say concretely , The completion of the read instruction has 3 A step :
- CPU The control unit operation address bus specifies the memory address to be accessed .( Simple understanding , Is to put PC The value in the pointer is copied to the address bus ).
- CPU Notify the memory device to prepare data .
- CPU After receiving the data from memory , Store this data in the instruction register .
Complete the above 3 Step ,CPU Read successfully PC The pointer points to the instruction , Stored in the instruction register .
However ,CPU Analyze the instructions in the instruction register , Determine the type and parameters of the instruction . If it's a compute type instruction , Then it's up to the logic unit to calculate ; If it's a storage type instruction , So it's executed by the control unit .
PC The pointer increases by itself , Ready to get the next instruction .
For example 32 On the machine , Instruction is 32 position 4 Bytes , need 4 Memory address storage , therefore PC The pointer will increase automatically 4.
With a=11+15 For example .
We will have a Review Next question : Programs written by programmers a=11+15 yes character string ,CPU Cannot execute string , Only instructions can be executed . So a special program is needed here —— compiler . The core competence of the compiler is translation , It translates one program into another program language .
here , We need a compiler to translate the program written by the programmer into CPU Know the instructions ( Instructions are considered a low-level language , We usually write high-level languages ).
Let's elaborate on a=11+15 Implementation process of :
1. The compiler analyzes , Find out 11 and 15 Is the data ( The code will indicate the data type ), So when the compiled program starts , A special area will be opened in memory to store such constants , This area is dedicated to storing constants , Data segment , As shown in the figure below :
11 Stored in the address 0x100;
15 Stored in the address 0x104;
2. Compiler will a=11+15 Convert to 4 Orders , After the program starts , These instructions are imported into an area dedicated to storing instructions , That is, the body segment , As shown in the figure above , this 4 Instructions are stored in 0x200-0x20c In the area of :
0x200 Positional load The command will address 0x100 Data in 11 Import register R0;
0x204 Positional load The command will address 0x104 Data in 15 Import register R1;
0x208 Positional add Instruction will register R0 and R1 Add the values in , Storage register R2;
0x20c Positional store Instruction will register R2 The values in are stored back in the data area 0x1108 Location .
3. When it comes to concrete implementation ,PC The pointer first points to 0x200 Location , Then execute this in turn 4 Orders .
Here are a few more questions to explain :
1. Variable a It's actually an address in memory ,a It's a mnemonic for programmers .
2. Why? 0x200 The instructions representing loading data into registers in are 0x8c000100, We will discuss in detail below .
3. I don't know whether careful students find , In the example above , Every time we operate 4 An address , That is to say 32 position , This is because we are using 32 The seat is wide CPU give an example . stay 32 The seat is wide CPU in , So are the instructions 32 Bit . But the data can be less than 32 position , For example, you can add two 8 Bytes of bits .
4. About the content of data segment and body segment , I will continue to explain in the process and thread section of module 4 .
边栏推荐
- 【信息检索导论】第六章 词项权重及向量空间模型
- Feeling after reading "agile and tidy way: return to origin"
- Module not found: Error: Can't resolve './$$_ gendir/app/app. module. ngfactory'
- 解决latex图片浮动的问题
- A slide with two tables will help you quickly understand the target detection
- Alpha Beta Pruning in Adversarial Search
- PHP returns the corresponding key value according to the value in the two-dimensional array
- Common CNN network innovations
- Cognitive science popularization of middle-aged people
- 《Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer》论文翻译
猜你喜欢

【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization

【多模态】CLIP模型

Deep learning classification Optimization Practice

iOD及Detectron2搭建过程问题记录

传统目标检测笔记1__ Viola Jones

SSM garbage classification management system

Proof and understanding of pointnet principle

Implementation of yolov5 single image detection based on pytorch

常见的机器学习相关评价指标

ERNIE1.0 与 ERNIE2.0 论文解读
随机推荐
Feeling after reading "agile and tidy way: return to origin"
【Ranking】Pre-trained Language Model based Ranking in Baidu Search
Record of problems in the construction process of IOD and detectron2
【论文介绍】R-Drop: Regularized Dropout for Neural Networks
【TCDCN】《Facial landmark detection by deep multi-task learning》
【信息检索导论】第二章 词项词典与倒排记录表
Faster-ILOD、maskrcnn_ Benchmark training coco data set and problem summary
Conda 创建,复制,分享虚拟环境
[introduction to information retrieval] Chapter II vocabulary dictionary and inverted record table
Faster-ILOD、maskrcnn_benchmark训练自己的voc数据集及问题汇总
Machine learning theory learning: perceptron
Faster-ILOD、maskrcnn_ Benchmark trains its own VOC data set and problem summary
Find in laravel8_ in_ Usage of set and upsert
Convert timestamp into milliseconds and format time in PHP
【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
Traditional target detection notes 1__ Viola Jones
The difference and understanding between generative model and discriminant model
win10解决IE浏览器安装不上的问题
[paper introduction] r-drop: regulated dropout for neural networks
一份Slide两张表格带你快速了解目标检测

