Upload
-
View
370
Download
7
Embed Size (px)
DESCRIPTION
Citation preview
Good morning class
week2
EC305Lecture 2: Компьютерийн бүтцийн задаргаа болон үндсэн командын
процесс
• Компьютерийн задаргаа
• Control and Datapaths дахь ерөнхий командын процедур
• ISA
• Control Unit үндсэн функцууд -- Read and Write Selects
Компьютерийг бүтцийн хувьд Von Newmann architecture :
1. Процессор
2. Санах байгууламж
3. Оролт гаралт
4. интерфейсүүд
Processor
Connections
I/O Devices
Mem
ory
Процессор нь үндсэн хэсгийн нэг бөгөөд = Datapath + Control
Datapath нь санах байгууламжийн дээд хэсэгт байрлах ба ж нь зарим тохиолдолд cache-уудаар дамжих нь бий. Түүнчлэн зарим нь санах байгууламжийг бүхэлд нь агуулдаг.
Datapath
(Processing ofdata accordingto instructions))
ControlUnit
Control Signals
StatusSignals
Most processors consist of a datapath and a control unit, with a large part of the control unit dedicated to regulating the interaction between the datapath and memory.
Өгөгдлийн хэсэгт хамаарагдах нэгжүүд
• Багц өгөгдлийн шугам
– Багц 16битийн сигнал дамжуулалтын хэсэг
– Өгөгдлийн оролтыг хянах 3 төлөвт төхөөрөмжүүд буфер мультф-р
• Багц өгөгдлийн шугамд сигнал байгааг тогтоох
• Нэг удаа зөвхөн нэг багц 16-bit) сигнал тавигдана.
• Хяналтын хэсэгт багц өгөгдлийн шугамд ямар сигнал дамжихийг шийднэ.
– Өгөгдлийг унших хэсэг
үүнд хяналтын хэсэгт өгөгдөл бичих зөвшөөрөл тавигдсан тохиолдолд регисторууд өгөгдлийг уншина.
• Арифметик логик хэсэг– Оролт : (IR) ийн тэмдэгтийн өргөтгөлийн битүүд эсвэл register file н гаралт – Output: өгөгдлийн багц ; used by…
• Нөхцөлд тэмдэгтийн регисторууд • Өгөгдлийн регистор • Санах байгууламж болон оролт гаралтын регисторууд
• Өгөгдлийн регистор– Өгөгдөл унших хоёр хаяглалт, нэг өгөгдөл бичих хаяглалт (тус бүр нь 3
bits)– Оролт : өгөгдлийн багцаас 16 битийн сигнал
• ALU-н үйлдлийн үр дүн эсвэл санах ой (I/O) д уншигдсан сигнал– Гаралт : 16-битийн хоёр сигналын гаралт
• Гаралт нь ALU, санах ойн хаягт • ALU хэсэгт дуудагдах командуудыг дамжуулна.
• Нөхцөлд логик
– ALU ээс ирэх сигналаас хамаарч N, Z, P төрлийн сигналуудыг тавина.
– сигналаар хяналтын хэсэгт N,Z,P сигнал ирснээр регисторууд уншигдана.
• Хяналтын хэсэг
– Уншигдах команд бүрийн төлөв нь дараах нөхцөлийг тогтооно үүнд :
• Өгөгдлийн шугам ?
• Өгөгдөл унших регистор ?
• ALU д ямар үйлдэл хэрэгжих ?
Lets Look at Instruction Processing next..
Өгөгдөл боловсруулалттай холбоотой бүхий л үйлдлүүдийн гүйцэтгэл бүхий ALU хэсгийн нэгдлийг Datapath гэж ойлгоно. Энэ нь үндсэн дараах хэсгүүдээс тогтдог:
• Data Memory• Register File • ALU Data Memory
Memory Interface (Buses + Regs)
Register File
ALU
O/P Reg.
Datapath Нэгж хугацаанд процессорт хэрэгжигдэх өгөгдөл түүгээр дамжих өгөгдөл тэдгээрийн төлөвт болон үр дүнгийн элементүүдийн нэгдлийг өгөгдлийн багц гэнэ.
Data Path
Filled arrow = info to be processed.
Unfilled arrow= control signal.
The data path of a computer is all the logic used to process information
CONTROL
UNIT
командууд
• Процессорын үндсэн хэсгийн үйлдлүүд . • бүтэц
– Opcode: operation to be performed– Operands: data/locations to be used for operation
• Encoded as a sequence of bits (just like data!)– Sometimes have a fixed length (e.g., 16 or 32 bits)– Atomic: operation is either executed completely, or not at all
computer science,-m instruction гэдэг нь процессорын нэг үйлдлийг хэлэх бөгөөд энэ нь командын нэгдсэн бүтцээр тодорхойлогдоно. Өргөн утгаар
тодорхойлбол bytecode бүхий гүйцэтгэгдэх програмын элементүүд бүрийн тайлбар code. Харин командын нэгдэл нь процессор эсвэл virtual machine,
interpreter зэргийн гүйцэтгэх бүхий л командуудын жагсаалт юм.
Компьютерийн командуудад нь :• Arithmetic үйлдлийн : add and subtract • Logic үйлдлийн : and, or, and not • Өгөгдлийн move, input, output, load, and store • Control flow буюу хяналтын сигналын goto, if ... goto,
call, and return.
• instruction set, болон instruction set architecture (ISA) нь өгөгдлийн төрлүүд, командууд, регисторууд,хаяглалтын хэлбэрүүд, санах ойн бүтэц, тасалдалт зэрэг болон гадаад өргөтгөлийн шийдэл зэрэг програмтай холбоотой компьютерийн бүтцийн нэг хэсэг юм.
• Machine language is built up from discrete statements or instructions. On the processing architecture, a given instruction may specify:
• Particular registers for arithmetic, addressing, or control functions
• Particular memory locations or offsets • Particular addressing modes used to interpret
the operands • More complex operations are built up by
combining these simple instructions, which (in a von Neumann machine) are executed sequentially, or as otherwise directed by control flow instructions.
• Some operations available in most instruction sets include:
• moving
• computing
• affecting program flow
Some examples of "complex" instructions include:• saving many registers on the stack at once • moving large blocks of memory • complex and/or floating-point arithmetic (sine,
cosine, square root, etc.) • performing an atomic test-and-set instruction • instructions that combine ALU with an operand
from memory rather than a register
Time to Complete One Instruction
• Команд тус бүрийн гүйцэтгэлийн сигналын өмнөх болон хойд фронтын давталтын тоо. It takes fixed number of clock ticks (repetition of rising or falling edge) to execute each instruction Сигнал хоорондын нэг гүйцэтгэлийн үе хоорондыг clock
cycle Тиймээс командын гүйцэтгэл бүр нэгж clock cycle-р
хэмжигдэнэ
• нэгж командын сигналын өмнөх фронтын фазын дарааллыг нэг clock
• So what determines the time between ticks i.e. the length of the clock cycle?
Clocking Methodology
• Defines when signals can be read and when they can be written
• It is important to specify the timing of reads and writes because, if a value is written at the same time it is read, the value of read could be old, new or mix of both
• All values are stored on clock edge (edge-triggered) i.e. within a defined interval of time (length of the clock cycle)
• In a processor, since only memory elements can store values this means that Any collection of combinational logic must have its inputs coming
from a set of memory elements and its outputs written into a set of memory elements
• The length of the clock cycle is determined as follows:
• The time necessary for the signals to reach memory element 2 defines the length of the clock cycle i.e. minimum clock cycle time must be at least as great as the
maximum propagation delay of the circuit
Instruction Processing
DECODE instructionDECODE instruction
EVALUATE ADDRESSEVALUATE ADDRESS
FETCH OPERANDSFETCH OPERANDS
EXECUTE operationEXECUTE operation
STORE resultSTORE result
FETCH instruction from mem.FETCH instruction from mem.
Instruction Processing: FETCH
• Idea– Put next instruction in IR & increment PC
• Steps– Load contents of PC into MAR– Increment PC– Send “read” signal to memory– Read contents of MDR, store in IR
EAEA
OPOP
EXEX
SS
FF
DD
FETCH
Load PC into MAR (inc PC)
Control
Data
CONTROL
UNIT
FETCH
Load PC into MAR
Read Memory
Control
Data
CONTROL
UNIT
FETCH
Load PC into MAR
Read Memory
Copy MDR into IR
Control
Data
CONTROL
UNIT
Instruction Processing: DECODE
• Identify opcode– In LC-3, always first four bits of instruction– 4-to-16 decoder asserts control line corresponding
to desired opcode
• Identify operands from the remaining bits– Depends on opcode
e.g., for LDR, last six bits give offsete.g., for ADD, last three bits name source operand #2
EAEA
OPOP
EXEX
SS
FF
DD
DECODE
CONTROL
UNITDecoding usually a part of the Control Unit but can be seperate
Instruction Processing: EVALUATE ADDRESS
• Compute address– For loads and stores – For control-flow instructions
• Examples– Add offset to base register (as in LDR)– Add offset to PC (as in LD and BR)
EAEA
OPOP
EXEX
SS
FF
DD
EVALUATE ADDRESS
Load/Store
CONTROL
UNIT
Instruction Processing: FETCH OPERANDS
• Get source operands for operation
• Examples– Read data from register file (ADD)– Load data from memory (LDR)
EAEA
OPOP
EXEX
SS
FF
DD
FETCH OPERANDS
ADD
CONTROL
UNIT
FETCH OPERANDS
LDR
CONTROL
UNIT
Instruction Processing: EXECUTE
• Actually perform operation
• Examples– Send operands to ALU and assert ADD signal– Do nothing (e.g., for loads and stores)
EAEA
OPOP
EXEX
SS
FF
DD
EXECUTE
ADD
CONTROL
UNIT
Instruction Processing: STORE
• Write results to destination– Register or memory
• Examples– Result of ADD is placed in destination reg.– Result of load instruction placed in destination reg.– For store instruction, place data in memory
• Set MDR
• Assert WRITE signal to memory
EAEA
OPOP
EXEX
SS
FF
DD
STORE
ADD
CONTROL
UNIT
STORE
LDR
CONTROL
UNIT
STORE
STORESet MDR
CONTROL
UNIT
STORE
STORESet MDRAssert “write”
CONTROL
UNIT
Outline of the Book (2)
• CPU Structure and Function
• Reduced Instruction Set Computers
• Superscalar Processors
• Control Unit Operation
• Microprogrammed Control
• Multiprocessors and Vector Processing
• Digital Logic (Appendix)
Internet Resources- Web site for book
• http://WilliamStallings.com/COA6e.html– links to sites of interest– links to sites for courses that use the book– errata list for book– information on other books by W. Stallings
• http://WilliamStallings.com/StudentSupport.html– Math– How-to– Research resources– Misc
Internet Resources- Web sites to look for
• WWW Computer Architecture Home Page• CPU Info Center• ACM Special Interest Group on Computer
Architecture• IEEE Technical Committee on Computer
Architecture• Intel Technology Journal• Manufacturer’s sites
– Intel, IBM, etc.
Internet Resources - Usenet News Groups
• comp.arch
• comp.arch.arithmetic
• comp.arch.storage
• comp.parallel