Lecture-03, Adv. Computer Architecture, CS-522
Lecture-03, Adv. Computer Architecture, CS-522
CS-522
MS – Computer Science
Lecture: 03
4
Program Concept
• Hardwired programs
– Programs in the form of hardware by small set of components to
store data and perform A/L operations on data
– are inflexible (hard/rigid)
Program Concept cont.…
• As alternative
– General purpose hardware (for A/L functions) can do different tasks
– Depending on correct control signals applied to hardware
• Instead of re-wiring for (each new program)
– Supply a new set of control signals
What is a program?
• A sequence of steps
• At each step, some arithmetic or logical operation is performed
Execute Cycle
– Instruction loaded into Instruction Register (IR)
– Processor-memory
• Data may be transfer between Processor and main memory
– Processor -I/O
• Data may be transfer between Processor and I/O module (unit)
– Data processing
• Perform arithmetic or logical operation on data
– Control
• Alteration of sequence of operations e.g. jump
– Combination of above actions
Example of Program Execution
(Add 3(940) & 2(941) and replace result at 941
Instruction Cycle State Diagram
(For example: ADD AX, BX)
Exercise
• Consider a CPU with
– An instruction set consisting of 16 instructions
– The instruction memory can store 64 instructions
– Data memory has a capacity of 256 words
– Each instruction is 32 bits long
– Each memory word is also 32 bits long
• The CPU fetches and executes instructions in the following
steps:
– Fetch instruction,
– Decode instruction,
– Fetch data operands,
– Execute instruction
– Write the result back
Exercise
• Given the scenario above, answer the following questions:
1. How many bits are needed for the address of the instruction
memory?
2. How many bits are needed for the address of the data memory?
3. If the program counter (PC) is 8 bits wide, what is the
maximum number of instructions that the CPU can address?
4. If the CPU needs 3 clock cycles to fetch an instruction, 2 clock
cycles to decode it, 1 clock cycle to fetch operands, and 4 clock
cycles to execute it, calculate the total time required to execute
a single instruction.
5. If a program has 100 instructions and there are no pipeline
hazards or stalls, how many clock cycles are needed to execute
the entire program?
Exercise - Solution
• Address bits for instruction memory:
– As instruction memory can store 64 instructions
– To address 64 instructions, the CPU needs 6 bits (i.e. 26 = 64)
31
Connecting (Interconnection structures)
• As we know, computer is a network of basic modules
– all the units (modules) must be connected
– The collection of paths connecting the various modules is called the
interconnection structures
• Distributed
– No central controller
– Modules have Access Control logic
– Each module may claim the shared bus
Timing
• The way of Co-ordination of events on a bus
– Types: Synchronous timing & asynchronous timing
• Synchronous Timing
– Occurrence of events determined by clock signals
– Bus includes clock line at which clock transmits signal (regular sequence
of 1’s and 0’s)
– single 1,0 transmission = clock cycle or bus cycle = time slot
– All devices can read clock line
– Usually a single cycle for an event
• Asynchronous Timing
– occurrence of one event on a bus follows and depends on the occurrence of
a previous event
Synchronous Timing Diagram
Asynchronous Timing – Read Diagram
Asynchronous Timing – Write Diagram
Adv/disadvantages
• Synchronous timing
– Simpler to implement and test
– Less flexible b/c devices are tied to a fixed clock rate
• Asynchronous timing
– Mixture of slow and faster devices can share a bus
Please, read and understand the remaining two
requirements/elements of bus design
Bus width
Data Transfer Type
Quiz-01
A short quiz is scheduled for the class of the upcoming week
62