Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2. A Computer System for Labs

Similar presentations


Presentation on theme: "Lecture 2. A Computer System for Labs"— Presentation transcript:

1 Lecture 2. A Computer System for Labs
ECM583 Special Topics in Computer Systems Lecture 2. A Computer System for Labs Prof. Taeweon Suh Computer Science Education Korea University

2 A Typical I/O System Schematic (Simplified)
CPU Core Interrupts Cache bus Memory Bus, I/O bus Memory Controller I/O Controller I/O Controller I/O Controller Main Memory Graphics Card Disk Disk Network

3 I/O Interconnection A bus is a shared communication link
A single set of wires used to connect multiple components Composed of address bus, data bus, and control bus (read/write) Advantages Versatile – new devices can be added easily and can be moved between computer systems that use the same bus standard Low cost – a single set of wires is shared in multiple ways Disadvantages Communication bottleneck – bus bandwidth limits the maximum I/O throughput The maximum bus speed is largely limited by The length of the bus The number of devices on the bus

4 I/O Interconnection (Cont)
I/O devices and interconnection largely contribute to the performance of computer system Traditionally, parallel shared wires had (have) been used to connect I/O devices As the clock frequency increases for communicating with I/O devices, parallel shared wires suffer from clock skew and interference among wires Industry transitioned from parallel shared buses to high-speed serial point-to-point interconnections

5 Types of Buses Processor-memory bus Backplane (backbone) bus I/O bus
Front Side Bus (FSB), proprietary bus Being replaced by QPI (QuickPath Interconnect) in Intel Being replaced by Hypertransport in AMD Short and high speed Matched to the memory system to maximize the memory-processor bandwidth Optimized for cache block transfers Backplane (backbone) bus Industry standard e.g., PCIexpress Allow processor, memory and I/O devices to coexist on a single bus Used as an intermediary bus connecting I/O busses to the processor-memory bus I/O bus e.g., SCSI, USB, Firewire Usually is lengthy and slower Needs to accommodate a wide range of I/O devices Processor-memory bus Backplane bus CPU Main Memory (DDR2) FSB (Front-Side Bus) North Bridge Graphics card DMI (Direct Media I/F) South Bridge Hard disk USB I/O bus

6 How Does CPU Access I/O Devices?
Virtually, all the I/O devices have registers implemented, so users can use them to program the devices Then, for programming, where and how to write to or read from? There are 2 ways to access I/O devices Memory-mapped I/O I/O-mapped I/O I/O device is mapped to a memory space CPU generates a memory transaction to access I/O device To access I/O device In ARM, use ldr or str instructions In x86, use mov instruction Memory Space 0xFFFF_FFFF (4GB-1) I/O device I/O device I/O device 0x3FFF_FFFF (1GB-1) Main Memory (1GB) 0x0

7 How Does CPU Access I/O Devices?
I/O-mapped I/O I/O device is mapped to I/O space CPU generates I/O transaction to access I/O device To access I/O device In x86, there are in and out instructions. In x86, I/O space is 64KB To differentiate memory space and I/O space, there should be hardware support ISA support In x86, mov instruction for memory transaction and in,out instruction for I/O transaction Pin from processor that informs if a transaction is memory or I/O For example, the pin is driven to “1” if memory transaction or “0” if I/O transaction I/O Space (64KB in x86) 0xFFFF (64KB-1) I/O device I/O device I/O device 0x0

8 How I/O Communicates with CPU?
Polling CPU periodically checks the status of an I/O device to determine its need for service CPU is totally in control Can waste a lot of CPU time due to speed differences Interrupt I/O device issues an interrupt to indicate that it needs attention An I/O interrupt is asynchronous wrt (with respect to) instruction execution It is not associated with any instruction, so doesn’t prevent any instruction from completing You can pick your own convenient point in the pipeline to handle the interrupt

9 DMA (Direct Memory Access)
Typically, moving data from one place to another involve CPU instructions Load (lw) from a location (e.g. memory in an I/O device) Store (sw) to another location (e.g. main memory) Moving a large chunk of data with CPU instructions could take a large fraction of CPU time DMA has the ability to transfer large blocks of data directly to/from the memory without involving the processor The processor initiates the DMA transfer by supplying source and destination addresses, the number of bytes to transfer The DMA controller manages the entire transfer (possibly thousand of bytes in length), arbitrating for the bus When the DMA transfer is complete, the DMA controller interrupts the processor to inform that the transfer is complete There may be multiple DMA devices in one system Processor and DMA controllers contend for bus cycles and for memory

10 Our Computer System for Labs
For educational purpose, it would be best to use a simple system Students easily absorb and learn basic mechanisms Using a complex system often overwhelms students Students can change here and there (including both H/W and S/W) and observe the effect of the change If interested, students are able to further purse more complicated computer systems by themselves after the study with a simple system

11 Our Computer System 8KB Memory (Instructions, Data) Instruction
ARM CPU ALU EAX R15 …. R1 R0 Address Bus Data Bus 32-bit Instruction Interrupt Data Address Bus Data Bus 32-bit Timer UART GPIO

12 Our Computer System in FPGA
Address Bus Data Bus 32-bit Timer UART GPIO 8KB Memory ARM CPU ALU EAX R15 …. R1 R0

13 7 segments, LEDs, Switches
Our Computer System Address Bus Data Bus 32-bit Timer UART GPIO 8KB Memory ARM CPU ALU EAX R15 …. R1 R0 7 segments, LEDs, Switches

14 Memory Map Memory map of our system
You can change the map if you want by editing “Addr_decoder.v” 0xFFFF_FFFF Memory Space Address Bus Data Bus 32-bit ARM CPU ALU EAX R15 …. R1 R0 GPIO 4KB 0xFFFF_2000 UART 4KB 0xFFFF_1000 Timer 4KB 0xFFFF_0000 0x0000_2000 0x0000_1FFF 8KB Memory 8KB 0x0

15 Our System… How to access registers in I/O devices (Timer, UART, GPIO)? Use memory access instruction such as ldr (load) or str (store) in ARM So, our system uses memory-mapped I/O Actually, ARM does not have I/O instructions (i.e., it does not support I/O-mapped I/O) How to access registers in I/O devices with C language? For communication with I/O devices, we are going to use both polling and interrupt in the labs


Download ppt "Lecture 2. A Computer System for Labs"

Similar presentations


Ads by Google