CSCI130 - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CSCI130

Description:

Fetch-Decode-Execute. CU supervises the fetch-execute cycle ... Decodes instruction. Supervises its execution. Saves results. Fetches another until we STOP ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 19
Provided by: usersC1
Category:

less

Transcript and Presenter's Notes

Title: CSCI130


1
Lecture 6
  • CSCI130
  • Instructor Dr. Imad Rahal

2
Circuit for Equivalence
  • We need to compare the data contents of two
    registers
  • Data is in binary
  • compare them bit by bit
  • Start right to left
  • Take two inputs
  • If both 0s or 1s, output 1
  • Otherwise, output a zero
  • ABAB
  • (Sum of products method)
  • ? (AB) AB (simpler)
  • Draw circuit

3
Circuit for Addition
  • The rules of addition
  • 00 ?
  • 01 ?
  • 10 ?
  • 11 ?
  • Half-adder
  • Takes two inputs and produces one output
  • Ignores carry
  • Just the negation of equivalence
  • AB AB
  • Draw circuit

4
  • Need to include carry
  • Full-adder
  • Two inputs and one carry from addition (i.e. 3
    inputs)
  • Produces two outputs (sum and carry)
  • Drive expressions
  • Sum ABC ABC ABC ABC
  • Carry out ABC ABC ABC ABC
  • Draw circuit diagram (ABC in center)

5
(No Transcript)
6
Processor Design and Machine Language (4.1-4.5)
7
Von Neumann Machine
  • Seen how hardwired operations are accomplished
  • Comparison and addition
  • Build up other operations/tasks using those
    basic/hardwired operations ones
  • Programmed
  • Initially we had to physically connect the memory
    registers containing the input to the required
    circuits in order
  • Rewire for different programs
  • (1945) John von Neumann (Mathematician) showed
    how to encode and store programs and their data
    in memory
  • led to the von Neumann design
  • Store programs and data together in memory
  • Any program now can stored and processed without
    the need for hardware change

8
Programs Algorithms
  • Characteristics of an algorithm
  • List of steps to complete a task
  • Each step is PRECISELY defined and is suitable
    for the machine used
  • Add 5 to variable X
  • Increase the value of X
  • Eat a sandwich!
  • Finite number of steps
  • The process terminates in a finite amount of time
  • No infinite loops

9
Programs Algorithms
  • Program A formal representation of a method for
    performing some task
  • Written in a code/programming language understood
    by a computer
  • Detailed and very well-organized (computers just
    do what they are told)
  • Follows an algorithm method for fulfilling the
    task
  • Plan to do something VS the actual performance

10
CPU
  • Connects to main memory (MM) thru a bus
  • Bus bundle of wires
  • Data between CPU and memory
  • Width of bus determines speeds
  • e.g. 32-bit bus (Higher ? faster)
  • Where is data stored when copied to CPU?

11
CPU
  • Divided into CU and ALU
  • CU (Control Unit)
  • Orchestra organizer
  • Oversees transfer of data between MM and CPU
  • Accesses info in ROM (e.g. during reboot)
  • Has a bunch of registers
  • ALU (Arithmetic Logic Unit)
  • Circuits to do computations
  • Built for each basic operation (,-, x, /, ,gt,lt,
    NOT)
  • Includes a special register accumulator AC to
    hold results

12
Fetch-Execute Cycle
  • Programs are up of instructions
  • Fetch-Decode-Execute
  • CU supervises the fetch-execute cycle
  • Fetches one instruction from memory
  • Decodes instruction
  • Supervises its execution
  • Saves results
  • Fetches another until we STOP

13
Fetch-Execute Cycle
  • To supervise the fetch-execute cycle, the CU has
    two registers
  • PC (program counter)
  • Contains the address of the next instruction in
    memory to fetch
  • Initially points to first instruction of a
    program
  • After fetching an instruction, it is incremented
    by one unless there is a jump to some other
    instruction
  • IR (instruction register)
  • Holds the current instruction
  • Also has a timing clock
  • Clock chip that generates a steady stream of
    electric pulses
  • At every pulse, the CPU proceeds by one step
  • Fetch, send data to ALU, etc
  • Higher frequency clocks result in faster
    computers
  • 16-3000 MHz (3.0 GHz)

14
The Machine Language
  • Instruction set depending on CPU
  • Hardwired
  • Binary code for each instruction (Opcode)
  • Different CPUs might have different operations
    for which circuits exit in the ALU
  • Read about RISC and CISC in book
  • Limit VS increase circuits
  • Programs can only use these opcodes
  • The set of all opcodes (i.e. instructions)
    together is known as the machine language

15
A Simple 8-bit Computer
  • Use a simplified version of real computers to
    understand machine language programs
  • 32 8-bit main memory registers
  • 5 bits (25 registers) to represent an address
  • 00000 to 11111
  • PC holds memory addresses ? 5-bit PC
  • For simplicity, assume only positive and negative
    integers (2s complement notation)
  • 8-bit AC

16
(No Transcript)
17
A Simple 8-bit Computer
  • Two 1-bit flags
  • zflag 1 if AC zero, 0 otherwise
  • pflag 1 is AC is positive, 0 otherwise
  • ALU supports the following basic operations
  • Addition, subtraction, if AC0, if ACgt0
  • 8 instructions (next slide)
  • 3 bits (8 instructions)
  • 000 to 111
  • 8 bits per memory location ? rest 5 bits of the
    instruction contain the address of the input data
    to the instruction
  • ooo ddddd
  • 8-bit IR

18
A Simple 8-bit Computer
  • Memory holds 8-bit data or instructions
  • 8 instructions (next slide)
  • 3 bits (8 instructions)
  • 000 to 111
  • 8 bits per memory location ? rest 5 bits of the
    instruction contain the address of the input data
    to the instruction
  • ooo ddddd
  • 8-bit IR
Write a Comment
User Comments (0)
About PowerShow.com