Ders 7
Ders 7
EHB326E
Lectures
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 1 / 25
General-Purpose Processors: Software
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 2 / 25
General-Purpose Processors: Basic Architecture
Key differences
Datapath is general
Control unit doesn’t ”store the algorithm” the algorithm is
”programmed” into the memory
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 3 / 25
General-Purpose Processors: Basic Architecture
Datapath Unit: consists of circuitry for transforming data and for
storing temporary data.
N-bit processor : N-bit ALU, registers, buses, memory data interface
Control Unit: consists of circuitry for retrieving program instructions
and for moving data to, from and through the datapath according to
those instr.
Program Counter’s size determines address space
Memory: While registers serve a processorÄôs short term storage
requirements, memory serves the processorÄôs medium and long-term
information-storage requirements. Two memory architectures:
Harvard and Princeton.
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 4 / 25
General-Purpose Processors: Operations
Datapath Operations
Load : Read memory location into register
ALU operation: Input certain registers through ALU, store back in
register
Store : Write register to memory location
Control Unit
Control unit: configures the datapath operations
Sequence of desired operations (”instructions”) stored in memory
”program”
Instruction cycle Äı̀ broken into several sub-operations, each one clock
cycle, e.g.:
Fetch: Get next instruction into IR
Decode: Determine what the instruction means
Fetch operands: Move data from memory to datapath register
Execute: Move data through the ALU
Store results: Write data from register to memory
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 5 / 25
Instruction Cycles
0: INPUT S0,(S1);
;Fetch : get next instruction into IR
;Decode: Determine what the instruction means
;Fetch operands: Move data from memory to datapath register
;Execute: Move data through the ALU
;Store results: Write data from register to memory
2: STORE S0,(S1)
Fetch : get next instruction into IR
Decode: Determine what the instruction means
Fetch operands: Move data from memory to datapath register
Execute :Move data through the ALU
Store results: Write data from register to memory
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 6 / 25
General-Purpose Processors
Instruction Cycle:
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 7 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 8 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 9 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 10 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 11 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 12 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 13 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 14 / 25
General-Purpose Processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 15 / 25
Pipelining: Increasing Instruction Throughput
F D FO E S
F D FO E S
F D FO E S
F D FO E S
F D FO E S
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 16 / 25
General-Purpose Processors
Performance can be improved by:
Faster clock (but there is a limit)
Pipelining: slice up instruction into stages, overlap stages
Multiple ALUs to support more than one instruction stream
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 17 / 25
Architectural Considerations
Faster clock (but thereÄôs a limit)
Pipelining: slice up instruction into stages, overlap stages
Multiple ALUs to support more than one instruction stream
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 18 / 25
Application-specific processors
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 19 / 25
Application-specific processors: Intel 8051
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 20 / 25
Programmer’s View
A programmer writes the program instructions that carry out the desired
functionality on the general-purpose processor.
Programmer doesn’t need detailed understanding of architecture
Instead, needs to know what instructions can be executed
Two levels of instructions:
Assembly level (lying between machine language and high level
language)
Structured languages (C, C++, Java, etc.)
Most development today done using structured languages
But, some assembly level programming may still be necessary
Drivers: portion of program that communicates with and/or controls
(drives) another device
Often have detailed timing considerations, extensive bit manipulation
Assembly level may be best for these
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 21 / 25
Programmer’s View: Instruction set
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 22 / 25
Programmer’s View: Instruction set
Data-transfer instructions
Arithmetic/logical instructions
Branch instructions
Unconditional Jump
Conditional Jump
Return instruction
Call instruction (saves the add. of current inst.)
Source operands serve as input to the operation, while a destination
operand stores the output.
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 23 / 25
Programmer’s View: Instruction set
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 26 / 25
Development Environment
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 27 / 25
Development Environment
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 29 / 25
Instruction set simulator (ISS):
Gives us control over time Äı̀ set breakpoints, look at register values,
set values, step-by-step execution, ...
But, doesnÄôt interact with real environment
Download to board
Use device programmer
Runs in real environment, but not controllable
Compromise: emulator
Runs in real environment, at speed or near
Supports some controllability from the PC
Keil: Evaluation Boards and Emulators for 8051
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 30 / 25