DOC PREVIEW
Berkeley COMPSCI 150 - Lecture 14 - Project Description

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Spring 2009EECS150 - Lec14-proj4Page EECS150 - Digital DesignLecture 14 - Project Description, Part 4 of 4March 5, 2009John Wawrzynek1Spring 2009EECS150 - Lec14-proj4Page Project OverviewA. MIPS150 pipeline structureB. Memories, project memories and FPGAsC. Project specification and grading standard D.Video subsystemE.Line DrawingF. Bit Shifters2Spring 2009EECS150 - Lec14-proj4Page MIPS150 Video Subsystem3  • Gives software ability to display information on screen.• Equivalent to standard graphics cards:• Processor can directly write the display bit map• Graphics acceleration 2D line drawing (only).Spring 2009EECS150 - Lec14-proj4Page Video Subsystem4CPU InterfaceContinuously reads framebuffer data making mapped pixel values available to Video Interface.Requests mapped pixels and sends along with control signals to DVI Chip.Spring 2009EECS150 - Lec14-proj4Page MIPS150 CPU Memory Map SummaryMIPS convention:0x0000_0000 0x0040_0000 reserved0x0040_0000 0x1001_0000 text segment0x1001_0000 0x7fff_ffff data segment0x8000_0000 0xffff_ffff I/OThe stack starts at 0x7fff_ffff and grows towards smaller addresses.EECS150MIPS:0x0040_0000 0x0040_0ffc I-Memory (1K words) We might grow this.0x1001_0000 0x1001_0ffc Data Memory (heap) (1K words for heap)0x7fff_f000 0x7fff_fffc Data Memory (stack) (1K words for stack)0x8000_0000 0x803f_fffc Framebuffer (1M addresses) (Only 786432 are needed)0x8040_0000 0x8040_0038 Color Map (16 word addresses)0xffff_0000 0xffff_000c Serial Interface (4 word addresses)I-Memory, Framebuffer, ColorMap are all write-only by CPU.5Spring 2009EECS150 - Lec14-proj4Page Graphics Software6clear: # a0 holds 4-bit pixel color # t0 holds the pixel pointer ori $t0, $0, 0x8000 # top half of frame address sll $t0, $t0, 16 # form framebuffer beginning address # t2 holds the framebuffer max address ori $t2, $0, 768 # pixels per row sll $t2, $t2, 12 # * 1K rows * 4 Bytes/address addu $t2, $t2, $t0 # form beginning address + size addiu $t2, $t2, -4 # minus one word address!# # the write loopL0: sw $a0, 0($t0) # write the pixel bneq $t0, $t2, L0 # loop until done addiu $t0, $t0, 4 # bump pointer! jr $ra“Clearing” the screen - fill the entire screen with same color Remember Framebuffer base address: 0x8000_0000Size: 768 * 1024How long does this take? What do we need to know to answer?How does this compare to the frame rate?Spring 2009EECS150 - Lec14-proj4Page Optimized Clear Routine7clear:... # the write loopL0: sw $a0, 0($t0) # write some pixels sw $a0, 4($t0) sw $a0, 8($t0) sw $a0, 12($t0) sw $a0, 16($t0) sw $a0, 20($t0) sw $a0, 24($t0) sw $a0, 28($t0) sw $a0, 32($t0) sw $a0, 36($t0) sw $a0, 40($t0) sw $a0, 44($t0) sw $a0, 48($t0) sw $a0, 52($t0) sw $a0, 56($t0) sw $a0, 60($t0) bneq $t0, $t2, L0 # loop until done addiu $t0, $t0, 64 # bump pointer jr $raWhat’s the performance of this one?Amortizing the loop overhead.Spring 2009EECS150 - Lec14-proj4Page Line Drawing800 1 2 3 4 5 6 7 8 9 10 11 121234567(x0,y0) (x1,y1)From toLine equation defines all the points:For each x value, could compute y, with: then round to the nearest integer y value.Slope can be precomputed, but still requires floating point * and + in the loop: slow or expensive!Spring 2009EECS150 - Lec14-proj4Page Bresenham Line Drawing Algorithm• Computers of the day, slow at complex arithmetic operations, such as multiply, especially on floating point numbers.• Bresenham’s algorithm works with integers and without multiply or divide.• Simplicity makes it appropriate for inexpensive hardware implementation.• With extension, can be used for drawing circles.9Developed by Jack E. Bresenham in 1962 at IBM. "I was working in the computation lab at IBM's San Jose development lab. A Calcomp plotter had been attached to an IBM 1401 via the 1407 typewriter console. ...Spring 2009EECS150 - Lec14-proj4Page Line Drawing Algorithm10This version assumes: x0 < x1, y0 < y1, slope < 45 degreesfunction line(x0, x1, y0, y1) int deltax := x1 - x0 int deltay := y1 - y0 int error := deltax / 2 int y := y0 for x from x0 to x1 plot(x,y) error := error - deltay if error < 0 then y := y + 1 error := error + deltaxNote: error starts at deltax/2 and gets decremented by deltay for each x, y gets incremented when error goes negative, therefore y gets incremented at a rate proportional to deltax/deltay.Spring 2009EECS150 - Lec14-proj4Page Line Drawing, Examples110 1 2 3 4 5 6 7 8 9 10 11 121234567deltay = 1 (very low slope). y only gets incremented once (halfway between x0 and x1)0 1 2 3 4 5 6 7 8 9 10 11 121234567deltay = deltax (45 degrees, max slope). y gets incremented for every xSpring 2009EECS150 - Lec14-proj4Page Line Drawing Example120 1 2 3 4 5 6 7 8 9 10 11 121234567function line(x0, x1, y0, y1) int deltax := x1 - x0 int deltay := y1 - y0 int error := deltax / 2 int y := y0 for x from x0 to x1 plot(x,y) error := error - deltay if error < 0 then y := y + 1 error := error + deltaxdeltax = 10, deltay = 4, error = 10/2 = 5, y = 1x = 1: plot(1,1)error = 5 - 4 = 1x = 2: plot(2,1)error = 1 - 4 = -3 y = 1 + 1 = 2 error = -3 + 10 = 7x = 3: plot(3,2)error = 7 - 4 = 3x = 4: plot(4,2)error = 3 - 4 = -1 y = 2 + 1 = 3 error = -1 + 10 = 9x = 5:


View Full Document

Berkeley COMPSCI 150 - Lecture 14 - Project Description

Documents in this Course
Lab 2

Lab 2

9 pages

Debugging

Debugging

28 pages

Lab 1

Lab 1

15 pages

Memory

Memory

13 pages

Lecture 7

Lecture 7

11 pages

SPDIF

SPDIF

18 pages

Memory

Memory

27 pages

Exam III

Exam III

15 pages

Quiz

Quiz

6 pages

Problem

Problem

3 pages

Memory

Memory

26 pages

Lab 1

Lab 1

9 pages

Memory

Memory

5 pages

Load more
Download Lecture 14 - Project Description
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 14 - Project Description and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 14 - Project Description 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?