当前位置:网站首页>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 .
边栏推荐
- IntStream API介绍
- List rendering in wechat applet
- 【LeetCode】148. 排序链表
- Hello CTP (I) - basic knowledge of futures
- Read lsd-slam: large scale direct monolithic slam
- Coinlist queuing tutorial to improve the winning rate
- @Requestbody solution get parameter is null
- 代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
- 什么是存储引擎以及MySQL常见的三种数据库存储引擎
- Simple integration of client go gin 11 delete
猜你喜欢

NFT Insider #63:The Sandbox与时代杂志达成合作,YGG成立西班牙subDAO

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

Laravel document sorting 4. Controller

1280_C语言求两个无符号整形的平均值

AI quantitative transaction (II) -- tushare financial data framework

Can Navicat directly operate the Android database SQLite

Mathematical analysis_ Notes_ Chapter 3: limits

Is opencv open source?

SEO的5大关键指标:排名+流量+会话+停留时长+跳出率

代表多样性的彩色 NFT 系列上线 The Sandbox 市场平台
随机推荐
PHP code audit 2 - these functions must be known and understood
DAP数据调度功能完善说明
智慧风电:数字孪生 3D 风机智能设备运维
1、项目第二阶段——用户注册和登陆
Mathematical analysis_ Notes_ Chapter 3: limits
Is opencv open source?
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
EasyRecovery15非常好用的电脑数据恢复软件
【Kubernetes系列】Helm的安装使用
Laravel document sorting 9. Blade template
Changsha's "talent seeking": "making efforts" and "making practical moves" go hand in hand, "rapid development" and "slow life" go hand in hand
5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
navicat可不可以直接操作安卓数据库SQLite
PHP code audit 1 - php Ini
How to install opencv? Opencv download installation tutorial
Communication problems in parent and child components of uniapp
Text keyword extraction: ansj
MySQL order by
Sourcetree pulls the code and prompts to fill in authentic, but the configuration cannot change the user
OBS Browser+浏览器的基本使用