【文章內(nèi)容簡介】
0 P259 Figure – 21 – Processor Y86 Program Structure ? Program starts at address 0 ? Must set up stack ? Make sure don’t overwrite code! ? Must initialize data ? Can use symbolic names irmovl Stack,%esp Set up stack rrmovl %esp,%ebp Set up frame irmovl List,%edx pushl %edx Push argument call len2 Call Function halt Halt .align 4 List: List of elements .long 5043 .long 6125 .long 7395 .long 0 Function len2: . . . Allocate space for stack .pos 0x100 Stack: – 22 – Processor Assembling Y86 Program ? Generates “object code” file ? Actually looks like disassembler output unix yas 0x000: 308400010000 | irmovl Stack,%esp Set up stack 0x006: 2045 | rrmovl %esp,%ebp Set up frame 0x008: 308218000000 | irmovl List,%edx 0x00e: a028 | pushl %edx Push argument 0x010: 8028000000 | call len2 Call Function 0x015: 10 | halt Halt 0x018: | .align 4 0x018: | List: List of elements 0x018: b3130000 | .long 5043 0x01c: ed170000 | .long 6125 0x020: e31c0000 | .long 7395 0x024: 00000000 | .long 0 – 23 – Processor Simulating Y86 Program ? Instruction set simulator ? Computes effect of each instruction on processor state ? Prints changes in state from original unix yis Stopped in 41 steps at PC = 0x16. Exception 39。HLT39。, CC Z=1 S=0 O=0 Changes to registers: %eax: 0x00000000 0x00000003 %ecx: 0x00000000 0x00000003 %edx: 0x00000000 0x00000028 %esp: 0x00000000 0x000000fc %ebp: 0x00000000 0x00000100 %esi: 0x00000000 0x00000004 Changes to memory: 0x00f4: 0x00000000 0x00000100 0x00f8: 0x00000000 0x00000015 0x00fc: 0x00000000 0x00000018 – 24 – Processor Summary Y86 Instruction Set Architecture ? Similar state and instructions as IA32 ? Simpler encodings ? Somewhere between CISC and RISC How Important is ISA Design? ? Less now than before ? With enough hardware, can make almost anything go fast ? Intel is moving away from IA32 ? Does not allow enough parallel execution ? Introduced IA64 187。 64bit word sizes (overe address space limitations) 187。 Radically different style of instruction set with explicit parallelism 187。 Requires sophisticated pilers Radically: 根本上 – 25 – Processor Logic Design Digital circuit ? What is digital circuit? ? Know what a CPU will base on? Hardware Control Language (HCL) ? A simple and functional language to describe our CPU implementation ? Syntax like C – 26 – Processor Category of Circuit Analog Circuit ? Use all the range of Signal ? Most part is amplifier ? Hard to model and automatic design ? Use transistor and capacitance as basis ? We will not discuss it here Digital Circuit ? Has only two values, 0 and 1 ? Easy to model and design ? Use true table and other tools to analyze ? Use gate as the basis ? The voltage of 1 is differ in different kind circuit. ? . TTL circuit using 5 voltage as 1 Amplifier: 放大器 Transistor: 晶體管 Capacitance: 電容 – 27 – Processor Digital Signals ? Use voltage thresholds to extract discrete values from continuous signal ? Simplest version: 1bit signal ? Either high range (1) or low range (0) ? With guard range between them ? Not strongly affected by noise or low quality circuit elements ? Can make circuits simple, small, and fast Voltage Time 0 1 0 – 28 – Processo