EECS 373 Design of Microprocessor-Based Systems

Similar documents
EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373. Design of Microprocessor-Based Systems. Prabal Dutta University of Michigan. Announcements. Homework #2 Where was I last week?

Design of Microprocessor-Based Systems Part II

EECS 373 Practice Midterm & Homework #2 Fall 2011

Universität Dortmund. ARM Cortex-M3 Buses

EECS 373 Lab 3: Introduction to Memory Mapped I/O

SoC Interconnect Bus Structures

EECS 373 Midterm Winter 2012

EECS 373 Practice Midterm / Homework #3 Fall 2014

esi-multichannel Timer

EECS 373 Midterm 2 Fall 2018

EECS 373 Midterm Winter 2016

Hardware Implementation of AMBA Processor Interface Using Verilog and FPGA

EECS 373 Midterm 2 Exam Winter 2018

1 Contents 2 2 Overview 3 3 Hardware Interface 4 4 Software Interface Register Map Interrupts 6 5 Revision History 8

International Journal of Applied Sciences, Engineering and Management ISSN , Vol. 05, No. 02, March 2016, pp

APB4 GPIO. APB4 GPIO Datasheet Roa Logic, All rights reserved

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

CoreAHBtoAPB3 v3.1. Handbook

Roa Logic. APB4 Multiplexer. Datasheet. October, c Roa Logic B.V.

EECS 373 Midterm Winter 2013

Ref: AMBA Specification Rev. 2.0

AMBA 3 AHB Lite Bus Architecture

1 Contents. Version of EnSilica Ltd, All Rights Reserved

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

VLSI DESIGN OF AMBA BASED AHB2APB BRIDGE

EECS 373, Homework 4, Fall 2018 Assigned: Wednesday 10/3; Due: Wednesday 10/10 at 10pm

EECS 373 Midterm Winter 2017

EECS 373 Fall 2018 Homework #3

SEMICON Solutions. Bus Structure. Created by: Duong Dang Date: 20 th Oct,2010

EECS 373 Design of Microprocessor-Based Systems

DESIGN AND VERIFICATION ANALYSIS OF APB3 PROTOCOL WITH COVERAGE

Buses. Maurizio Palesi. Maurizio Palesi 1

CoreAPB3 v4.1. Handbook

FSM & Handshaking Based AHB to APB Bridge for High Speed Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

1 Contents. Version of EnSilica Ltd, All Rights Reserved

System Design Kit. Cortex-M. Technical Reference Manual. Revision: r0p0. Copyright 2011 ARM. All rights reserved. ARM DDI 0479B (ID070811)

Summer 2003 Lecture 21 07/15/03

(ARM&Standard&Parallel&Bus) Introduction

Lecture 25: Busses. A Typical Computer Organization

Pooja Kawale* et al ISSN: [IJESAT] [International Journal of Engineering Science & Advanced Technology] Volume-6, Issue-3,

DEVELOPMENT AND VERIFICATION OF AHB2APB BRIDGE PROTOCOL USING UVM TECHNIQUE

Chapter 6 Storage and Other I/O Topics

Bus AMBA. Advanced Microcontroller Bus Architecture (AMBA)

1 Contents. Version of EnSilica Ltd, All Rights Reserved

all: arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb main.c \ -T generic-hosted.ld -o main.out -g arm-none-eabi-objdump -S main.out > main.

EECS 373 Design of Microprocessor-Based Systems

AHB2APB Bridge. User Guide. 11/2013 Capital Microelectronics, Inc. China

Design of AMBA Based AHB2APB Bridge

1. INTRODUCTION OF AMBA

CoreGPIO v3.1. Handbook

CoreMDIO_APB v2.0. Handbook

Architecture of An AHB Compliant SDRAM Memory Controller

Overview. Memory Classification Read-Only Memory (ROM) Random Access Memory (RAM) Functional Behavior of RAM. Implementing Static RAM

System-On-Chip Design with the Leon CPU The SOCKS Hardware/Software Environment

ENGG3380: Computer Organization and Design Lab4: Buses and Peripheral Devices

APB Free ware, 2015 Fen Logic Ltd.

CPE/EE 421 Microcomputers

Project 1a: Hello World!

A VHDL 8254 Timer core

Embedded Busses. Large semiconductor. Core vendors. Interconnect IP vendors. STBUS (STMicroelectronics) Many others!

Computer Memory. Textbook: Chapter 1

CPE/EE 421/521 Fall 2004 Chapter 4 The CPU Hardware Model. Dr. Rhonda Kay Gaede UAH. The CPU Hardware Model - Overview

5. On-chip Bus

IMPLEMENTATION OF LOW POWER INTERFACE FOR VERIFICATION IP (VIP) OF AXI4 PROTOCOL

PrimeCell AHB SDR and SRAM/NOR Memory Controller (PL243)

A First Look at Microprocessors

A User s Experience with SystemVerilog

Memory Systems for Embedded Applications. Chapter 4 (Sections )

Multi-core microcontroller design with Cortex-M processors and CoreSight SoC

Memory Supplement for Section 3.6 of the textbook

Digital Input and Output

Bus Interfaces and Standards. Zeljko Zilic

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Architectural design proposal for real time clock for wireless microcontroller unit

AMBA Peripheral Bus Controller

Peripheral Test Block

Synchronous Bus. Bus Topics

EE108B Lecture 17 I/O Buses and Interfacing to CPU. Christos Kozyrakis Stanford University

MICROPROCESSOR B.Tech. th ECE

Cortex -M System Design Kit. Arm. Technical Reference Manual. Revision: r1p1

Unit DMA CONTROLLER 8257

The CoreConnect Bus Architecture

6.111 Lecture # 8. Topics for Today: (as time permits)

Keywords- AMBA, AHB, APB, AHB Master, SOC, Split transaction.

Developing a LEON3 template design for the Altera Cyclone-II DE2 board Master of Science Thesis in Integrated Electronic System Design

STM32 MICROCONTROLLER

ECE 551 System on Chip Design

Embedded Systems 1: On Chip Bus

Design of AHB Arbiter with Effective Arbitration Logic for DMA Controller in AMBA Bus

Design and Implementation of AXI to AHB Bridge Based on AMBA 4.0

CoreSPI v3.0. Handbook

AMBA AHB Bus Protocol Checker

AvnetCore: Datasheet

Transcription:

EECS 373 Design of Microprocessor-Based Systems Ron Dreslinski University of Michigan Lecture 4: Bit of assembly, Memory-mapped I/O, APB January 16, 2018 1

Admin HW2 Due Thursday. HW1 answers posted as well.

Today Memory-mapped I/O Bus Architectures ARM AHB-Lite 3

Memory-mapped I/O The idea is really simple Instead of real memory at a given memory address, have an I/O device respond. Huh? Example: Let s say we want to have an LED turn on if we write a 1 to memory location 5. Further, let s have a button we can read (pushed or unpushed) by reading address 4. If pushed, it returns a 1. If not pushed, it returns a 0. 4

Now How do you get that to happen? We could just say magic but that s not very helpful. Let s start by detailing a simple bus and hooking hardware up to it. We ll work on a real bus next time! 5

Basic example Discuss a basic bus protocol Asynchronous (no clock) Initiator and Target REQ#, ACK#, Data[7:0], ADS[7:0], CMD CMD=0 is read, CMD=1 is write. REQ# low means initiator is requesting something. ACK# low means target has done its job.

A read transaction Say initiator wants to read location 0x24 A. Initiator sets ADS=0x24, CMD=0. B. Initiator then sets REQ# to low. (why do we need a delay? How much of a delay?) C. Target sees read request. D. Target drives data onto data bus. E. Target then sets ACK# to low. F. Initiator grabs the data from the data bus. G. Initiator sets REQ# to high, stops driving ADS and CMD H. Target stops driving data, sets ACK# to high terminating the transaction. I. Bus is seen to be idle.

Read transaction ADS[7:0]?? 0x24?? CMD Data[7:0]?? 0x55?? REQ# ACK# A B C D E F G HI

A write transaction (write 0xF4 to location 0x31) Initiator sets ADS=0x31, CMD=1, Data=0xF4 Initiator then sets REQ# to low. Target sees write request. Target reads data from data bus. (Just has to store in a register, need not write all the way to memory!) Target then sets ACK# to low. Initiator sets REQ# to high & stops driving other lines. Target sets ACK# to high terminating the transaction

The push-button (if ADS=0x04 write 0 or 1 depending on button) ADS[7] ADS[6] ADS[5] ADS[4] ADS[3] ADS[2] ADS[1] ADS[0] REQ# Data[7] Delay ACK#.. 0...... Button (0 or 1) Button (0 or 1).. Data[0]

The push-button (if ADS=0x04 write 0 or 1 depending on button) ADS[7] ADS[6] ADS[5] ADS[4] ADS[3] ADS[2] ADS[1] ADS[0] REQ# Data[7] Delay ACK#.. 0...... What about CMD? Button (0 or 1).. Data[0]

The LED (1 bit reg written by LSB of address 0x05) ADS[7] ADS[6] ADS[5] ADS[4] ADS[3] ADS[2] ADS[1] ADS[0] REQ# DATA[7] DATA[6] DATA[5] DATA[4] DATA[3] DATA[2] DATA[1] DATA[0] D clock Delay ACK# Flip-flop which controls LED

Let s write a simple assembly program Light on if button is pressed. 13

Outline Finish up example Bus Architectures ARM AHB-Lite 14

What happens when this instruction executes? #include <stdio.h> #include <inttypes.h> #define REG_FOO 0x40000140 main () { uint32_t *reg = (uint32_t *)(REG_FOO); *reg += 3; } printf( 0x%x\n, *reg); // Prints out new value 15

*reg += 3 is turned into a ld, add, str sequence Load instruction A bus read operation commences The CPU drives the address reg onto the address bus The CPU indicated a read operation is in process (e.g. R/W#) Some handshaking occurs The target drives the contents of reg onto the data lines The contents of reg is loaded into a CPU register (e.g. r0) Add instruction An immediate add (e.g. add r0, #3) adds three to this value Store instruction A bus write operation commences The CPU drives the address reg onto the address bus The CPU indicated a write operation is in process (e.g. R/W#) Some handshaking occurs The CPU drives the contents of r0 onto the data lines The target stores the data value into address reg 16

Details of the bus handshaking depend on the particular memory/peripherals involved SoC memory/peripherals AMBA AHB/APB NAND Flash Open NAND Flash Interface (ONFI) DDR SDRAM JEDEC JESD79, JESD79-2F, etc. 17

Modern embedded systems have multiple busses Atmel SAM3U Expanded 373 focus Traditional 373 focus 18

Advanced Microcontroller Bus Architecture (AMBA) - Advanced High-performance Bus (AHB) - Advanced Peripheral Bus (APB) AHB High performance Pipelined operation Burst transfers Multiple bus masters Split transactions APB Low power Latched address/control Simple interface Suitable of many peripherals 19

Actel SmartFusion system/bus architecture 20

Bus terminology Any given transaction have an initiator and target Any device capable of being an initiator is said to be a bus master In many cases there is only one bus master (single master vs. multi-master). A device that can only be a target is said to be a slave device. Some wires might be shared among all devices while others might be point-to-point connections (generally connecting the master to each target). 21

Driving shared wires It is commonly the case that some shared wires might have more than one potential device that needs to drive them. For example there might be a shared data bus that is used by the targets and the initiator. We saw this in the simple bus. In that case, we need a way to allow one device to control the wires while the others stay out of the way Most common solutions are: using tri-state drivers (so only one device is driving the bus at a time) using open-collector connections (so if any device drives a 0 there is a 0 on the bus otherwise there is a 1) 22

Or just say no to shared wires. Another option is to not share wires that could be driven by more than one device... This can be really expensive. Each target device would need its own data bus. That s a LOT of wires! Not doable when connecting chips on a PCB as you are paying for each pin. Quite doable (though not pretty) inside of a chip. 23

Wire count Say you have a single-master bus with 5 other devices connected and a 32-bit data bus. If we share the data bus using tri-state connections, each device has only 32-pins. If each device that could drive data has it s own bus Each slave would need pins for data The master would need pins for data Again, recall pins==$$$$$$. 24

Outline Finish up example Bus Architectures ARM APB 25

APB is a fairly simple bus designed to be easy to work with. Low-cost Low-power Low-complexity Low-bandwidth Non-pipelined Ideal for peripherals 26

Let s just look at APB writes (Master writing to device) as a starting point. We ll add reads shortly. 27

Notation 28

APB bus signals PCLK Clock PADDR Address on bus PWRITE 1=Write, 0=Read PWDATA Data written to the I/O device. Supplied by the bus master/processor. 29

APB bus signals PSEL Asserted if the current bus transaction is targeted to this device PENABLE High during entire transaction other than the first cycle. PREADY Driven by target. Similar to our #ACK. Indicates if the target is ready to do transaction. Each target has it s own PREADY 30

Blank Slide for Diagraming 31

So what s happening here?

Example setup For the next couple of slides, we will assume we have one bus master CPU and two slave devices (D1 and D2) D1 is mapped to address 0x00001000-0x0000100F D2 is mapped to 0x00001010-0x0000101F

Say the CPU does a store to location 0x00001004 with no stalls D1 D2 34

Design What if a we device want which to have writes the LSB to a of register this register whenever any control address an LED? in its range is written PWDATA[31:0] PWRITE PENABLE PSEL 32-bit Reg D[31:0] Q[31:0] EN C PADDR[7:0] PCLK PREADY We are assuming APB only gets lowest 8 bits of address here 35

Reg A should be written at address 0x00001000 Reg B should be written at address 0x00001004 PWDATA[31:0] 32-bit Reg A PWRITE PENABLE D[31:0] EN C Q[31:0] PSEL PADDR[7:0] 32-bit Reg B PCLK PREADY D[31:0] EN C Q[31:0] We are assuming APB only gets lowest 8 bits of address here 36

Reads The key thing here is that each slave device has its own read data (PRDATA) bus! Recall that R is from the initiator s viewpoint the device drives data when read. 37

Let s say we want a device that provides data from a switch on a read to any address it is assigned. (so returns a 0 or 1) PRDATA[31:0] PWRITE PENABLE PSEL Mr. Switch PADDR[7:0] PCLK PREADY 38

Device provides data from switch A if address 0x00001000 is read from. B if address 0x00001004 is read from PRDATA[31:0] PWRITE PENABLE PSEL Switch A PADDR[7:0] Switch B PCLK PREADY 39

All reads read from register, all writes write PWDATA[31:0] PWRITE PENABLE PSEL 32-bit Reg D[31:0] Q[31:0] EN C PADDR[7:0] PCLK PREADY We are assuming APB only gets lowest 8 bits of address here 40

Things left out There is another signal, PSLVERR (APB Slave Error) which we can drive high if things go bad. We ll just tie that to 0. Notice we are assuming that our device need not stall. We could stall if we needed. I can t find a limit on how long, but I suspect at some point the processor would generate an error. 41

Verilog! /*** APB3 BUS INTERFACE ***/ input PCLK, input PRESERN, input PSEL, input PENABLE, output wire PREADY, output wire PSLVERR, input PWRITE, input [31:0] PADDR, input wire [31:0] PWDATA, output reg [31:0] PRDATA, // clock // system reset // peripheral select // distinguishes access phase // peripheral ready signal // error signal // distinguishes read and write cycles // I/O address // data from processor to I/O device (32 bits) // data to processor from I/O device (32-bits) /*** I/O PORTS DECLARATION ***/ output reg LEDOUT, // port to LED input SW // port to switch ); assign PSLVERR = 0; assign PREADY = 1; 42

APB state machine IDLE Default APB state SETUP When transfer required PSELx is asserted Only one cycle ACCESS PENABLE is asserted Addr, write, select, and write data remain stable Stay if PREADY = L Goto IDLE if PREADY = H and no more data Goto SETUP is PREADY = H and more data pending We ll spend a bit more time on this next week 43

Questions? Comments? Discussion? 44