当前位置:网站首页>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 .
边栏推荐
- Calculate the difference in days, months, and years between two dates in PHP
- [paper introduction] r-drop: regulated dropout for neural networks
- win10+vs2017+denseflow编译
- 使用百度网盘上传数据到服务器上
- [model distillation] tinybert: distilling Bert for natural language understanding
- 解决latex图片浮动的问题
- CPU的寄存器
- 点云数据理解(PointNet实现第3步)
- [Bert, gpt+kg research] collection of papers on the integration of Pretrain model with knowledge
- The difference and understanding between generative model and discriminant model
猜你喜欢

【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦

【AutoAugment】《AutoAugment:Learning Augmentation Policies from Data》

【TCDCN】《Facial landmark detection by deep multi-task learning》

MySQL has no collation factor of order by

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

How to efficiently develop a wechat applet

Implementation of yolov5 single image detection based on onnxruntime

Ding Dong, here comes the redis om object mapping framework

The first quickapp demo

Faster-ILOD、maskrcnn_benchmark训练自己的voc数据集及问题汇总
随机推荐
Practice and thinking of offline data warehouse and Bi development
[introduction to information retrieval] Chapter 1 Boolean retrieval
Using compose to realize visible scrollbar
Faster-ILOD、maskrcnn_ Benchmark trains its own VOC data set and problem summary
Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
SSM personnel management system
矩阵的Jordan分解实例
【多模态】CLIP模型
MySQL composite index with or without ID
[introduction to information retrieval] Chapter 7 scoring calculation in search system
view的绘制机制(一)
[tricks] whiteningbert: an easy unsupervised sentence embedding approach
《Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer》论文翻译
程序的执行
latex公式正体和斜体
parser. parse_ Args boolean type resolves false to true
【信息检索导论】第一章 布尔检索
ModuleNotFoundError: No module named ‘pytest‘
Common CNN network innovations
Win10+vs2017+denseflow compilation

