1. 程式人生 > >指令集架構、微架構、處理器架構、CPU架構

指令集架構、微架構、處理器架構、CPU架構

  前兩天看書碰到了“CPU架構”這個詞,腦子裡感覺有點模糊不懂。查閱相關資料後又陸續碰到了“指令集架構”、“微架構”、“處理器架構”等詞,於是就更加懵逼了。接著又陸陸續續的看了些資料,同時結合自己的一些理解,給出這些詞的解釋,也方便以後查閱。以下關於“指令集架構”和“微架構”的英文解釋摘錄於維基百科(參考資料1和2):
  
1. 指令集架構
 An instruction set architecture (ISA, 指令集架構) is an abstract model of a computer. It is also referred to as architecture or computer architecture. A realization of an ISA is called an implementation. An ISA permits multiple implementations that may vary in performance, physical size, and monetary cost (among other things); because the ISA serves as the interface between software and hardware. Software that has been written for an ISA can run on different implementations of the same ISA. This has enabled binary compatibility between different generations of computers to be easily achieved, and the development of computer families.
 An instruction set architecture is distinguished from a microarchitecture(微架構)

, which is the set of processor design techniques used, in a particular processor, to implement the instruction set. Processors with different microarchitectures can share a common instruction set. For example, the Intel Pentium and the Advanced Micro Devices Athlon implement nearly identical versions of the x86 instruction set
, but have radically different internal designs.
 
2. 微架構
 In electronics engineering and computer engineering, microarchitecture(微架構), also called computer organization and sometimes abbreviated as µarch or uarch, is the way a given instruction set architecture (ISA, 指令集架構), or the ways the PCB is pathed in the Processing unit, is implemented in a particular processor. A given ISA may be implemented with different microarchitectures; Implementations may vary due to different goals of a given design or due to shifts in technology.

  根據以上維基百科關於“指令集架構”和“微架構”的解釋以及我自己的理解。我對指令集架構的理解是:指令集架構就是規定了一堆指令,比如加、移位指令啥的。加指令可以完成加法操作,移位指令可以完成移位的操作。由於整個計算機系統是硬體和軟體的集合,最後具體的指令在計算機硬體上就只是一串的二進位制碼對應著相應的高電平與低電平。假設加指令對應著二進位制碼:10010010. 在規定了指令集架構之後,還得去具體地去實現該指令集。對於加指令對應的二進位制碼:10010010. 具體的實現就是怎麼去設計CPU裡面的硬體電路啥的使得CPU收到這一串二進位制碼之後就做出加指令相應的操作,這就是微架構。按我的理解微架構、處理器架構、CPU架構是指的一個概念,但是有的資料好像把處理器架構和CPU架構歸類到了指令集架構,這裡不知道我說的對不對。
  對於同一個指令集架構可以有不同的微架構,比如 Intel Pentium 和 Advanced Micro Devices Athlon 都採用的是x86指令集,但是它們的微架構卻完全不同。指令集架構是計算機的一種抽象模型。指令集架構是具體硬體和軟體之間的介面。針對同一指令集架構編寫的軟體可以執行在採用該指令集架構而微架構不同的機器上。由於指令集架構中的指令較多,如果直接使用機器碼(也就是指令對應的二進位制碼)來編寫軟體會比較困難。這樣就出現瞭如c++等高階語言,經過高階語言編寫完程式之後再經過編譯器軟體將高階語言編譯成對應的機器碼就可以在機器上執行了,因為實際的硬體只認識機器碼。
  參考資料3、4和5也是對指令集架構和微架構區別等的相關解釋。參考資料6對常見的指令集架構做了相關解釋和列表。

參考資料: