计算机组成:实现计算机体系结构所体现的属性。包括了硬件细节
计算机体系结构:计算机程序员所见的计算机系统属性。包括指令集,存储寻址
例如,指令系统属于计算机体系结构,但指令系统的实现(取指令,分析指令,去操作数等)属于计算机组成。
区分这两个概念很重要,嵌入式程序员需要理解计算机体系结构(例如指令集),也需要理解计算机组成(例如寄存器个数,用途)。
计算机组成涉及:总线,存储器,IO,CPU,控制单元(CU)部件
关于计算机组成的理论进阶,推荐《Fundamentals of Digital logic and microcomputer Design 5 edition》:
1-5章:理论基础
6-8章:微型计算机设计
9-11章:Intel和摩托的微处理器
几个重要概念
1.Microcode translates machine instructions into sequences of detailed circuit-level operations.
2.Microprogramming is typically used by the microprocessor designer to program the logic performed by the control unit。A microprogram is stored in the control unit.
3. Writing microcode is often called microprogramming and the microcode in a particular processor implementation is sometimes called a microprogram .
4.Some hardware vendors, especially IBM , use the term as a synonym for firmware , so that all code in a device, whether microcode or machine code , is termed microcode
5.Machine code or machine language is a system of instructions and data executed directly by a computer's central processing unit.(Machine code 由Microcode实现)
6.An assembly language program is stored in the main memory. The assembly language program is called a macroprogram.
7.A macro instruction is a line of computer program coding that results in one or more lines of program coding in the target programming language.
8.Machine code is then stored as an executable file (i.e., a ready-to-run program) and can be executed (i.e., run) by the operating system any time it is instructed to do so by another program or by a user.Machine code is extremely difficult for humans to read because it consists merely of patterns of bits (i.e., zeros and ones).(编译器,链接器,汇编器)
9.如何执行程序:Typically, computer programs are stored in non-volatile memory until requested either directly or indirectly to be executed by the computer user. Upon such a request, the program is loaded into random access memory, by a computer program called an operating system, where it can be accessed directly by the central processor. The central processor then executes ("runs") the program, instruction by instruction, until termination. A program in execution is called a process.[6] Termination is either by normal self-termination or by error — software or hardware error.
总结:整体的层次是,源代码(例如C++) -> 机器码 -> 被操作系统调入内存 ->CPU执行其中的指令(由microcode实现)。