当前位置:网站首页>2021.8.29 notes: register, bit operation, pointer, structure
2021.8.29 notes: register, bit operation, pointer, structure
2022-06-25 04:25:00 【Robin Luo Bing】
One 、 register
1、 The purpose of setting the register :
Memory in CPU Outside , Generally refers to hard disk ,U Disk and other devices that can save data after cutting off the power supply , The capacity is generally large , The disadvantage is that the reading and writing speed is very slow , The reading and writing speed of ordinary mechanical hard disk is generally 50MB/S about . Memory and register is a multi-level storage mechanism to solve the problem of slow memory reading and writing speed ,
2、CPU When calculating , First read the data to be used from the hard disk to the memory in advance , Then read the data to be used into the register
3、 register ( Also known as cache ) Generally, it refers to the basic RS Derived from the trigger structure D Trigger , It's the structure of some NAND gates , Generally integrated in CPU Inside , Its reading and writing speed is the same as CPU The running speed basically matches
4、 Different registers have different functions , Such as : General registers (GR) Used to store operands 、 The address or intermediate result of an operand ; Instruction register (IR) It is used to store the currently executing instructions , So that in the process of instruction execution , Control completes all functions of an instruction .
5、cpu The composition of :
CPU The fundamental task is to execute instructions , For a computer, it's all a bunch of things “0” and “1” The sequence of components .CPU Logically, it can be divided into 3 A module , The control unit 、 Computing units and storage units , These three parts are made up of CPU Internal bus connection .
A、 control unit
The control unit is the whole CPU Command and control center , By the instruction register IR(Instruction Register)、 Instruction decoder ID(Instruction Decoder) And operating controls OC(Operation Controller) etc. , It is very important to coordinate the orderly work of the whole computer .
It's based on the user's pre programmed program , Take each instruction out of the memory in turn , Put it in the instruction register IR in , By decoding instructions ( analysis ) Determine what to do , And then by operating the controller OC, In a certain sequence , Send micromanipulation control signals to corresponding components .
Operating the controller OC It mainly includes beat pulse generator 、 Control matrix 、 Clock generator 、 Reset circuit, start stop circuit and other control logic .
B、 Arithmetic unit
It's the core of the arithmetic unit . Can perform arithmetic operations ( Including addition and subtraction multiplier and other basic operations and additional operations ) And logic ( Including displacement 、 Logic test or comparison of two values ). Relative to the control unit , The arithmetic unit receives the command from the control unit and operates , That is to say, all operations carried out by the operation unit are directed by the control signals sent by the control unit , So it's the executive part .
C、 Storage unit
Include CPU On chip cache and register group , yes CPU Where data is temporarily stored in , It holds the data waiting to be processed , Or data that has been processed ,CPU It takes less time to access registers than to access memory .
Use register , Can reduce the CPU Number of memory accesses , So as to improve CPU Working speed of .
But because of the limitation of chip area and integration , The capacity of a register group cannot be large . Register group can be divided into special register and general register . The function of special register is fixed , Register the corresponding data separately .
General purpose registers are widely used and can be specified by programmers , The number of general purpose registers varies from microprocessor to microprocessor . This is the key point we will introduce later , Let me first mention .
Two 、 An operation
35: 0 0 1 0 0 0 1 1
47: 0 0 1 0 1 1 1 1
————————————————————
82: 0 1 0 1 0 0 1 0The calculation process : Each bit does XOR first 、1 and 1 The result is 10, That is, you need to carry . So the whole process is :" And " Operation and " displacement " Operation to achieve . The law of binary number operation is every two into one
1、 An operation :https://www.runoob.com/w3cnote/bit-operation.html
2、 The addition, subtraction, multiplication and division of integers are realized by bit operation :https://www.cnblogs.com/rgbit/p/10365840.html
3、 Decimal to binary , Using short division ; Binary to decimal , Weighted addition
3、 ... and 、 The pointer
1、 Concept :https://www.php.cn/cpl/cpl-pointers.html
2、C When do languages use pointers :
a. You can use a pointer at any time , Because using pointers is more efficient than using variables .
b. When a function returns 1 When there are more than operation results , You have to use a pointer , Because a function can only return one value , More have to use pointers “ Bring back ”.
c. When manipulating an array , Not only is it much more convenient to use pointers, but also the code is very time efficient .
d. When operating files , You can't walk without a pointer .
e. Using pointers can simplify the writing process of function calls , Make the source code easy to read .
Four 、C Structure
C Arrays allow you to define variables that can store items of the same type , The structure is C Another user-defined data type available in programming , It allows you to store different types of data items .
边栏推荐
- Laravel document sorting 10. Request life cycle
- 代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
- 如何绘制产业招商地图
- WMS仓储管理系统的使用价值,你知道多少
- PHP code audit 2 - these functions must be known and understood
- Doubts about judging the tinyint field type of MySQL
- Smart contract learning materials
- How to install opencv? Opencv download installation tutorial
- [kubernetes series] installation and use of Helm
- @Requestbody solution get parameter is null
猜你喜欢
![LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路

1280_ C language to find the average value of two unsigned integer

文本关键词提取:ansj

【Proteus仿真】Arduino UNO按键控制数码管闪烁增/减显示

Lecture record: new application of inertial navigation - inertial measurement

Exercise: how difficult is it to simulate the blessing lottery two-color ball - China 500W grand prize? Just run the code.

【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。

Lecture record: data processing methods and applications of various spatial geodetic techniques

1、项目第二阶段——用户注册和登陆

1280_C语言求两个无符号整形的平均值
随机推荐
openmmlab-环境配置
Nodejs connects to MySQL through heidisql, and ER appears_ BAD_ DB_ ERROR: Unknown database 'my_ db_ books'
WMS仓储管理系统的使用价值,你知道多少
"Comment positionner l'industrie" dans la planification industrielle locale / parc
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
"Grammar sugar" -- my new programming knowledge
Development of trading system (VI) -- HFT high frequency trading
Lecture record: history and development of strapdown inertial navigation solution
Basic use of OBS browser+ browser
Watch out for the stolen face! So many risks of face recognition used every day?
讲座记录《惯性导航的新应用——惯性测量》
How much do you know about the use value of WMS warehouse management system
Laravel document sorting 9. Blade template
NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao
升级cmake
SQL, CTE, flg case problems
Hello CTP (III) - CTP quotation API
马斯克发布人形机器人,AI对马斯克为什么意义重大?
Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!
Smart contract learning materials