diff --git a/content/408/《计组》计算机系统概述.md b/content/408/《计组》计算机系统概述.md new file mode 100644 index 0000000..3fab866 --- /dev/null +++ b/content/408/《计组》计算机系统概述.md @@ -0,0 +1,251 @@ +--- +title: "《计组》计算机系统概述" +date: 2023-07-07T11:24:47+08:00 + +--- +## 常考知识点 + +* 存取速度:寄存器【CPU内部】> Cache > 内存 +* 机器语言是计算机唯一可以直接识别和执行的语言 +* 存储元:即存储二进制的电子元件,每个存储元可存1bit +* 存储单元:每个存储单元存放一串二进制代码 +* 存储字:存储单元中二进制代码的组合 +* 存储字长:存储单元中二进制代码的位数 +* 机器字长:计算机能一次处理的二进制代码的长度 + * 可通过寄存器的位数判断机器字长 + * 一定与机器字长相同的部件:ALU,通用寄存器 +* 指令字长:指令的二进制长度 +* 数据字长:数据总线一次能并行传送信息的次数 +* 一字节 = 8位,即$1B = 8bit$ +* IR,MAR,MDR对程序员不可见 +* 计算机运算速度指标指的是每秒能执行多少条指令,即MIPS +* 描述浮点数操作速度的指标:MIPS + + +## 计算机硬件的发展 + +|发展阶段|逻辑元件|主存储器|运算速度|软件|应用| +|---|---|---|---|---|---| +|第一代|电子管|电子射线管|几千次到几万次|机器语言、汇编语言|军事研究、科学计算| +|第二代|晶体管|磁芯|几十万次|监控程序、高级语言|数据处理、事务处理| +|第三代|中小规模集成电路|半导体|几十万次到上百万次|操作系统、编辑系统、应用程序|广泛应用| +|第四代|大规模超大规模集成电路|集成度更高的半导体|上千万次到上亿次|操作系统、数据库、高级语言、应用程序|渗入社会各个领域| + +## 计算机发展趋势 + +* 巨型化 +* 网络化 +* 微型化 + * 微型计算机的发展以微处理器技术为标志 +* 智能化 + +## 计算机软件的发展 + +* 应用软件 + * 办公软件 + * 多媒体软件 + * 辅助设计软件 + * 企业应用软件 + * 网络应用软件 + * 安全防范软件 + * 娱乐休闲软件 +* 系统软件 + * 操作系统 + * 网络服务程序 + * 语言处理程序 + * 数据库管理系统【数据库系统不是系统软件】 + * 程序设计语言 + * 其他实用程序和工具 + + +## 计算机应用层次结构 + +* 层次结构图 + * ![](../../images/《计组》计算机系统概述/计算机应用层次结构.jpg) +* 三种程序转换 + * 高级语言$\underrightarrow{编译}$汇编语言$\underrightarrow{汇编}$机器语言 + * 高级语言$\underrightarrow{解释}$机器语言 + * 源程序$\underrightarrow{C编译器}$汇编源程序$\underrightarrow{汇编程序}$目标程序$\underrightarrow{链接程序}$可执行程序 +* 三个级别的语言 + * 机器语言 + * 计算机唯一可以直接识别和执行的语言 + * 汇编语言 + * 由汇编程序(系统软件)翻译成机器语言后再执行 + * 高级语言 + * C,C++,java等 + * 一种是经过编译程序得到汇编语言,然后得到机器语言,然后再执行【高级语言$\rightarrow$汇编语言$\rightarrow$机器语言】 + * 一种是由高级语言程序直接翻译成机器语言(边翻译边执行,不生成可执行文件)【高级语言$\rightarrow$机器语言】 +* 翻译程序 + * 汇编程序(汇编器) + * 汇编语言$\rightarrow$机器语言 + * 解释程序(解释器) + * 边翻译边执行 + * 编译程序(编译器) + * 高级语言$\rightarrow$汇编语言$\rightarrow$机器语言 + + +## 计算机硬件的组成 + +### 冯诺依曼结构 + +* 组成示例图 + * ![](../../images/《计组》计算机系统概述/冯诺依曼机的示例图.jpg) +* 特点 + * 计算机由五大部件组成 + * 输入设备 + * 输出设备 + * 存储器 + * 运算器 + * 控制器 + * 指令和数据以同等地位存储在存储器中,并按地址寻址 + * 指令和数据均以二进制代码表示 + * CPU区分指令和数据的凭依是指令周期的不同阶段 + * 数据由指令的地址码给出 + * 指令 = 操作码 + 地址码,操作码表示操作的性质,地址码用来表示操作数在存储器中的位置 + * 指令在存储器内按顺序存放,通常,指令是顺序执行的,特定条件下可根据运算结果或根据设定的条件改变执行顺序 + * 早期冯诺依曼机以运算器为中心,输入输出设备通过运算器与存储器传送数据 + * 单处理机 + * 基本工作方式为控制流驱动方式 + + +### 现代计算机结构 + +* 示例图 + * ![](../../images/《计组》计算机系统概述/现代计算机结构的示例图.jpg) +* 特点 + * 计算机 = 主机 + 输入/输出设备 + * 主机 = CPU +主存 + * CPU = 运算器 + 控制器 + * 控制器:指挥各部件使得程序执行 + * 运算器:算术运算和逻辑运算 + * 存储器:存放数据和指令【存储器为核心】 + * 输入设备:将信息转换为机器能够识别的形式 + * 输出设备:将结果转换为人们熟悉的形式 + +## 计算机的功能组件 + +### 存储器 + + + * ![](../../images/《计组》计算机系统概述/存储器.jpg) + * ![](../../images/《计组》计算机系统概述/存储体.jpg) + * 组件 + * 存储元:存储二进制的电子元件,每个存储元可存储1bit + * 存储单元:每个存储单元放一串二进制代码 + * 存储字:存储单元中二进制代码的组合 + * 存储字长:存储单元中二进制代码的位数 + * 机器字长:计算机能一次处理的二进制代码长度 + * 指令字长:指令的二进制长度 + * 数据字长:数据总线一次能并行传送信息的次数 + * MAR(地址寄存器):用于寻址,位数=存储单元个数/地址码的长度 + * 现代计算机CPU中也内置了MAR + * MDR(数据寄存器):用于暂存数据,位数 = 存储字长 + * 时序控制逻辑:用于产生存储器操作所需的各种时序信号 + +### 运算器 + + +* ![](../../images/《计组》计算机系统概述/运算器.jpg) +* 组件 + * ACC:累加器,用于存放操作数或运算结果 + * MQ:乘商寄存器,在乘除计算中用于存放操作数或运算结果 + * X:通用的操作数寄存器,用于存放操作数 + * ALU:算术逻辑单元,运算器核心 + +### 控制器 + +* ![](../../images/《计组》计算机系统概述/控制器.jpg) + * 组件 + * PC:程序计数器,存放下一条指令的地址,并跟踪下一条要执行的指令的地址 + * IR:指令寄存器:存放当前正在执行的指令 + * CU:控制单元,分析指令,给出控制信号 + + +## 计算机系统的细节 + +* 系统细节图 + * ![](../../images/《计组》计算机系统概述/系统细节图.jpg) +* 系统的组成 + * CPU:中央处理器 + * PC:程序计数器 + * MAR:存储地址寄存器 + * ALU:算术逻辑部件 + * IR:指令寄存器 + * MDR:存储器数据寄存器 + * GPRs:通用寄存器组 + * 由若干通用寄存器组成,早期为累加器 +* 程序执行的过程 + * 程序执行前 + * 数据和指令事先存放在存储器中,每条指令和每个数据都有地址,指令按序存放,指令由OP、ADDR字段组成,程序起始地址置PC + * 开始执行程序 + * 根据PC取指令 + * 指令译码 + * 取操作数 + * 指令执行 + * 回写结果 + * 修改PC的值 + * 继续执行下一条指令 +* 指令执行过程 + * 分为取指令,分析指令,执行指令三个阶段 + * 开始时,将第一条指令地址放到PC中 + * 将PC的指令暂存到MAR中,发出读命令,读MAR里面的内容,然后存到MDR中,再把MDR的指令放到IR中 + * 翻译IR的操作性质 + * 取操作数 + * 将操作数送往运算器,进行运算 + * 送结果到寄存器中或送到内存 + * PC加一 +* 常见操作码 + * ![](../../images/《计组》计算机系统概述/常见的操作码.jpg) +* 程序执行过程举例 + * 举例计算$y = ax^2 + bx+c$ + * 取x至运算器中 + * 乘以a,得ax,存于运算器中 + * 加b,得ax+b,存于运算器中 + * 乘以x,得(ax+b)x,存于运算器中 + * 将运算器中数据送至存储器y中 + * 打印y + * 停机 + * ![](../../images/《计组》计算机系统概述/程序执行过程举例.jpg) + + +## 计算机性能指标 + +* 字长 + * 机器字长:计算机进行一次整数运算所能处理的二进制的位数,一般与字长长度有关 +* 数据通路带宽 + * 外部数据总线一次能并行传送信息的位数,非CPU内部数据总线宽度 +* 主存容量 + * 主存储器所能存储信息的最大容量 + * 通常以字节来衡量【1B = 8bit】 + * 也可使用字数$\times$字长表示 + * MAR为16位,$2^{16} = 65536$,即存储体内有65536个存储单元(可称为64K,1K = 1024) + * MDR为32位,表示存储容量为64K $\times$ 32位 +* 吞吐量和响应时间 + * 吞吐量:系统在单位时间内处理请求的数量【用户角度下评价计算机系统性能的综合参数】 + * 响应时间:指用户向计算机发送一个请求,到系统对该请求做出响应并获得所需结果的等待时间 +* 主频和CPU时钟周期 + * 主频:机器内部主时钟的频率,代表每秒执行多少个时钟周期数 + * 值越大代表一个操作所需时间越少,CPU运行速度越快 + * CPU时钟周期:通常为节拍脉冲或T周期,即主频的倒数 + * 是CPU中最小的时间单位,每个动作至少需要1个时钟周期 + * 时钟周期$= \frac{1}{主频}$,如主频为2.4GHz,则时钟周期$ = \frac{1}{2.4G}$秒 +* CPI + * 执行一条指令所需要的时钟周期数 + * CPI与系统结构,指令集,计算机组织有关,与时钟频率无关 + * $CPI = \frac{时钟周期数量}{指令数量}$ +* CPU执行时间 + * 运行一个程序所花费的时间 + * $执行时间 = 时钟周期数量 \times 时钟周期 = \frac{时钟周期数量}{主频} = \frac{指令条数 \times CPI}{主频}$ +* MIPS + * MIPS:每秒执行多少百万条指令【Million instruction per second】 + * $ MIPS = \frac{指令条数}{执行时间 \times 10^6 = \frac{主频}{CPI \times 10^6}}$ + * MFLOPS:每秒执行多少百万次浮点运算 + * $MFLOPS = \frac{浮点操作次数}{执行时间 \times 10^6}$ + * GFLOPS:每秒执行多少十亿次浮点运算 + * $GFLOPS = \frac{浮点操作次数}{执行时间 \times 10^9}$ + * TFLOPS:每秒执行多少万亿次浮点运算 + * $TFLOPS = \frac{浮点操作次数}{执行时间 \times 10^{12}}$ +* 其他换算 + * $1Kb = 2^{10}b = 1024b,1B【字节】 = 8bit【位】$ + * 描述速率,频率时:$1T = 10^3G = 10^6M = 10^9K$ + diff --git a/static/images/《计组》数据的表示和运算/IEE754浮点数结构.jpg b/static/images/《计组》数据的表示和运算/IEE754浮点数结构.jpg new file mode 100644 index 0000000..f544396 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/IEE754浮点数结构.jpg differ diff --git a/static/images/《计组》数据的表示和运算/一位全加器结构.jpg b/static/images/《计组》数据的表示和运算/一位全加器结构.jpg new file mode 100644 index 0000000..174991c Binary files /dev/null and b/static/images/《计组》数据的表示和运算/一位全加器结构.jpg differ diff --git a/static/images/《计组》数据的表示和运算/串行进位加法器.jpg b/static/images/《计组》数据的表示和运算/串行进位加法器.jpg new file mode 100644 index 0000000..9b26ba4 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/串行进位加法器.jpg differ diff --git a/static/images/《计组》数据的表示和运算/二进制转八或十六.jpg b/static/images/《计组》数据的表示和运算/二进制转八或十六.jpg new file mode 100644 index 0000000..33de411 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/二进制转八或十六.jpg differ diff --git a/static/images/《计组》数据的表示和运算/任意进制转二.jpg b/static/images/《计组》数据的表示和运算/任意进制转二.jpg new file mode 100644 index 0000000..a26be28 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/任意进制转二.jpg differ diff --git a/static/images/《计组》数据的表示和运算/十进制转任意.jpg b/static/images/《计组》数据的表示和运算/十进制转任意.jpg new file mode 100644 index 0000000..741395e Binary files /dev/null and b/static/images/《计组》数据的表示和运算/十进制转任意.jpg differ diff --git a/static/images/《计组》数据的表示和运算/原码一位乘法流程图.jpg b/static/images/《计组》数据的表示和运算/原码一位乘法流程图.jpg new file mode 100644 index 0000000..78c5d43 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/原码一位乘法流程图.jpg differ diff --git a/static/images/《计组》数据的表示和运算/原码一位乘法计算过程.png b/static/images/《计组》数据的表示和运算/原码一位乘法计算过程.png new file mode 100644 index 0000000..86ce2b5 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/原码一位乘法计算过程.png differ diff --git a/static/images/《计组》数据的表示和运算/原码除法计算过程.png b/static/images/《计组》数据的表示和运算/原码除法计算过程.png new file mode 100644 index 0000000..9bfa4ae Binary files /dev/null and b/static/images/《计组》数据的表示和运算/原码除法计算过程.png differ diff --git a/static/images/《计组》数据的表示和运算/原码除法运算电路图.png b/static/images/《计组》数据的表示和运算/原码除法运算电路图.png new file mode 100644 index 0000000..76bd5b3 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/原码除法运算电路图.png differ diff --git a/static/images/《计组》数据的表示和运算/将十进制转为浮点数例题.png b/static/images/《计组》数据的表示和运算/将十进制转为浮点数例题.png new file mode 100644 index 0000000..5e0c749 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/将十进制转为浮点数例题.png differ diff --git a/static/images/《计组》数据的表示和运算/将浮点数转为十进制例题.jpg b/static/images/《计组》数据的表示和运算/将浮点数转为十进制例题.jpg new file mode 100644 index 0000000..21229f6 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/将浮点数转为十进制例题.jpg differ diff --git a/static/images/《计组》数据的表示和运算/带标志加法器.jpg b/static/images/《计组》数据的表示和运算/带标志加法器.jpg new file mode 100644 index 0000000..8cadb1a Binary files /dev/null and b/static/images/《计组》数据的表示和运算/带标志加法器.jpg differ diff --git a/static/images/《计组》数据的表示和运算/并行进位加法器.jpg b/static/images/《计组》数据的表示和运算/并行进位加法器.jpg new file mode 100644 index 0000000..ba2a7d7 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/并行进位加法器.jpg differ diff --git a/static/images/《计组》数据的表示和运算/循环移位流程.png b/static/images/《计组》数据的表示和运算/循环移位流程.png new file mode 100644 index 0000000..5f2c877 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/循环移位流程.png differ diff --git a/static/images/《计组》数据的表示和运算/数据存储和排列例题.png b/static/images/《计组》数据的表示和运算/数据存储和排列例题.png new file mode 100644 index 0000000..bdd0293 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/数据存储和排列例题.png differ diff --git a/static/images/《计组》数据的表示和运算/数据按边界对齐方式存储.png b/static/images/《计组》数据的表示和运算/数据按边界对齐方式存储.png new file mode 100644 index 0000000..146d307 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/数据按边界对齐方式存储.png differ diff --git a/static/images/《计组》数据的表示和运算/数据的大端方式和小端方式存储.png b/static/images/《计组》数据的表示和运算/数据的大端方式和小端方式存储.png new file mode 100644 index 0000000..23184f6 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/数据的大端方式和小端方式存储.png differ diff --git a/static/images/《计组》数据的表示和运算/浮点数结构.jpg b/static/images/《计组》数据的表示和运算/浮点数结构.jpg new file mode 100644 index 0000000..5b4469f Binary files /dev/null and b/static/images/《计组》数据的表示和运算/浮点数结构.jpg differ diff --git a/static/images/《计组》数据的表示和运算/算术逻辑单元ALU.png b/static/images/《计组》数据的表示和运算/算术逻辑单元ALU.png new file mode 100644 index 0000000..cde9b2c Binary files /dev/null and b/static/images/《计组》数据的表示和运算/算术逻辑单元ALU.png differ diff --git a/static/images/《计组》数据的表示和运算/补码一位乘法电路图.png b/static/images/《计组》数据的表示和运算/补码一位乘法电路图.png new file mode 100644 index 0000000..78cfd23 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/补码一位乘法电路图.png differ diff --git a/static/images/《计组》数据的表示和运算/补码一位乘法计算过程.png b/static/images/《计组》数据的表示和运算/补码一位乘法计算过程.png new file mode 100644 index 0000000..3891de3 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/补码一位乘法计算过程.png differ diff --git a/static/images/《计组》数据的表示和运算/补码除法运算电路图.png b/static/images/《计组》数据的表示和运算/补码除法运算电路图.png new file mode 100644 index 0000000..76bd5b3 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/补码除法运算电路图.png differ diff --git a/static/images/《计组》数据的表示和运算/补码除法运算计算过程.png b/static/images/《计组》数据的表示和运算/补码除法运算计算过程.png new file mode 100644 index 0000000..7275b23 Binary files /dev/null and b/static/images/《计组》数据的表示和运算/补码除法运算计算过程.png differ diff --git a/static/images/《计组》计算机系统概述/冯诺依曼机的示例图.jpg b/static/images/《计组》计算机系统概述/冯诺依曼机的示例图.jpg new file mode 100644 index 0000000..938785c Binary files /dev/null and b/static/images/《计组》计算机系统概述/冯诺依曼机的示例图.jpg differ diff --git a/static/images/《计组》计算机系统概述/存储体.jpg b/static/images/《计组》计算机系统概述/存储体.jpg new file mode 100644 index 0000000..891aa3b Binary files /dev/null and b/static/images/《计组》计算机系统概述/存储体.jpg differ diff --git a/static/images/《计组》计算机系统概述/存储器.jpg b/static/images/《计组》计算机系统概述/存储器.jpg new file mode 100644 index 0000000..4bdcb4d Binary files /dev/null and b/static/images/《计组》计算机系统概述/存储器.jpg differ diff --git a/static/images/《计组》计算机系统概述/常见的操作码.jpg b/static/images/《计组》计算机系统概述/常见的操作码.jpg new file mode 100644 index 0000000..e815585 Binary files /dev/null and b/static/images/《计组》计算机系统概述/常见的操作码.jpg differ diff --git a/static/images/《计组》计算机系统概述/控制器.jpg b/static/images/《计组》计算机系统概述/控制器.jpg new file mode 100644 index 0000000..305cb46 Binary files /dev/null and b/static/images/《计组》计算机系统概述/控制器.jpg differ diff --git a/static/images/《计组》计算机系统概述/现代计算机结构的示例图.jpg b/static/images/《计组》计算机系统概述/现代计算机结构的示例图.jpg new file mode 100644 index 0000000..8d3f879 Binary files /dev/null and b/static/images/《计组》计算机系统概述/现代计算机结构的示例图.jpg differ diff --git a/static/images/《计组》计算机系统概述/程序执行过程举例.jpg b/static/images/《计组》计算机系统概述/程序执行过程举例.jpg new file mode 100644 index 0000000..4e596d3 Binary files /dev/null and b/static/images/《计组》计算机系统概述/程序执行过程举例.jpg differ diff --git a/static/images/《计组》计算机系统概述/系统细节图.jpg b/static/images/《计组》计算机系统概述/系统细节图.jpg new file mode 100644 index 0000000..629ccb1 Binary files /dev/null and b/static/images/《计组》计算机系统概述/系统细节图.jpg differ diff --git a/static/images/《计组》计算机系统概述/计算机应用层次结构.jpg b/static/images/《计组》计算机系统概述/计算机应用层次结构.jpg new file mode 100644 index 0000000..ae3c1e4 Binary files /dev/null and b/static/images/《计组》计算机系统概述/计算机应用层次结构.jpg differ diff --git a/static/images/《计组》计算机系统概述/运算器.jpg b/static/images/《计组》计算机系统概述/运算器.jpg new file mode 100644 index 0000000..b48f21c Binary files /dev/null and b/static/images/《计组》计算机系统概述/运算器.jpg differ