当前位置:网站首页>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 .
边栏推荐
- MySQL插入过程报错1062,但是我没有该字段。
- Failed to install redis interface
- Summary of various problems encountered by cocos2d-x
- numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
- 95% 程序员都在这里摸鱼……
- OBS Browser+浏览器的基本使用
- Cesium drag 3D model
- Uniapp makes mobile app programs, using uni Choosevideo record video, video playback is fuzzy, and the resolution is low
- numpy np tips: numpy数组的squeeze等处理
- Cesium 加载显示热力图
猜你喜欢

Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'

"Renaissance" in the digital age? The bottom digital collection makes people happy and sad

AI quantitative transaction (II) -- tushare financial data framework
![LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路

OBS Browser+浏览器的基本使用

95% of programmers fish here

PHP code audit 1 - php Ini

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

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

Basic use of OBS browser+ browser
随机推荐
Lecture record: new application of inertial navigation - inertial measurement
NFT Insider #63:The Sandbox与时代杂志达成合作,YGG成立西班牙subDAO
Openmmlab environment configuration
Cesium graphic annotation circle, square, polygon, ellipse, etc
讲座记录《捷联惯导解算的历史及发展》
EasyRecovery15非常好用的电脑数据恢复软件
List rendering in wechat applet
PHP code audit 2 - these functions must be known and understood
cesium 图形标注圆形、正方形、多边形、椭圆等
UCLA | generative pre training for black box optimization
OBS Browser+浏览器的基本使用
Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
SQL, CTE, FLG CASE问题
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路
Development of trading system (XI) -- Introduction to quickfix
A-table mouse over the display hand, the current line can be clicked
1.初识半音阶口琴
讲座记录《惯性导航的新应用——惯性测量》
【LeetCode】148. 排序链表