uart adapter (mini-projectcs150/fa10/lab/lab5/lablecture5.pdf · uart adapter (mini-project)ucb...

18
UART Adapter (Mini-Project) UCB EECS150 Fall 2010 Lab Lecture #5 1 UCB EECS150 Fall 2010, Lab Lecture #5

Upload: dinhxuyen

Post on 12-Sep-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

UART Adapter (Mini-Project)

UCB EECS150 Fall 2010

Lab Lecture #5

1UCB EECS150 Fall 2010, Lab Lecture #5

Page 2: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Agenda

• The entire CS150 CAD flow

• A new debugging tool (ChipScope)

• Lab 5 is to be done in pairs

Questions?

• Lab 5 overview

• Design reviews

2UCB EECS150 Fall 2010, Lab Lecture #5

Page 3: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Where we are and why

3UCB EECS150 Fall 2010, Lab Lecture #5

010110001

001001101

000101010

100100101

Translate/Map/PAR

FPGA Editor

BitGen

iMPACT

.ncd

.ncd

.ncd (optionally modified)

.bit

Design PartitioningDesign Entry

Behavioral

Verilog HDL

Synplify Pro

Optional step

Logic Synthesis

Synplify Pro

Simulation

ModelSim

Design Entry

Structural

Verilog HDL

Lab1

Lab2

Lab3

Lab4

Lab5

Debugging

ChipScope

Design On-board

Off-chip Devices

(and beyond)

Page 4: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

ChipScope

Your

Circuit

Dual Port

Memory

JT

AG

Ca

ble

Same Clock!

Trigger

FPGA

Software

New tool : ChipScope (1)

• In-System Debugger• “ModelSim in hardware”

• But has many limitations

• Samples signals

on clock edge

• Shows only a few

cycles

• Trigger-based

4UCB EECS150 Fall 2010, Lab Lecture #5

Page 5: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

ChipScope (2)

• Is not “Magic”• Uses block memories on the FPGA to save the

value of a signal. Saves several cycles after triggered (a pre-determined input pattern occurs)

• Software reads and displays the saved trace

• Know its limitations!• Expensive

• Can affect timing

• Gives limited visibility

5UCB EECS150 Fall 2010, Lab Lecture #5

ChipScope’s Clock

CUT Data

Data Shown by

ChipScope

Page 6: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

ChipScope (3)

Compared to ModelSim:• ModelSim

• High visibility (shows any, or every signal in the design).• Quick turnaround for debugging• Only a simulation (not guaranteed to work in hardware)• Will not show all bugs

• ChipScope• Shows values observed in hardware (the real deal)• Samples the data using a clock• Requires a complete tool cycle for debugging• Low visibility (shows only a small number of signals)

USE BOTH!

6UCB EECS150 Fall 2010, Lab Lecture #5

Page 7: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

New Policy (Lab 5 and Project)

• You get two weeks for this lab.– A design document must be shown 1 week before

check-off in your lab section.

– Design review will be on the week of the 28th.

– Both partners must be present.

– Be prepared to defend your design

– This is a part of your grade

– Stay tuned (detail in a few slides)

• Pick a partner for Lab 5!

UCB EECS150 Fall 2010, Lab Lecture #5 7

Page 8: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Lab 5 is a Partner Lab!

• Find someone to work with!

• Newsgroup can be used for match-making

• Can pick a different partner for the project

8UCB EECS150 Fall 2010, Lab Lecture #5

Page 9: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Questions?

• CS150 CAD Toolflow

• ChipScope, ModelSim

• Partnerships for Lab 5, Project

• Anything else?

9UCB EECS150 Fall 2010, Lab Lecture #5

Page 10: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Lab 5 (Mini-Project) (1)

Small part of the project

UART interface and a little something to test it

UCB EECS150 Fall 2010, Lab Lecture #5 10

SMIPS CPU

Memory Map

Instruction

Memory

Data

Memory

Frame

Buffer

(SRAM)

Graphics

Accelerator

DVI

Video

Interface

Ethernet

Interface

UART

(Serial)

Interface

SRAM

Interface

FPGA

Page 11: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Lab 5 (Mini-Project) (2)

• Use the entire toolflow

– Labs 1-4 taught you how

• Learn to use a handshake

• Build a state machine to mimic a CPU

– To test the UART Interface

• We give you a UART module

– Understand it intimately

• Practice creating design documents

11UCB EECS150 Fall 2010, Lab Lecture #5

UART

Interface

CPU Emulator

State Machine

Adapter

Page 12: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Lab 5 (Mini-Project) (3)

UCB EECS150 Fall 2010, Lab Lecture #5 12

XUPv5

Software Side

Console Interface

(0xffff_000c-

0xffff_0000)

UART

MIPS150

Processor

Emulator

RS-232 Serial Cable

Putty/Hyper-

terminalData

AddressRS-232/

Serial

Port

Virtex-5 LX110T FPGA

Page 13: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Ready-Valid Handshake (1)

• Synchronous flow control

– Synchronizes the flow of data

(within one clock domain)

• Creates a stream abstraction

• Other handshakes exist

UCB EECS150 Fall 2010, Lab Lecture #5 13

A BData

/

N

Valid

Ready

Page 14: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Ready-Valid Handshake (2)

• A transfer from A to B occurs when:– A positive edge of the clock arrives

– and B is asserting Ready

– and A is asserting Valid

• No sequence requirements

• Upon a transfer:– B may look at the Data (save, etc.)

– A must either:• de-assert valid

• Expose the next Datum

UCB EECS150 Fall 2010, Lab Lecture #5 14

A BData

/

N

Valid

Ready

Clock

Ready

Valid

Data

Transfers

Page 15: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Procedure

1) Read the specification2) DO NOT WRITE ANY VERILOG YET!3) Draw a very high-level block diagram (be neat and name

everything)4) Expand blocks into new diagrams until you understand all

details.5) Find design flaws and repeat steps 1-4.6) Think of ways to verify (test) the design.7) Show your design to the TAs. Be prepared to defend it.

8) Now implement and verify the design

UCB EECS150 Fall 2010, Lab Lecture #5 15

Page 16: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Design Documents (1)

• This will take some time– Detailed enough for someone else to implement

– Show structure and function (no screenshots)

– Use hierarchy and omit detail (no mess o’ wires)

– Xfig, OmniGraffle, Visio, etc. (no MSPaint please)

– Document all optimizations and hacks thoroughly

• A good design document will make implementation and debugging easy– Else you will pull an all-nighter.

UCB EECS150 Fall 2010, Lab Lecture #5 16

Page 17: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Design Documents (2)

• Graded out of 3 points:

Clear Understandable What?

2 1 0Solid idea An idea No idea

Past CS150 designs deserve a 1.Many commercial datasheets deserve a 0.

UCB EECS150 Fall 2010, Lab Lecture #5 17

Page 18: UART Adapter (Mini-Projectcs150/fa10/Lab/Lab5/LabLecture5.pdf · UART Adapter (Mini-Project)UCB EECS150 Fall 2010 Lab Lecture #5 UCB EECS150 Fall 2010, Lab Lecture #5 1

Acknowledgements & Contributors

Slides developed by Ilia Lebedev & John Wawrzynek (2/2010).

This work is based in part on slides by:

Ilia Lebedev, Chris Fletcher (2008-2009)

Greg Gibeling (2003-2005)

This work has been used by the following courses:– UC Berkeley CS150 (Fall 2010): Components and Design Techniques for Digital Systems

18UCB EECS150 Fall 2010, Lab Lecture #5