Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
CPU-ны оңтайландыру бөлімі
CPU optimization unit
Бағдарламалық жадтан нұсқаулық опкодтарды орындауға қажеттіліктен бұрын алып қою алдын ала жүктеу деп аталады, және ол алдын ала жүктеу кіріс тізбегін (PIQ) пайдалану арқылы жүзеге асырылады. Алдын ала жүктелген нұсқаулар тізбекке сақталады. Опкодтарды орындау қажеттілігінен бұрын алып қою процессордың жалпы тиімділігін арттырып, оның жылдамдығын жоғарылатады. Процессор енді келесі нұсқаулық опкодты алу үшін жадқа қол жеткізу операцияларының аяқталуын күтуге қажеттілігі жоқ. Бұл архитектура Intel 8086 микропроцессорында кеңінен қолданылған.
Fetching the instruction opcodes from program memory well in advance is known as prefetching and it is served by using a prefetch input queue (PIQ). The pre fetched instructions are stored in a queue. The fetching of opcodes well in advance, prior to their need for execution, increases the overall efficiency of the processor boosting its speed. The processor no longer has to wait for the memory access operations for the subsequent instruction opcode to complete. This architecture was prominently used in the Intel 8086 microprocessor.
Кіріспе
Құбырлау (Pipelining) жылдам және тиімді есептеу қажеттілігінен туындап, 1960-шы жылдары есептеу архитектурасының жобалауында маңызды рөл атқара бастады. Құбырлау – бұл кең ұғым, және қазіргі заманғы процессорлар нұсқауларын орындамас бұрын бірнеше тактылік циклдар алдын ала жүктейді. Бұл, жадтан машиналық кодты алдын ала жүктеу арқылы, алдын ала енгізу кезегіне (prefetch input queue - PIQ) орналастыру арқылы іске асырылады. Бұл әрекет тек фон Нейман архитектурасындағы (Гарвард архитектурасы емес) компьютерлерге қатысты, олар өздігінен өзгеретін кодты орындай алады және қандай да бір құбырлау жүйесіне ие. Көбінесе, қазіргі заманғы жоғары өнімділіктегі компьютерлер осы үш талапты қанағаттандырады. Әдетте, PIQ-тің алдын ала жүктеуі CPU-ның бағдарламалау моделінен жасырылған. Дегенмен, PIQ-тің мінез-құлқы бағдарламашыға көрінетін және ескеруді қажет ететін жағдайлар бар. Мысалы, x86 процессоры нақты режимнен қорғалған режимге немесе керісінше аусқанда, PIQ-ты тазалау қажет, әйтпесе процессор машиналық кодты соңғы режимде жазылғандай түсіндіре береді. Егер PIQ тазаланбаса, процессор кодты дұрыс аудармауы және жарамсыз нұсқау қатесін тудыруы мүмкін. Өздігінен өзгеретін кодты орындау кезінде, процессордың ағымдағы орындалу орнының алдындағы кодтың өзгеруі процессордың кодты түсіндіруіне әсер етпеуі мүмкін, себебі ол PIQ-қа бұрыннан жүктелген. Ол жаңа және өзгертілген нұсқаудың орнына, RAM және/немесе кэште сақталған ескі нұсқауын орындайды. PIQ-тің осы ерекшелігі кодтың эмуляторда орындалып жатыр ма, әлде нақты CPU-дың аппараттық құралында ма, екенін анықтау үшін пайдаланылуы мүмкін. Көптеген эмуляторлар мұндай мінез-құлықты симуляцияламайды. Егер PIQ-тің көлемі нөлге тең болса (кодтағы өзгерістер процессордың күйіне дереу әсер етеді), онда код эмуляторда орындалуда немесе процессор PIQ-қа жүктелген адрестерге жазу кезінде PIQ-ты жарамсыз деп таниды деген қорытынды жасауға болады.
Pipelining was brought to the forefront of computing architecture design during the 1960s due to the need for faster and more efficient computing. Pipelining is the broader concept and most modern processors load their instructions some clock cycles before they execute them. This is achieved by pre loading machine code from memory into a prefetch input queue. This behavior only applies to von Neumann computers (that is, not Harvard architecture computers) that can run self modifying code and have some sort of instruction pipelining. Nearly all modern high performance computers fulfill these three requirements. Usually, the prefetching behavior of the PIQ is invisible to the programming model of the CPU. However, there are some circumstances where the behavior of PIQ is visible, and needs to be taken into account by the programmer. When an x86 processor changes mode from real mode to protected mode and vice versa, the PIQ has to be flushed, or else the CPU will continue to translate the machine code as if it were written in its last mode. If the PIQ is not flushed, the processor might translate its codes wrong and generate an invalid instruction exception. When executing self modifying code, a change in the processor code immediately in front of the current location of execution might not change how the processor interprets the code, as it is already loaded into its PIQ. It simply executes its old copy already loaded in the PIQ instead of the new and altered version of the code in its RAM and/or cache. This behavior of the PIQ can be used to determine if code is being executed inside an emulator or directly on the hardware of a real CPU. Most emulators will probably never simulate this behavior. If the PIQ size is zero (changes in the code always affect the state of the processor immediately), it can be deduced that either the code is being executed in an emulator or the processor invalidates the PIQ upon writes to addresses loaded in the PIQ.
Тапсырмалар кезегі
Процессор бағдарламаны жадтан нұсқауларды алып, оларды орындау арқылы іске асырады. Әдетте процессордың орындау жылдамдығы жадқа қол жеткізу жылдамдығынан әлдеқайда жоғары болады. Нұсқаулар кезегі процессор ағымдағы нұсқауды орындап жатқанда, келесі нұсқауларды жеке буферде алдын ала алу үшін қолданылады. Төрт сатылы құбырлы жүйеде нұсқаулардың орындалу жылдамдығы тізбекті орындалудан төрт есеге дейін артуы мүмкін. Процессордың әдетте нұсқауларды алу және орындау үшін екі бөлек бөлімі болады. Құбырлы жүйе архитектурасын іске асыру автобус интерфейсі бөлімі мен орындау бөлімі тәуелсіз болған жағдайда ғана мүмкін. Орындау бөлімі деректер мен адрес шиналарын пайдалануды қажет етпейтін нұсқауды декодтау немесе орындау кезінде, автобус интерфейсі бөлімі жадтан нұсқау опкодтарын алады. Бұл процесс адресті жіберуден, опкодты оқудан, содан кейін декодтаудан және орындаудан әлдеқайда жылдам. Ағымдағы нұсқау декодталған немесе орындалған кезде келесі нұсқауды алу құбырлы жүйе деп аталады. 8086 процессорында алты байттық алдын ала алу нұсқаулар құбыры бар, ал 8088-де төрт байттық алдын ала алу бар. Орындау бөлімі ағымдағы нұсқауды орындағанда, автобус интерфейсі бөлімі жадтан алты (немесе төрт) байтқа дейін опкодты алдын ала оқиды. Кезек ұзындығы модельдеу зерттеулерінің нәтижесінде таңдалды. Орындау бөлімі тармақталу нұсқауын, яғни секіру немесе шақыру нұсқауын кездестіргенде қателік туындайды. Бұл жағдайда, бүкіл кезек жойылып, нұсқау көрсеткіші көрсеткен мазмұн жадтан алынуы керек.
The processor executes a program by fetching the instructions from memory and executing them. Usually the processor execution speed is much faster than the memory access speed. Instruction queue is used to prefetch the next instructions in a separate buffer while the processor is executing the current instruction. With a four stage pipeline, the rate at which instructions are executed can be up to four times that of sequential execution. The processor usually has two separate units for fetching the instructions and for executing the instructions. The implementation of a pipeline architecture is possible only if the bus interface unit and the execution unit are independent. While the execution unit is decoding or executing an instruction which does not require the use of the data and address buses, the bus interface unit fetches instruction opcodes from the memory. This process is much faster than sending out an address, reading the opcode and then decoding and executing it. Fetching the next instruction while the current instruction is being decoded or executed is called pipelining. The 8086 processor has a six byte prefetch instruction pipeline, while the 8088 has a four byte prefetch. As the Execution Unit is executing the current instruction, the bus interface unit reads up to six (or four) bytes of opcodes in advance from the memory. The queue lengths were chosen based on simulation studies. An exception is encountered when the execution unit encounters a branch instruction i. e. either a jump or a call instruction. In this case, the entire queue must be dumped and the contents pointed to by the instruction pointer must be fetched from memory.
Кемшіліктері
Инструкция кезегін алдын ала жүктеу алгоритмін қолданатын процессорлар техникалық тұрғыдан өте жетілген. Мұндай процессорлардың CPU жобалау деңгейінің күрделілігі, қарапайым процессорларға қарағанда әлдеқайда жоғары. Бұл, ең алдымен, екі жеке блокты – ББЖ (Бұйрық беру блогы) мен ЕО (Есептеу блогын) жеке-жеке іске асыру қажеттілігіне байланысты. Бұл чиптердің күрделілігі артаған сайын, олардың құны да артады. Бұл процессорлар алдын ала жүктеу кезегі жоқ аналогтарына қарағанда салыстырмалы түрде қымбат. Дегенмен, бұл кемшіліктер процессордың жұмыс істеу уақытының жақсаруымен толық өтемеленеді. 8086 процессорында алдын ала жүктеу нұсқаулар кезегі енгізілгеннен кейін, барлық келесі процессорлар осы мүмкіндікті қолдана бастады.
Processors implementing the instruction queue prefetch algorithm are rather technically advanced. The CPU design level complexity of the such processors is much higher than for regular processors. This is primarily because of the need to implement two separate units, the BIU and EU, operating separately. As the complexity of these chips increases, the cost also increases. These processors are relatively costlier than their counterparts without the prefetch input queue. However, these disadvantages are greatly offset by the improvement in processor execution time. After the introduction of prefetch instruction queue in the 8086 processor, all successive processors have incorporated this feature.