您的位置 首页 > 数码极客

【memory什么意思】深入理解存储程序结构的冯诺依曼计算机的五大部件

-1-存储程序和自动执行程序是冯诺依曼计算机操作的基本原理。

20世纪50年代冯诺依曼提出了由输入设备、内存、控制器、运算符、输出设备组成的五大部件和存储程序概念。命令和数据可以一起存储在内存中,程序按顺序自动运行。

CPU由运算器、控制器和寄存器及实现它们之间联系的数据、控制及状态的总线构成。差不多所有的CPU的运作原理可分为四个阶段:提取(Fetch)、解码(Decode)、执行(Execute)和写回(Writeback)。 CPU从存储器或高速缓冲存储器中取出指令,放入指令寄存器,并对指令译码,并执行指令。所谓的计算机的可编程性主要是指对CPU的编程。

所谓指令是一串二进制数,它规定机器做什么操作。指令分为两部分:操作码和操作数。操作码说明要做什么操作,操作数指明要处理的数据的存放地址在什么地方。处理器里有百儿八十条指令,称为指令集;机器语言可以被看作一种约定的形式,用处理器和寄存器来操控内存。

1.1 存储程序:通过输入设备,把程序载入到存储器中临时存储起来;

1.2 取得指令:控制器从存储器中放置程序的位置(地址)拿出一条程序指令,并放到指令寄存器中;

1.3 解析指令:控制器对拿到的程序指令进行分析和解释,确定指令的含义和具体工作任务,然后产生与该任务对应的控制信息,发送给相应部件。譬如,如果任务是做两个数的加法,则发送控制信息指挥运算器从存储器中取出参与运算的两个数,进行加法运算;

1.4 执行指令:控制器根据指令的性质,向计算机各部件发出相应的控制信号,有序地控制各部件完成规定的操作;譬如,运算器收到加法控制命令和参与运算的两个数,就执行加法运算,运算产生的结果数据传送到存储器中临时保存起来。

1.5 每取一条指令,控制器中的指令计数器就加1,确定下一条指令的地址,控制器按顺序取得下一条程序指令,解析指令,然后各部件执行指令...如此循环往复持续不断,直到程序结束。

-2-控制器

控制器的主要任务是根据从内存取来的指令,解析指令并向相应的部件发出控制信号,控制计算机各部件协调工作,完成要求的作业。

控制器主要包括三个部分:

2.1 指令寄存器IR(Instruction Register):其本质是存储部件,寄存器是一个临时存储介质。计算机将当前执行或者即将执行的指令存储在该寄存器中;

2.2 程序计数器PC(Program Counter):是用来保存下一步将要执行指令的位置,所以通过该寄存器保存的地址就可以方便地将下一步要执行的指令从内在中取出,放到指令寄存器中;

2.3 操作控制器OC(Operation Controler) :负责将指令进行译码,产生相应的控制信号,控制其他部件有序地运行。因为计算机只能看懂“0”、“1”组成的语言,需要将指令转换为机器语言,而这个寄存器就实现该功能;

Controller uses an instruction pointer to keep track of the sequence of instruction that is supposed to be the pointer as a guide,the control unit retrieves each instruction in sequence from RAM and places it in a special instruction regi control unit interprets the instruction to find out what needs to be done.According to its interpretation,the control unit sends signals to the data bus to fetch data from RAM,and to the ALU to perform a process.

Data are brought into the ALU by the control unit and the ALU performs whatever arithmetic or logical operations are required to help carry out the instructions.

-3-运算器

运算器的基本操作包括加、减、乘、除四则运算,与、或、非、民或等逻辑操作,以及移位、比较和传送等操作,也可执行地址运算和转换,亦称为算术逻辑部件(ALU)。运算逻辑部件,可以执行定点或浮点算术运算操作、移位操作以及逻辑操作,。

3.1 接收寄存器:接收并保存一个操作数。

3.2 累加寄存器:保存另一个操作数和运算结果。

3.3 状态寄存器:用来记录算术、逻辑运算或测试操作的结果状态。程序设计中,这些状态通常用作条件转换指令的判断条件,所以又称为条件码寄存器。

3.4 通用寄存器:为了减少对存储器的访问,主要用来保存参加运算的操作数和运算的结果。

3.5 执行部件:包括一个加法器和各种类型的输入输出门电路。

3.6 控制电路:按照一定的时间顺序发出不同的控制信号,使数据经过相应的门电路进入寄存器或加法器,完成规定的操作。

-4- 寄存器

寄存器是CPU内部用来存放数据的一些小型存储区域,用来暂时存放参与运算的数据和运算结果。其实寄存器就是一种常用的时序逻辑电路,但这种时序逻辑电路只包含存储电路。寄存器的存储电路是由锁存器或触发器构成的,因为一个锁存器或触发器能存储1位二进制数,所以由N个锁存器或触发器可以构成N位寄存器。寄存器是中央处理器内的组成部份。寄存器是有限存贮容量的高速存贮部件,它们可用来暂存指令、数据和位址。在中央处理器的控制部件中,包含的寄存器有指令寄存器(IR)和程序计数器(PC)。在中央处理器的算术及逻辑部件中,包含的寄存器有累加器(ACC)。

寄存器部件,包括通用寄存器、专用寄存器和控制寄存器。

A register is a storage location inside the in the control unit are used to keep track of the overall status of the program that is running.Control unit registers store information such as the current instruction,the location of the next instruction to be executed,and the operands of the in the ALU,registers store data items that are added,substracted,multiplied,divided,and com registers store the results of arithmetic and logical operations.

-5- 总线:五大部件的连接

为了读出程序、处理数据等,必须要在CPU与内存之间进行数据的传送。数据是利用称为数据总线(data bus)的传输途径进行交换的。所谓总线(bus),就是计算机主板上的某种传输线路。总线的宽度(即传输线的条数),会因CPU而各异。比如,对于32位总线而言,每次可以交换32位的数据。但需要注意的是,总线位数并不是CPU的位数,而是指传输数据时的位数。例如,英特尔公司的奔腾系列为32位的CPU,其数据总线的宽度为64位。总线是与从CPU芯片里面引出来的,一根一根针(pin)脚相对应的。如果能对照CPU芯片或计算机主板的实物,找到称为总线的传输线路,对总线的概念,就会有感觉了。

此外,为了从内在读出数据,或者将数据写入内存,就必须要指定读出的位置和写入的位置。因此,内存中的每个字节(Byte)都被分配了相应的编号(当然不一定都要以字节为单位,也有采用别的单位进行编号的),这种编号就称为地址(address)。当要访问内存时,就需要从CPU传送出指定地址的电信号。这种信号也是通过总线进行传送的,但它与传送数据所用的总线(数据总线)不同,是由地址总线的位数所决定的。

比如,若地址总线只有16条(即16位总线),其所能存取访问的地址是,从0000 0000 0000 0000地址到1111 1111 1111 1111地址为止,只有65636个单元。现在市场上的奔腾系列CPU,其地址总线有32根。它可以直接访问的内在单元为232=4GB(约40亿个字节)。

主存与CPU的硬连接有三组连线:地址总线(AB)、数据总线(DB)和控制总线(CB)。把主存看作一个黑盒子,存储器地址寄存器(MAR)和存储器数据寄存器(MDR)是主存和CPU之间的接口。MAR可以接收由程序计数器(PC)的指令地址或来自运算器的操作数的地址,以确定要访问的单元。MDR是向主存写入数据或从主存读出数据的缓冲部件。MAR和MDR从功能上看属于主存,但通常放在CPU内。

Physically,a bus is a set of wires.The components of the computer are connected to the bu send information from one component to another,the source component outputs data onto the bus.The destination component then inputs this data from the bus.As the complexity of a computer system increases,it becomes more efficient(in terms of minimizing connections) at using buses rather than direct connections between every pair of devices.Buses use less space on a circuit board and require less power than a large number of direct connec also require few pins on the chip or chips that comprise the CPU.

When the cpu reads data or instruction from or writes data to memory,it must specify the address of the memory location it wishes to acce outputs this address to the address bus;memory inputs this address from the address bus and use it to access the proper memory loca I/O devices,usch as a keyboard,monitor,or disk device,has a unique address as well,when accessing an I/O device,the cpu places address of the device on the address bus.Each bus can read the address off the bus and determine whether it is the device being access by the c the other buses,the address bus always receives data form the cpu,the cpu never reads the address bus.

Data is transfered via the data bus.When the cpu fetches data from memory,it first outputs the memory address on its address bus.Then memory outputs the data onto the data bus,the cpu can then read the data from the data bus.When writing data to memory,the cpu first outputs the address onto the address bus,then outputs the data onto the data bus.The memory then reads and stores the data at proper loca processes for reading data from and writing data to the I/O devices are similar.

The control bus is different from the other two bu address bus consists of a lines,which combine to transmit one -bit address value.Similarly,the lines of the data bus work together to transmit a single multi-bit value.In contrast,the control bus is a collection of individual control signals indicate whether data is to be read into or written out of the cpu,whether the cpu is accessing memory or an I/O devices or memory is ready to transfer da control bus is really a collection of (mostly) undirectional of these signals are output from the memory and I/O subsystems,although a few are output by these subsystems to the cpu.

A system may have a hierarchy of bu example,it may use its address,data and control buses to access memory,and an I/O con I/O controller,in turn,may access all I/O devices using a second bus,often called an I/O bus or a local bus.

-End-

责任编辑: 鲁达

1.内容基于多重复合算法人工智能语言模型创作,旨在以深度学习研究为目的传播信息知识,内容观点与本网站无关,反馈举报请
2.仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证;
3.本站属于非营利性站点无毒无广告,请读者放心使用!

推荐阅读