Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter One Introduction of Microcomputer system (2)

Similar presentations


Presentation on theme: "Chapter One Introduction of Microcomputer system (2)"— Presentation transcript:

1 Chapter One Introduction of Microcomputer system (2)
2018年12月31日

2 1.4 微型计算机硬件系统 微型计算机系统的组成 到目前为止,计算机仍沿用1940年由冯.诺依曼首先提出的体系结构。其基本设计思想为: ① 以二进制形式表示指令和数据。 ② 程序和数据事先存放在存储器中,计算机在工作时能够高速地从存储器中取出指令加以执行。 ③ 由运算器、控制器、存储器、输入设备和输出设备等五大部件组成计算机系统。 2018年12月31日

3 图1.3 微型计算机硬件系统结构 地址总线AB 定时电路 输入设备 输出设备 I/O接口 ROM RAM 数据总线DB 控制总线CB 微 处
(CPU) 图1.3 微型计算机硬件系统结构 2018年12月31日

4 所谓总线,是计算机中各功能部件间传送信息的公共通道,是微型计算机的重要组成部分。它们可以是带状的扁平电缆线,也可以是印刷电路板上的一层极薄的金属连线。所有的信息都通过总线传送。根据所传送信息的内容与作用不同,总线可分为三类: 地址总线AB(Address Bus):在对存储器或I/O端口进行访问时,传送 由CPU提供的要访问存储单元或I/O端口的地址信息,以便选中要访问的存储单元或I/O端口,是单向总线。 2018年12月31日

5 数据总线DB(Data Bus):从存储器取指令或读写操作数,对I/O端口进行读写操作时,指令码或数据信息通过数据总线送往CPU或由CPU送出,是双向总线。
控制总线CB(Control Bus):各种控制或状态信息通过控制总线由CPU送往有关部件,或者从有关部件送往CPU。CB中每根线的传送方向是一定的,图1.3中CB作为一个整体,用双向表示。 2018年12月31日

6 The Basic System Components
The basic operational design of a computer system is called its architecture . John Von Neumann(冯·诺依曼), a pioneer in computer design, is given credit for the architecture of most computers in use today. For example, the 80x86 family uses the Von Neumann architecture (VNA). A typical Von Neumann system has three major components: the central processing unit(or CPU), memory, and input/output(or I/O). The way a system designer combines these components impacts system performance (see Figure 3.1) 2018年12月31日

7 The Basic System Components
1. Arithmetic &logic unit (ALU) 2. Control unit 3. Memory 4. Input device 5. Output device 2018年12月31日

8 The Basic System Components
In VNA machines, like the 80x86 family, the CPU is where all the action takes place. All computations occur inside the CPU. Data and CPU instructions reside in memory until required by the CPU. To the CPU, most I/O devices look like memory because the CPU can store data to an output device and read data from an input device. The major difference between memory and I/O locations is the fact that I/O locations are generally associated with external devices in the outside world. 2018年12月31日

9 The System Bus The system bus connects the various components of a VNA machine. The 80x86 family has three major busses: the address bus(AB), the data bus(DB), and the control bus(CB). A bus is a collection of wires on which electrical signals pass between components in the system. These busses vary from processor to processor. However, each bus carries comparable information on all processors; e.g., the data bus may have a different implementation on the than on the 8088, but both carry data between the processor, I/O, and memory. 2018年12月31日

10 Data Bus Data Bus:The data bus on an 80x86 family processor transfers information between a particular memory location or I/O device (Port) and the CPU. The 80x86 processors use the data bus to transfer data between the various components in a computer system. The size of this bus varies widely in the 80x86 family. Indeed, this bus defines the “size” of the processor.????? 2018年12月31日

11 Data Bus 2018年12月31日

12 The Address Bus The data bus on an 80x86 family processor transfers information between a particular memory location or I/O device and the CPU. The only question is, “Which memory location or I/O device? ”, The address bus answers that question. To differentiate memory locations and I/O devices, the system designer assigns a unique memory address to each memory element and I/O device. 2018年12月31日

13 The Address Bus When the software wants to access some particular memory location or I/O device, it places the corresponding address on the address bus. Circuitry associated with the memory or I/O device recognizes this address and instructs the memory or I/O device to read the data from or place data on the data bus. In either case, all other memory locations ignore the request. Only the device whose address matches the value on the address bus responds. 2018年12月31日

14 The Address Bus With a single address line, a processor could create exactly two unique addresses: zero and one. With n address lines, the processor can provide 2n unique addresses (since there are 2n unique values in an n -bit binary number). Therefore, the number of bits on the address bus will determine the maximum number of addressable memory and I/O locations. The 8088 and 8086, for example, have 20 bit address busses. Therefore, they can access up to 1,048,576--Mega (or 220) memory locations. Larger address busses can access more memory. The 8088 and 8086, for example, suffer from an anemic address space – their address bus is too small. Later processors have larger address busses. giga mega Kilo 2018年12月31日

15 The Address Bus 2018年12月31日

16 The Control Bus The control bus is an electric collection of signals that control how the processor communicates with the rest of the system. Consider for a moment the data bus. The CPU sends data to memory and receives data from memory on the data bus. This prompts the question, “Is it sending or receiving?” There are two lines on the control bus, read and write , which specify the direction of data flow. Other signals include system clocks, interrupt lines, status lines, and so on. The exact make up of the control bus varies among processors in the 80x86 family. However, some control lines are common to all processors and are worth a brief mention. 2018年12月31日

17 2018年12月31日

18 2018年12月31日

19 The Control Bus The read and write control lines control the direction of data on the data bus. When both contain a logic one, the CPU and memory-I/O are not communicating with one another. If the read line is low (logic zero), the CPU is reading data from memory (that is, the system is transferring data from memory to the CPU). If the write line is low, the system transfers data from the CPU to memory. 2018年12月31日

20 The Memory Subsystem A typical 80x86 processor addresses a maximum of 2n different memory locations, where n is the number of bits on the address bus. As you’ve seen already, 80x86 processors have 20, 24, and 32 bit address busses (with 48 bits on the way). Of course, the first question you should ask is, “What exactly is a memory location?” The 80x86 supports byte addressable memory . Therefore, the basic memory unit is a byte. So with 20, 24, and 32 address lines, the 80x86 processors can address one megabyte, 16 megabytes, and four gigabytes of memory, respectively. 2018年12月31日

21 The Memory Subsystem The above discussion applies only when accessing a single byte in memory. So what happens when the processor accesses a word or a double word? Since memory consists of an array of bytes, how can we possibly deal with values larger than eight bits? Different computer systems have different solutions to this problem. The 80x86 family deals with this problem by storing the L.O. byte of a word at the address specified and the H.O. byte at the next location. Therefore, a word consumes two consecutive memory addresses (as you would expect, since a word consists of two bytes). Similarly, a double word consumes four consecutive memory locations. The address for the double word is the address of its L.O. byte. The remaining three bytes follow this L.O. byte, with the H.O. byte appearing at the address of the double word plus three (see Figure 3.4) Bytes, words, and double words may begin at any valid address in memory. We will soon see, however, that starting larger objects at an arbitrary address is not a good idea. 2018年12月31日

22 2018年12月31日

23 The 8088 and 80188 microprocessors have an eight bit data bus
The 8088 and microprocessors have an eight bit data bus. This means that the CPU can transfer eight bits of data at a time. Since each memory address corresponds to an eight bit byte, this turns out to be the most convenient arrangement (from the hardware perspective), see Figure 3.5. 2018年12月31日

24 2018年12月31日

25 The 8088 and can manipulate word and double word values, even with their eight bit data bus. However, this requires multiple memory operations because these processors can only move eight bits of data at once. To load a word requires two memory operations; to load a double word requires four memory operations. 2018年12月31日

26 The 8086, 80186, 80286, and 80386sx processors have a 16 bit data bus
The 8086, 80186, 80286, and 80386sx processors have a 16 bit data bus. This allows these processors to access twice as much memory in the same amount of time as their eight bit brethren. These processors organize memory into two banks : an “even” bank and an “odd” bank (see Figure 3.6). Figure 3.7 illustrates the connection to the CPU (D0-D7 denotes the L.O. byte of the data bus, D8-D15 denotes the H.O. byte of the data bus): 2018年12月31日

27 2018年12月31日

28 So what happens when the CPU accesses a word at an odd address, like the example given earlier? Well, the CPU cannot place the address 125 onto the address bus and read the 16 bits from memory. There are no odd addresses coming out of a 16 bit 80x86 CPU. The addresses are always even. So if you try to put 125 on the address bus, this will put 124 on to the address bus. Were you to read the 16 bits at this address, you would get the word at addresses 124 (L.O. byte) and 125 (H.O. byte) – not what you’d expect. Accessing a word at an odd address requires two memory operations. First the CPU must read the byte at address 125, then it needs to read the byte at address 126. Finally, it needs to swap the positions of these bytes internally since both entered the CPU on the wrong half of the data bus. 2018年12月31日

29 读偶地址单元中的字节;(b) 读奇地址单元中的字节; (c) 读偶地址单元中的字;(d) 读奇地址单元中的字
图3.14 从8086存储器的偶数和奇数地址读字节和字 读偶地址单元中的字节;(b) 读奇地址单元中的字节; (c) 读偶地址单元中的字;(d) 读奇地址单元中的字 2018年12月31日

30 The I/O Subsystem Besides the 20, 24, or 32 address lines which access memory, the 80x86 family provides a 16 bit I/O address bus. This gives the 80x86 CPUs two separate address spaces: one for memory and one for I/O operations. 2018年12月31日

31 The I/O Subsystem There are three limitations to the I/O subsystem on the IBM PC: first, the 80x86 CPUs require special instructions to access I/O devices; second, the designers of the IBM PC used the “best” I/O locations for their own purposes, forcing third party developers to use less accessible locations; third, 80x86 systems can address no more than 65,536 (216 ) I/O addresses. When you consider that a typical VGA display card requires over 128,000 different locations, you can see a problem with the size of I/O bus. 2018年12月31日

32 微处理器 至外部CB  (CPU) 标志寄存器 PLA ALU ID RA PC A IR 内部数据总线DB DR AR 外部AB
4001H E7H 4002H H 4003H A5H 4004H H 4005H H 存储器 地址 单元内容 ALU  内部数据总线DB 2018年12月31日

33 1.运算器 运算器又称算术逻辑单元ALU(Arithmetic Logic Unit),用来进行算术或逻辑运算以及移位循环等操作。参加运算的两个操作数一个来自累加器A(Accumulator),另一个来自内部数据总线,可以是数据缓冲寄存器DR(Data Register)中的内容,也可以是寄存器阵列RA(Register Array)中某个寄存器的内容。计算结果送回累加器A暂存。 2018年12月31日

34 2. 控制器 控制器又称控制单元CU(Control Unit),是全机的指挥控制中心。它负责把指令逐条从存储器中取出,经译码分析后向全机发出取数、执行、存数等控制命令,以保证正确完成程序所要求的功能。 (1) 指令寄存器IR(Instruction Register):用来存放从存储器取出的将要执行的指令码。当执行一条指令时,先把它从内存取到数据缓冲寄存器DR中,然后再传送到指令寄存器IR中。 2018年12月31日

35 (2) 指令译码器ID(Instruction Decoder):用来对指令寄存器IR中的指令操作码字段(指令中用来说明指令功能的字段)进行译码,以确定该指令应执行什么操作。
(3) 可编程逻辑阵列PLA(Programmable Logic Array):用来产生取指令和执行指令所需要的各种微操作控制信号,并经过控制总线CB送往有关部件,从而使计算机完成相应的操作。 2018年12月31日

36 1) 程序计数器PC(Program Counter)
3. 内部寄存器阵列 1) 程序计数器PC(Program Counter) 程序计数器有时也被称为指令指针IP(Instruction Pointer)。它被用来存放下一条要执行指令所在存储单元的地址。在程序开始执行前,必须将它的起始地址,即程序的第一条指令所在的存储单元地址送入PC。当执行指令时,CPU将自动修改PC内容,以便使其保持的总是将要执行的下一条指令的地址。由于大多数指令是按顺序执行的,所以修改的办法通常只是简单地对PC加1。但遇到跳转等改变程序执行顺序的指令时,后继指令的地址(即PC的内容)将从指令寄存器IR中的地址字段得到。 2018年12月31日

37 2) 地址寄存器AR(Address Register):
地址寄存器用来存放正要取出的指令的地址或操作数的地址。由于在内存单元和CPU之间存在着操作速度上的差异,所以必须使用地址寄存器来保持地址信息,直到内存的读/写操作完成为止。 在取指令时,PC中存放的指令地址送到AR,根据此地址从存储器中取出指令。 在取操作数时,将操作数地址通过内部数据总线送到AR,再根据此地址从存储器中取出操作数;在向存储器存入数据时,也要先将待写入数据的地址送到AR,再根据此地址向存储器写入数据。 2018年12月31日

38 3) 数据缓冲寄存器DR(Data Register)
数据缓冲寄存器用来暂时存放指令或数据。从存储器读出时,若读出的是指令,经DR暂存的指令经过内部数据总线送到指令寄存器IR;若读出的是数据,则通过内部数据总线送到运算器或有关的寄存器。同样,当向存储器写入数据时,也首先将其存放在数据缓冲寄存器DR中,然后再经数据总线送入存储器。 可以看出,数据缓冲寄存器 DR是CPU和内存、外部设备之间信息传送的中转站,用来补偿CPU和内存、外围设备之间在操作速度上存在的差异。 2018年12月31日

39 4) 指令寄存器IR(Instruction Register)
指令寄存器用来保存从存储器取出的将要执行的指令码,以便指令译码器对其操作码字段进行译码,产生执行该指令所需的微操作命令。 2018年12月31日

40 5) 累加器A(Accumulator) 累加器是使用最频繁的一个寄存器。在执行算术逻辑运算时,它用来存放一个操作数,而运算结果通常又放回累加器,其中原有信息随即被破坏。所以,顾名思义,累加器是用来暂时存放ALU运算结果的。显然,CPU中至少应有一个累加器。目前CPU中通常有很多个累加器。当使用多个累加器时,就变成了通用寄存器堆结构,其中任何一个既可存放目的操作数,也可以放源操作数。例如本书介绍的80x86系列CPU就采用了这种累加器结构。 2018年12月31日

41 6) 标志寄存器FLAGS(Flag Register)
标志寄存器有时也称为程序状态字PSW(Program Status Word)。它用来存放执行算术运算指令、逻辑运算指令或测试指令后建立的各种状态码内容以及对CPU操作进行控制的控制信息。标志位的具体设置及功能随微处理器型号的不同而不同。编写程序时,可以通过测试有关标志位的状态(0或1)来决定程序的流向。 2018年12月31日

42 这里介绍的存储器是指内存储器(又称为主存或内存)。它是微型计算机的存储和记忆装置,用来存放指令、原始数据、中间结果和最终结果。
存储器 这里介绍的存储器是指内存储器(又称为主存或内存)。它是微型计算机的存储和记忆装置,用来存放指令、原始数据、中间结果和最终结果。 在计算机内部,程序和数据都以二进制形式表示,8位二进制代码作为一个字节。为了便于对存储器进行访问,存储器通常被划分为许多单元,每个存储单元存放一个字节的二进制信息,每个存储单元分别赋予一个编号,称为地址。如图1.5所示,地址为4005H的存储单元中存放了一个八位二进制信息 B。 2018年12月31日

43 Kilo-(210) Mega-(220) Giga-(230) E7H 34H A5H F2H 38H …… 4001H 4002H
地址 指令或数据内容 图1.5 内存单元的地址和内容 Kilo-(210) Mega-(220) Giga-(230) 2018年12月31日

44 有关存储器的基本概念 1.位(Bit):二进制信息的最小单位(0或1)
2.字节(Byte):由8位二进制数组成,可以存放在一个存储单元中。是字的基本组成单位。 3.字(Word):计算机中作为一个整体来处理和运算的一组二进制数,是字节的整数倍。通常它与计算机内部的寄存器、算术逻辑单元、数据总线宽度相一致。每个字包括的位数称为计算机的字长,是计算机的重要性能指标。目前为了表示方便,常把一个字定义为16位,把一个双字定义为32位。 2018年12月31日

45 4.内存容量:内存中存储单元的总数。通常以字节为单位,1024(210)字节记作1KB,220字节记作1MB。
5.内存单元地址:为了能识别不同的单元,每个单元都赋予一个编号,这个编号称之为内存单元地址。显然,各内存单元的地址与该地址对应的单元中存放的内容是两个完全不同的概念,不可混淆。 Kilo-(210) Mega-(220) Giga-(230) 2018年12月31日

46 2.内存的操作 CPU对内存的操作有两种:读或写。读操作是CPU将内存单元的内容读入CPU内部,而写操作是CPU将其内部信息送到内存单元保存起来。显然,写操作的结果改变了被写内存单元的内容,是破坏性的,而读操作是非破坏性的,即该内存单元的内容在信息被读出之后仍保持原信息不变。 2018年12月31日

47 从内存单元读出信息的操作过程如图1.6(a)所示。假设将地址为90H的单元中的内容 B(BAH)读入CPU,其操作过程如下:(1)CPU经地址寄存器AR将要读取单元的地址信息 B(90H)送地址总线,经地址译码器选中90H单元。(2)CPU发出“读”控制信号。(3)在读控制信号的作用下,将90H单元中的内容 B(BAH)放到数据总线上,然后经数据缓冲寄存器DR送入CPU中的有关部件进行处理。 2018年12月31日

48 图1.6 内存读写操作过程示意图 (b) 内存写操作过程示意图 地 址 译 码 器 10101101B 00011010B
内容 地址 00H 01H FFH 90H AB B 来自CPU的写信号 B DB 来自CPU的读信号 (a) 内存读操作过程示意图 (b) 内存写操作过程示意图 图1.6 内存读写操作过程示意图 2018年12月31日

49 向内存单元写入信息的操作如图1.6(b)所示。假定要将数据0写入内存中地址为90H的单元,其操作过程如下:(1)写入单元的地址信息90H经地址寄存器AR送到地址总线上。(2)待写入的数据 B经数据缓冲寄存器DR放到数据总线上。(3)CPU发出“写”控制信号,在该信号的作用下将数据0写入90H单元。此时,90H单元中原有的内容 B就会被 B所替代。 2018年12月31日

50 随机读写存储器可被CPU随机地读写,它用于存放将要被CPU执行的用户程序、数据以及部分系统程序。断电后,其中存放的所有信息将丢失。
3. 内存的分类 按工作方式,内存可分为两大类:随机读写存储器RAM(Random Access Memory)和只读存储器ROM(Read Only Memory)。 随机读写存储器可被CPU随机地读写,它用于存放将要被CPU执行的用户程序、数据以及部分系统程序。断电后,其中存放的所有信息将丢失。 只读存储器中的信息只能被CPU读取,而不能由CPU任意地写入。断电后,其中的信息不会丢失。它用于存放永久性的程序和数据。如系统引导程序、监控程序、操作系统中的基本输入/输出管理程序(BIOS)等。 2018年12月31日

51 I/O接口是微型计算机与输入输出设备之间信息交换的桥梁。
I/O设备是微型计算机系统的重要组成部分。程序、数据及现场信息要通过输入设备输入给计算机。计算机的处理结果要通过输出设备输出,以便用户使用。常用的输入设备有:键盘、鼠标、数字化仪、扫描仪、A/D转换器等。常用的输出设备有显示器、打印机、绘图仪、D/A转换器等。 2018年12月31日

52 1.5 微型计算机的工作过程 基本概念 机器语言程序是计算机能够理解和直接执行的程序,其指令是用二进制代码表示和存储的。
1.5 微型计算机的工作过程 基本概念 机器语言程序是计算机能够理解和直接执行的程序,其指令是用二进制代码表示和存储的。 汇编语言程序是用助记符语言表示的程序,计算机不能直接“识别”,需要经过“汇编程序”把它转换为对应的机器语言程序后才能执行。 高级语言是不依赖于具体机型只面向过程的程序设计语言,由它所编写的高级语言程序,需经过编译程序或解释程序的编译或解释生成机器语言程序后才能执行。 2018年12月31日

53 1.5 微型计算机的工作过程 不论程序是用什么语言编写,都必须首先将其转换为计算机能直接识别和执行的机器语言程序,然后才能由CPU逐条读取并执行。表1.1为在某模型机上完成“6+5”操作所需的机器语言程序和汇编语言程序,假设该机器语言程序从内存中地址为0000H单元开始存放。 2018年12月31日

54 1.5 微型计算机的工作过程 表1.1 完成“6+5”操作所需的机器语言程序和汇编语言程序 内存单元地址 机器语言程序 汇编语言程序
1.5 微型计算机的工作过程 表1.1 完成“6+5”操作所需的机器语言程序和汇编语言程序 内存单元地址 机器语言程序 汇编语言程序 指令功能说明 0000H 0001H MOV A,06H 双字节指令。将数字6送累加器A 0002H 0003H ADD A,05H 双字节指令。将数字5与累加器A中的内容相加,结果存放在累加器A中。 0004H HLT 停机指令 2018年12月31日

55 1.5 微型计算机的工作过程 假定完成“6+5”操作所需的机器语言程序(表1.1所示)已由输入设备存放到内存中,如图1.7所示。下面进一步说明微机内部执行该程序的具体操作过程。 开始执行程序时,首先将第一条指令的首地址0000H送程序计数器PC,然后就进入第一条指令的取指阶段,其操作过程如图1.7所示。 2018年12月31日

56 图1.7 取第一条指令的操作过程示意图 2018年12月31日

57 同学们可参看本课程辅助教学网站 上的教学CAI课件,通过其动态演示 来进一步理解计算机读取和执行指 令的过程。 取第一条指令的操作过程
① 把PC内容送地址寄存器AR。 ② PC内容送入AR后,PC自动加1。 ③ 把地址寄存器AR的内容0000H放在地址总线上,并送至存储器系统的地址译码电路(图中未画出),经地址译码选中相应的0000H单元。 ④ CPU发出存储器读命令。 ⑤ 在读命令的控制下,把选中的0000H单元的内容即第一条指令的操作码B1H读到数据总线DB上。 ⑥ 把读出的内容B1H经数据总线送到数据缓冲寄存器DR ⑦ 指令译码。因为取出的是指令的操作码,故数据缓冲寄存器DR中的内容被送到指令寄存器IR,然后再送到指令译码器ID,经过译码,CPU“识别”出这个操作码代表的指令,于是经控制器发出执行该指令所需要的各种控制命令。 同学们可参看本课程辅助教学网站 上的教学CAI课件,通过其动态演示 来进一步理解计算机读取和执行指 令的过程。 2018年12月31日

58 ② PC内容送入AR后,PC自动加1,即由0001H变为0002H。注意,此时AR的内容0001H并没有变化。
第一条指令的执行过程 接着进入第一条指令的执行阶段。经过对操作码B1H的译码,CPU知道这是一条把下一单元中的操作数送累加器A的双字节指令,所以,执行该指令的操作就是从下一个存储单元中取出指令第二个字节中的操作数06H,并送入累加器A。该指令的执行过程如图1.8所示。 ① 把PC内容01H送地址寄存器AR。 ② PC内容送入AR后,PC自动加1,即由0001H变为0002H。注意,此时AR的内容0001H并没有变化。 2018年12月31日

59 ③ 把地址寄存器AR的内容0001H放到地址总线上,并送至存储器系统的地址译码电路,经地址译码选中相应的0001H单元。
④ CPU发出存储器读命令。 ⑤ 在读命令的控制下,把选中的0001H单元的内容06H放到数据总线DB上。 ⑥ 把读出的内容06H经数据总线送到数据缓冲寄存器DR。 ⑦ 数据缓冲寄存器DR的内容经内部数据总线送到累加器A。于是,第一条指令执行完毕,操作数06H被送到累加器A中。 2018年12月31日


Download ppt "Chapter One Introduction of Microcomputer system (2)"

Similar presentations


Ads by Google