Download Unit 8. Computer Basics - Sinclair Community College

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
EET 252 Unit 8
Computer Basics




Read Floyd, Sections 13-1 to 13-6
(skimming Section 13-3 and pages
739-745).
Do Lab #8.
Homework #8 and Lab #8 due next
week.
Quiz next week.
Figure 13.1 Basic computer block diagram.
Digital Fundamentals, Tenth Edition
Thomas L. Floyd
Copyright ©2009 by Pearson Higher Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
Computer Block Diagram
The microprocessor or central processing unit (CPU) fetches
instructions from memory and executes them.
Peripherals
Memory stores instructions and data
until needed by the CPU.
Keyboard
Mouse
Monitor
Printer
Modem
Removable storage:
CDs, CD-RW, etc.
The ports are the I/O connections to
the peripherals.
Memories/Storage:
RAM, ROM, cache,
hard disk
The buses are groups of conductors
with a common purpose.
Input/Output
ports
Address bus
Peripherals are devices for
inputting or outputting information.
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
CPU
(microprocessor)
Data bus
Control bus
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Roles of the Microprocessor
•The microprocessor is the heart of a computer
system. It performs the following functions:
•Fetches instructions from memory.
•Decodes and executes the instructions. This
typically involves:
• Transferring data to/from memory or I/O devices.
•Performing arithmetic or logical operations on data.
•Provides timing and control signals for all other
elements in the computer.
•Responds to interrupts (requests from I/O devices).
Microprocessor Block Diagram
Four blocks are common to all microprocessors. These are:
• ALU
Performs arithmetic and logic operations.
• Instruction decoder
Translates the current instruction into hardware
signals for executing the instruction.
• Register array
A group of temporary storage locations within
the processor. Some registers have a dedicated
special purpose; others are general purpose.
• Control unit
Synchronizes the processing of instructions.
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
Microprocessor
Arithmetic
logic unit
(ALU)
Register
array
Instruction
decoder
Control
unit
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Microprocessor Buses
A bus consists of a set of wires or circuit-board traces over
which information moves from one place to another.
The address bus is used by the microprocessor to specify a
location in memory or external device.
The data bus transfers data
and instruction codes to and
from memory and I/O ports.
The control bus coordinates
operations and communicates
with external devices.
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
Memories/Storage:
RAM, ROM, cache,
hard disk
Input/Output
ports
Address bus
CPU
(microprocessor)
Data bus
Control bus
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Some Popular Microprocessor
Families
•Dozens of companies design and manufacture
microprocessors. Three of the most popular:
•Intel
•4004, 8008, 8051, 8086, 80286, 80386,
Pentium, Celeron, Itanium, Xeon, Core 2, …
•Motorola (Freescale since 2004)
•6800, 68HC11, 68000, PowerPC, …
•Microchip Technology
•PIC microcontrollers
Microprocessor Datasheet
•MC6802/6808 (datasheet on course website)
Heathkit ET 3400 Microcomputer
Trainer
•Microcomputer system built around Motorola
6802 or 6808 microprocessor.
•Lets you tap into address bus, data bus,
control lines.
Heathkit Trainer: Main Components
Microprocessor
Microcomputer
System
Display
ROM
RAM
Data
Bus
Control
Bus
External Components
Address
Bus
Keypad
Heathkit Trainer: Main Components
Microcomputer System
LEDs
External
SwitchesComponents
Power supply
Breadboard
Heathkit Trainer: Pre-Wired Chip
•Each Heathkit trainer in this room already has
an extra 7400 chip and a few wires installed for
you. These will be needed for most of the labs
that we do. Please do not remove them.
Heathkit Trainer: Documentation
•All are taken from Heathkit manual and are
posted on course website.
•Front panel diagrams
•Block diagram
•Schematic diagram
•Detailed explanation of operation
Heathkit Trainer: µP Registers
•In EET 261 & 262 you’ll study internal
organization & operation of microprocessors.
We just need to know that 6802/6808 has six
internal registers that you can access:
Register Name
# of bits
Contents
Accumulator A
8
Operands for arithmetic/logical
operations
Accumulator B
8
Same as Acc. A
Program Counter
16
Address of current instruction
Condition Code Reg
6
H, I, N, Z, V, C bits show conditions
resulting from previous instruction
Stack Pointer
16
Address of top of stack
Index Reg
16
Offset address for some
instructions.
Heathkit Trainer: Keypad
•Seventeen keys; most can be used either to
enter a hex digit or to issue a command.
Label
Command
Label
Command
RESET
Reset system
7/RTI
Resume program
8/SS
Single-step program
0
1/ACCA
Display Accumulator A
9/BR
Enter breakpoint
2/ACCB
Display Accumulator B
A/AUTO
Automatic program entry
3/PC
Display Program Counter
B/BACK
Go to previous address
4/INDEX
Display Index Register
C/CHAN
Change address or data
5/CC
Display Condition Code Reg
D/DO
Execute program
6/SP
Display Stack Pointer
E/EXAM
Examine memory
F/FWD
Go to next address
Heathkit Trainer: Address Bus
•System has a 16-bit address bus connected to
16 output pins on the 6802/6808 microprocessor
chip.
•All bits (A0 through A15) are available at
connectors.
Heathkit Trainer: Data Bus
•System has an 8-bit bi-directional data bus
connected to 8 input/output pins on the
6802/6808.
•All bits (D0 through D7) are available at
connectors.
Heathkit Trainer: Control Bus
•System has 13 timing and control lines
available at connectors.
•Most are connected to pins on the 6802/6808.
Label
Name
Label
Name
RE
Read Enable (input)
BA
Bus Available (output)
1Hz
1 Hz clock
R/W
Read/Write (output)
NMI
Non-maskable interrupt
(input)
LINE
VMA 02
(output)
VMA
Valid Memory Address
(output)
02
Clock Phase 02 (output)
IRQ
Interrupt Request (input)
RST
Reset (output)
HALT
Halt (input)
TSC
Tri-State Control (input)
Heathkit Trainer: Memory Map
•Our system has a 16-bit address bus, so
addresses can range from $0000 to $FFFF.
Address Range
Contents
$FC00 - $FFFF
1k-byte ROM
$C170 - $FBFF
Unused
$C110 - $C16F
Display
$C00F - $C10F
Unused
$C003 - $C00E
Keypad
$0200 - $C002
Unused
$0100 - $01FF
256 bytes user RAM
$00C5 - $00FF
59 bytes reserved RAM
$0000 - $00C4
197 bytes user RAM
Computer Programming
Most programming today is done in high-level languages, which
can run on various machines. High-level programs are easier to
write and maintain than assembly programs or machine code.
High-level language
• Closer to human language
• Portable
Assembly language is more convenient than
machine language. Assembly language is used
today for many applications because it executes
fast and efficiently. But it must be written for a
specific processor.
Early computers were programmed in machine
language. Machine language is tedious to write
and prone to errors.
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
Assembly language
• English-like terms representing
binary code
• Machine dependent
Machine language
• Binary code (1s and 0s)
• Machine dependent
Computer hardwar e (the “machine”)
• CPU
• Memory (RAM, ROM)
• Disk drives
• Input/Output
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Example
•This program adds two numbers together and
stores the result.
High-Level Language
(BASIC)
FirstNumber=30
SecondNumber=21
Sum=FirstNumber+SecondNumber
Assembly
Language
(6802)
LDAA #$1E
LDAB #$15
ABA
STAA $0122
Machine
Code (6802)
$86 1E C6 15
1B B7 01 22
•Third column is the only one the
microprocessor understands. The BASIC or
Assembly programs must be translated to
machine code before being executed.
Computer Programming: Compilers & Assemblers
High-level languages are machine-independent. The source code is
translated to machine code by a compiler for the specific processor being
used.
High-level language
program
(Source program)
Compiler
Machine language
program
(Object program)
Assembly language must be written for the specific processor being used,
so the programmer must understand details of how this processor
operates. An assembler translates the source code to machine code.
Assembly language
program
(Source program)
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
Assembler
Machine language
program
(Object program)
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Interrupts
•In any computer system, the processor must
periodically suspend the program it’s executing
to handle data transfers to and from peripheral
devices (such as a keyboard or display).
•Three common ways to do this:
•Polled I/O
•Interrupt-driven I/O (Hardware interrupts)
•Software interrupts
(Floyd, p. 746)
Interrupts (Continued)
•Polled I/O – The processor periodically suspends the
current program and checks each peripheral device one at a
time to see if it needs service. If it does, the processor
executes a service routine to handle the device’s needs.
•Interrupt driven I/O (Hardware interrupt) – The
peripheral device requests service by sending an interrupt
request signal. The processor suspends the program
currently running, acknowledges the interrupt, executes the
service routine, and then returns to its program when the
routine is completed.
•Software interrupt – A software interrupt is issued from
software rather than external hardware. When the interrupt is
issued, the steps are the same as with a hardware interrupt.
Traditional Handling of I/O Data
Transfer
•Traditionally, data transfers between memory
and peripheral devices required the data to
pass through the processor.
•This is not very efficient, compared to….
Direct Memory Access
Direct memory access (DMA) is a data transfer technique in
which data is transferred between a peripheral device and
memory without involving the CPU. A DMA controller
handles the transfer. The transfer is faster using this method.
CPU
Data bus
MEMR
RAM
th th
Floyd, Digital
Floyd,
DigitalFundamentals,
Fundamentals,1010
eded
DMA
controller
IOW
I/O port
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved