Top Banner
Spring 2006 Lillevik 437s06- l8 1 University of Portland School of Engineering EE 437 Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed I/O Direct memory access
26

Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Jan 16, 2016

Download

Documents

Miles Lawrence
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 1University of Portland School of Engineering

EE 437

Advanced ComputerArchitecture

Lecture 8

Project 3: memory agent

Programmed I/O

Direct memory access

Page 2: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 2University of Portland School of Engineering

EE 437

Project 3 system schematic

Page 3: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 3University of Portland School of Engineering

EE 437

Project 3 requirements

• Goal: memory bus agent

• Requirements– ROM: 0x00 – 0x1f– RAM: 0x20 – 0xff

• Fully decode: address and control buses

• Assume one master• Must generate ACK (tri-state)

Page 4: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 4University of Portland School of Engineering

EE 437

Project 3 traces

read ROM read ROM

Page 5: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 5University of Portland School of Engineering

EE 437

Project 3 traces, continued.

write RAM write RAM

Page 6: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 6University of Portland School of Engineering

EE 437

Project 3 traces, continued.

read RAM read RAM

Page 7: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 7University of Portland School of Engineering

EE 437

I/O design

• Separate I/O address space– Instructions for I/O operations: in, out– Address often referred to as a Port

• One address space– Known as “memory-mapped I/O”– All memory reference instructions may operate

on I/O data

Page 8: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 8University of Portland School of Engineering

EE 437

Memory mapped I/O example

• I/O device: USART

• Receiver– Control register: 0xffff 0000– Data register: 0xffff 0004

• Transmitter– Control register: 0xffff 0008– Data register: 0xffff 000c

Page 9: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 9University of Portland School of Engineering

EE 437

C8251 block diagram

Page 10: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 10University of Portland School of Engineering

EE 437

Assembly code

Definitions for memory-mapped devices

Page 11: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 11University of Portland School of Engineering

EE 437

Assembly code, continued.

Subroutines to read and write a byte

Page 12: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 12University of Portland School of Engineering

EE 437

Find flowchart for rcvbyte?

Page 13: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 13University of Portland School of Engineering

EE 437

Wait loop

• Programming technique– CPU continuously reads control register until

non-zero (ready bit set)– CPU reads/writes data to port

• Results in poor system utilization: both memory-mapped or separate I/O addresses

• Known as programmed I/O

Page 14: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 14University of Portland School of Engineering

EE 437

Disadvantages of programmed I/O?

1. Wasted cycles CPU

2. Not writing to bus if reading it

3. No work done on bus

4.

Page 15: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 15University of Portland School of Engineering

EE 437

Direct memory access

• Objective: avoid the disadvantages of programmed I/O (eliminate the busy loop)

• Technique– CPU writes to special controller (word count

and memory address)– CPU tells controller to start data transfers– CPU continues with other computing– CPU responds to interrupt from controller: ISR

Page 16: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 16University of Portland School of Engineering

EE 437

Role of DMA controller

• Accept initialization data from CPU

• Access I/O device and drive bus (master)– Input: read I/O device and write data to

memory– Output: read memory data and write to I/O

device

• Interrupt CPU when transfer complete

Page 17: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 17University of Portland School of Engineering

EE 437

Programmed I/O

Programmed I/O ties up CPU

Read I/O

Write memory

Page 18: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 18University of Portland School of Engineering

EE 437

DMA I/O

DMA requires little CPU overhead

Initialize

Multiple

transfers

Page 19: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 19University of Portland School of Engineering

EE 437

DMA time line

ISR ISR

Interrupt Interrupt

CPU and I/O concurrent in time

Page 20: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 20University of Portland School of Engineering

EE 437

DMA hardware view

n words n words

adr X

adr X+(n-1)

Memory

I/O device

buffer

System bus adr 0

adr n-1

Page 21: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 21University of Portland School of Engineering

EE 437

DMA initialization instructions?

1. Memory/destination address

2. How long, or how many

3. Tell it to start

Page 22: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 22University of Portland School of Engineering

EE 437

DMA controller architecture

Counts up from zero

Counts down to zero Preset counter

Word

Count

Data

Buffer

Memory

Address

Buffer

Address

Control

D

A

C

Xcvr

Xcvr

Xcvr

Page 23: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 23University of Portland School of Engineering

EE 437

Page 24: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 24University of Portland School of Engineering

EE 437

Find flowchart for rcvbyte?Push $ra

Get rcv status

Char ready?

Read and echo char

Pop $ra

yes

no

Page 25: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 25University of Portland School of Engineering

EE 437

Disadvantages of programmed I/O?

1. CPU cycles result in little computing

2. Memory continuously accessed, possible contention with another CPU

3. One I/O access at a time

4. Bus heavily requested

Page 26: Spring 2006 1 EE 437 Lillevik 437s06-l8 University of Portland School of Engineering Advanced Computer Architecture Lecture 8 Project 3: memory agent Programmed.

Spring 2006

Lillevik 437s06-l8 26University of Portland School of Engineering

EE 437

DMA initialization instructions?

1. Write start address

2. Write word count (or end address)

3. Write “go” command

Each write is to a specific DMA controller port address