Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and...
-
Upload
alan-cameron -
Category
Documents
-
view
214 -
download
0
Transcript of Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and...
![Page 1: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/1.jpg)
Dale & Lewis Chapter 5Computing components
![Page 2: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/2.jpg)
von Neumann architecture
• Memory holds both data and instructions (interchangeable)• Central Processing Unit (CPU)
− Arithmetic/Logic Unit (ALU)− Control Unit
• Input, output units
![Page 3: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/3.jpg)
Fetch-Decode-Execute cycle
• Fetch next instruction (program counter (PC) determines from where)
• Decode instruction (extract op code, operand address)• Get data, if needed (operand address determines from
where)• Execute instruction• Advance PC
• Faster cycles faster computing• Computers can reach 3.5 billion instructions per second
![Page 4: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/4.jpg)
Let’s design a computer• Generic CPU with registers
− Program counter (PC) – 5 bits (size of addresses)− Instruction register (IR) – 8 bits (op code + address)− Memory Address Register (MAR) – 5 bits Main Memory− Memory Data Register (MDR) – 8 bits (byte addressable)− Accumulator (A or Acc) – 8 bits
![Page 5: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/5.jpg)
Instructions
• Instruction format: 3-bit op code, 5-bit address• Instructions and their op codes
op code Instruction
000 HALT (HLT)
001 LOAD (LDA)
010 STORE (STA)
011 ADD (ADD)
100 SUBTRACT (SUB)
101 BRANCH (BR)
110 BRANCH ON ZERO (BRZ)
111 BRANCH ON POSITIVE (BRP)
![Page 6: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/6.jpg)
Types of instructions
• Data movement− Move data between memory and CPU− Move data between different memory locations− Input, output
• Arithmetic and logic operations− Integer arithmetic− Comparing two quantities− Shifting or rotating bits in a quantity− Testing, comparing and converting bits
• Program control− Starting a program− Halting a program− Skipping to another location− Testing data to decide whether to skip to another instruction
![Page 7: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/7.jpg)
Instructions• LOAD instruction (LDA)
− PC MAR− MDR IR− IR [address] MAR− MDR A− PC + 1 PC
• ADD instruction (ADD)− PC MAR− MDR IR− IR [address] MAR− A + MDR A− PC + 1 PC
• STORE instruction (STA)− PC MAR− MDR IR− A MDR− IR [address] MAR− PC + 1 PC
• HALT instruction (HLT)− PC MAR− MDR IR− stop
FETCH – DECODE – GET DATA – EXECUTE
![Page 8: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/8.jpg)
FETCH
• Address of next instruction is transferred from PC to MAR and the instruction is located in the memory
![Page 9: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/9.jpg)
FETCH
• Instruction is copied from memory to the MDR
![Page 10: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/10.jpg)
DECODE
• Decode the instruction
![Page 11: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/11.jpg)
EXECUTE
• Execute the instruction – control unit sends signals to appropriate devices to carry out execution of the instruction
![Page 12: Dale & Lewis Chapter 5 Computing components. von Neumann architecture Memory holds both data and instructions (interchangeable) Central Processing Unit.](https://reader036.fdocuments.in/reader036/viewer/2022062519/5697bff91a28abf838cc0046/html5/thumbnails/12.jpg)
A small computer program
LOAD A 00100 00101000
ADD B 00101 01101001
STORE C 00110 01001010
HLT 00111 00000000
A DATA +5 01000 00000101
B DATA -3 01001 11111101
C DATA 01010
Program
Assembly language
Main memory
Address Contents
op code
Data