Computer Organization and Components



Similar documents
Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Serial Communications

An Introduction to MPLAB Integrated Development Environment

Application Note: AN00141 xcore-xa - Application Development

Data Cables. Schmitt TTL LABORATORY ELECTRONICS II

Microtronics technologies Mobile:

Lizy Kurian John Electrical and Computer Engineering Department, The University of Texas as Austin

Lecture N -1- PHYS Microcontrollers

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Building Blocks for PRU Development

How to design and implement firmware for embedded systems

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

Chapter 13. PIC Family Microcontroller

Introducción. Diseño de sistemas digitales.1

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Lab Experiment 1: The LPC 2148 Education Board

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Computer Organization and Components

Using the HCS12 Serial Monitor on Wytec Dragon-12 boards. Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards

Design of Digital Circuits (SS16)

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

8051 MICROCONTROLLER COURSE

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Using Altera MAX Series as Microcontroller I/O Expanders

Software User Guide UG-461

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

Computer-System Architecture

Computer Systems Structure Input/Output

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

Tutorial for MPLAB Starter Kit for PIC18F

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Chapter 1 Lesson 3 Hardware Elements in the Embedded Systems Chapter-1L03: "Embedded Systems - ", Raj Kamal, Publs.: McGraw-Hill Education

Serial Communications

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

Interconnection Networks

EC313 - VHDL State Machine Example

Am186ER/Am188ER AMD Continues 16-bit Innovation

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

Freescale Semiconductor, I

System Considerations

Byte code Interpreter for 8051 Microcontroller

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Chapter 2 Logic Gates and Introduction to Computer Architecture

Lecture-3 MEMORY: Development of Memory:

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Design of a High Speed Communications Link Using Field Programmable Gate Arrays

Fondamenti su strumenti di sviluppo per microcontrollori PIC

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide

Implementing SPI Communication Between MSP430 G2452 and LTC ADC

2. TEACHING ENVIRONMENT AND MOTIVATION

Using The PIC I/O Ports

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures

COMPUTER SCIENCE AND ENGINEERING - Microprocessor Systems - Mitchell Aaron Thornton

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

DKWF121 WF121-A B/G/N MODULE EVALUATION BOARD

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

We r e going to play Final (exam) Jeopardy! "Answers:" "Questions:" - 1 -

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Computer organization

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

Hello, and welcome to this presentation of the STM32 SDMMC controller module. It covers the main features of the controller which is used to connect

Microprocessor & Assembly Language

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Computer Organization & Architecture Lecture #19

Application Note 132. Introduction. Voice Video and Data Communications using a 2-Port Switch and Generic Bus Interface KSZ MQL/MVL

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Types Of Operating Systems

Chapter 3. Operating Systems

Interrupts and the Timer Overflow Interrupts Huang Sections What Happens When You Reset the HCS12?

Soft processors for microcontroller programming education

M68EVB908QL4 Development Board for Motorola MC68HC908QL4

MICROPROCESSOR AND MICROCOMPUTER BASICS

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

TRILOGI 5.3 PLC Ladder Diagram Programmer and Simulator. A tutorial prepared for IE 575 by Dr. T.C. Chang. Use On-Line Help

I/O. Input/Output. Types of devices. Interface. Computer hardware

Computer Organization. and Instruction Execution. August 22

Microcontrollers in Practice

Computer Automation Techniques. Arthur Carroll

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

Green House Monitoring and Controlling Using Android Mobile Application

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

LOCAL INTERCONNECT NETWORK (LIN)

An Implementation Of Multiprocessor Linux

Transcription:

Computer Organization and Components IS1500, fall 2015 Lecture 5: I/O Systems, part I Associate Professor, KTH Royal Institute of Technology Assistant Research Engineer, University of California, Berkeley Slides version 1.0 2 Course Structure Module 1: C and Assembly Programming LE1 LE2 LE3 EX1 LAB1 Module 4: Processor Design LE9 LE10 S2 LAB5 LE4 S1 LAB2 Module 2: I/O Systems LE5 LE6 EX2 LAB3 Module 5: Memory Hierarchy LE11 EX4 LAB6 Module 3: Logic Design LE7 LE8 EX3 LAB4 Module 6: Parallel Processors and Programs LE12 LE13 EX5 S3 Proj. Expo LE14

3 Abstractions in Computer Systems Networked Systems and Systems of Systems Computer System Application Software Software Operating System Instruction Set Architecture Hardware/Software Interface Microarchitecture Logic and Building Blocks Digital Hardware Design Digital Circuits Analog Circuits Devices and Physics Analog Design and Physics 4 Agenda

5 Acknowledgement: The structure and several of the good examples are derived from the book Digital Design and Computer Architecture (2013) by D. M. Harris and S. L. Harris. 6 I/O Devices - Examples I/O Devices (also called peripherals) for a PC or mobile device. Compiler Tool Chains Processor Device Behavior Partner Data Rate (Mbit/sec) Keyboard Mouse Input Input Human Human 0.0001 0.0038 Human Human 3.2000 800.0 8000.0 Laser Printer Output Graphics Display Output Network/LAN Flash Memory Input/Output Machine Storage Machine 100.0 10000.0 32.0 200.0 Source: Patterson & Hennessy, Computer Organiziation and Design 4th edition, 2012 Memory I/O = Input / Output In embedded systems, I/O devices can be, for instance, microwave controller, fuel injector in an engine, motors, etc.

7 Memory Mapped I/O In memory mapped I/O, parts of the address space is dedicated to I/O devices. What is the following MIPS code doing, assuming that device 1 is mapped to 0xffff fff4 and device 2 to 0xffff fff8? lw $t0, 0xfff8($0) addi $t0, $t0, 100 sw $t0, 0xfff4($0) CLK Processor x86 uses programmed I/O, where special instructions are instead used for I/O. MemW Addr WriteData ReadData Historically, I/O devices and memory were connected using buses (shared parallel wires), but today it is also common with dedicated wires. WE1 WE2 CLK EN CLK EN Address Decoder WEM CLK Memory I/O Device 1 0xffff fff4 I/O Device 2 0xffff fff8 00 01 10 Simple I/O on the ChipKIT Board (1/2) 8 E Exercise: On the chipkit board, the 8 green LEDs are memory mapped to the least 8 significant bits of the word starting at address 0xbf886110. Write a MIPS assembly function led_test (without pseudo instructions) that can be called with the following C statement, and lights up the LEDs as show in the picture. led_test(0xaa);.global led_test led_test: lui $t0,0xbf88 ori $t0,$t0,0x6110 sw $a0,0($t0) jr $ra

Simple I/O on the ChipKIT Board (2/2) E 9 Exercise: Discuss what the following MIPS code is doing. Hint: the toggle switches are memory mapped to the word address 0xbf8860d0 (bits 11 through 8) and the green LEDs to 0xbf886110 (bits 7 through 0). loop: lui lw srl andi mul sw j $t0,0xbf88 $t1,0x60d0($t0) $t1,$t1,8 $t1,$t1,0xf $t1,$t1,$t1 $t1,0x6110($t0) loop Put the 16 most significant bits in $t0 Load the switch status using index (immediate) value Shift bits to the right (11 through 8 contains the information), mask, and multiply. Multiply by itself and display the power of two by using the LEDs. 7-Segment Display E 10 Exercise: Write a C function that displays digit 4 on a 7- segment display. Assume that the bits should be 1 if the diode should be on (see bit indices in the figure). The memory mapped I/O address is 0x9f0. 5 6 0 1 void display4(){ volatile int* segm7 = (volatile int*) 0x9f0; *segm7 = 102; } 4 2 Why did we use the keyword volatile? The value for displaying 4 is 0b01100110 = 64 + 32 + 4 + 2 = 102 3

11 The volatile C Keyword The volatile keyword is used on variables in C programs to avoid that the C compiler performs certain optimizations. int get_toggle(){ int * toggle18 = (int *) 0x850; while(*toggle18 == 0); return *toggle18; } int* toggle18 = (int*) 0x850; int tmp = *toggle18; while(tmp == 0); The C compiler might optimize this code, assuming that the value *toggle18 does not change. Pseudo-code for a possible optimization that the compiler might perform. To be on the safe size, always use volatile when using memory mapped I/O. volatile int* toggle18 = (volatile int*) 0x850; 12 General-Purpose Digital I/O On microcontrollers, there are typically many General-Purpose I/O (GPIO) pins that can be configured to be either input or output. GPIOs on PIC32 board (32-bit MIPS processor) Example. On a PIC32, there are several ports (port A, port B, ), where each port can have up to 16 GPIOs. Two registers for each port TRISx (where x is the port). This registers tells if the port is an output (bit value is 0) or input (bit value is 1) PORTx (where x is the port). This is the register for writing (if output) or reading (if input). Note that we say registers, although the registers are memory mapped.

13 GPIO and for chipkit boards GPIO pins are connected when the shield is attached to the Uno32 board. These pins are also connected to other components on the I/O shield. 43 GPIO pins. 4 switches 8 LEDs 4 push buttons Basic IO shield. Uno32 14 General-Purpose Digital I/O Information How can we find out how to use the different ports? Answer: Reference manuals, data sheets, and header files. Links on the course webpage under Literature and Resources Example: which port and bit should be used for reading the status of push button number 1?

General-Purpose Digital I/O Manuals E 15 Page 8 of chipkit Shield Reference Manual Page 11-12 of the Uno32 Board reference manual chipkit pin #4 uses port RF1, which means that TRISF and PORTF with bit index 1 should be used. Push button BTN1 uses Uno32 pin #4. Writing the I/O C code E 16 TRISE &= ~0xf; /* Port E is used for the LED Set bits 0 through 7 to 0 (output) */ TRISF = 0x2; /* Set bit index 1 to 1 (input) */ while(1) PORTE = (PORTF >> 1) & 0x1;) Light up the LED if the switch is on (PORTE) Extract bit 1 for representing the switch (PORTF) What is the program doing? The magic is defined in pix32mx.h #define TRISF PIC32_R (0x86140) #define TRISFCLR PIC32_R (0x86144) #define TRISFSET PIC32_R (0x86148) #define TRISFINV PIC32_R (0x8614C) #define PORTF PIC32_R (0x86150) Volatile pointer that is dereferenced! #define PIC32_R(a) *(volatile unsigned*)(0xbf800000 + (a))

17 Timers Timers are I/O devices that are used to measure time. Timers can be configured in different ways, but have basically the following components. A timer is driven by a Tells if time-out is clock source. Either reached. internal (synchronous with processor clock) or Stop/start counting external (asynchronous). Check if running. Clock Source Example, 50Mhz external clock. Write registers, saying the start number when Read register. A counting (or final, snap-shot of the depending if counting timer value. up or down) Period Register Control Register(s) Timer Value Can use prescaling k:1. It counts every k tick. For instance 256:1 18

19 Bus: Address, Data, and Control A bus is a shared interconnection network where the processor can communicate with different peripherals, such as memory and I/O devices. Address Data Control Processor Memory I/O Device I/O Device I/O Device When writing or reading to a peripheral, the address is given on the address lines. The address can for instance be 32 bits. Data is written to the data line. The data line can for instance be 32-bit The control lines may include handshaking signals. Note that modern computers often separate I/O and memory. When a peripheral is not the bus driver (not communicating), the output must be turned off (have high impedance). This is done by using tri-state gates. Each peripheral has a unique address (or range of addresses). 20 Synchronous Bus On a synchronous bus, data transmission is synchronized using a bus clock. The bus clock triggers the peripherals to send or receive data Bus clock Address and control Data For a write operation (not shown above) the processor puts both the data and the address on the bus. The device with the assigned address then reads the data. Clock cycle Convention: The diagram with two lines shows that the data or the address can have bits set to both high and low. 1. For a read operation, a control signal indicates that it is a read and the processor puts the address on the address lines. 2. All devices reads the address and the device with the assigned address answers by putting out the data. Notes: i) This is an idealized figure. In reality, there is a delay in the communication. ii) Synchronous buses can be designed so that it takes several cycles to transmit data.

21 Asynchronous Bus An asynchronous bus does not have a clock. Instead, a handshaking protocol is used between the master and the slave (the communicating peers). Address and control Master ready Slave ready Data Example of an asynchronous read 1. The master puts the address on the bus. Devices decode the information. 2. Master sets master read. All control and address info are now available. 3. The slave put the data on the bus and signals slave ready, meaning that the data is available for the master. 4. The master reads the data and sets master ready to low when it finished. 5. When the slave sees that master ready goes from high to low, it can safely stop sending data and sets slave ready to low. 22 Direct Memory Access () Direct Memory Access () enables a memory transfers to occur, without continuous intervention by the processor. Address Data Instead, the processor issues an request, stating addresses and a word count (how much data that should be transferred). Control Processor Memory Controller A controller takes care of performing the actual transfer. The processor can perform other tasks in parallel. If a lot of data should be transferred between I/O devices (e.g., disk or Ethernet) and memory, or between different parts of the memory, we do not want the processor to be occupied doing a lot of loads and stores. I/O Device The controller may issue an interrupt request (IRQ) when the transfer has finished.

23 Yes, there will be coffee in just second (please do not fumble with the bags) 24 Reading Guidelines Module 2 (I/O Systems) H&H Chapters 8.5-8.7 For the labs, focus on 8.6.2-8.6.5 (GPIO, Timers, and Interrupts) Reading Guidelines See the course webpage for more information.

25 Summary Some key take away points: Memory mapped I/O uses a portion of the address space for communicating with I/O devices. GIPO can be enabled as either input or output. It is very common in embedded systems. Buses are either synchronous or asynchronous. enables fast memory transfer without the need of the processor. Thanks for listening!