# 3.4 主存储器与CPU的连接

## 3.4.1 主存连接原理

### 1、主存简单模型

为书3.3.3章节内容

![](/files/-MkbTBBi6-PrlLcV-VZA)

三个输入信号：读/写信号、要读写的数据、数据的主存地址

### 2、连接原理

![](/files/-MkbTh0X0X9Rlh2v8oAK)

三个总线：数据总线、地址总线、控制总线（读/写）

### 3、主存的地址单元分配

![](/files/-MkbYqC7mThOj1iL8zgf)

* 存储单元的数量：总容量 ÷ 每个单元的容量
* 地址线的数量：总容量的位数（图中 $$1\text{KB}=2^{10}\text{B}$$，故有10根地址线）
* 如何存放一个字
  * 字长为4B，实际上寻址时将四个存储单元看作一个
  * 一组内有4个存储单元，后两位表示序号，前面表示所在组
  * 每个存储单元存放两位十六进制数（8位二进制数）
  * 共四个存储单元，也就是一个字

## 3.4.2 主存容量的扩展

### 1、位扩展法

![](/files/-Mkw7c0YvzlpEHwNytnL)

* 地址线、片选线和读写控制线**并联**
* 数据线依次连接CPU数据线的一位

如上图中就将8片 $$8K \times 1$$位的储芯片扩展为了 $$8K \times 8$$位

### 2、字扩展法

![](/files/-MkwDPf7nsbahYysOTqB)

* 数据线、读写控制线和地址线**并联**
* 使用PU剩下的地址线连接片选线，选择当前读/写的芯片
  * 线选法：直接将地址线与片选线连接，一根地址线对应一根片选线
  * 译码器片选法：使用译码器将连接CPU地址线与片选线

|                  线选法                  |             译码器片选法            |
| :-----------------------------------: | :---------------------------: |
|              n条线 → n个选片信号             |       n条线 → $$2^n$$个选片信号      |
|                  电路简单                 |              电路复杂             |
| <p>地址空间不连续</p><p>（形如11、00的信号是无效的）</p> | <p>地址空间可连续</p><p>可以增加逻辑设计</p> |

### 3、字位扩展

![](/files/-MkwGNv4ZVFQwoL_IFZ8)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aye10032.gitbook.io/computerorganizationnote/di-san-zhang-cun-chu-xi-tong/3.4-zhu-cun-chu-qi-yu-cpu-de-lian-jie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
