1 COMP541 More on State Machines; and Video Scanout Montek Singh Feb 16, 2010.

Slides:



Advertisements
Similar presentations
Computer Graphics- SCC 342
Advertisements

Introduction to Raster scan display C A E D C Computer Aided Engineering Design Centre.
1 COMP541 More on State Machines and Video Scanout Montek Singh Feb 13, 2007.
COMP541 State Machines – II: Verilog Descriptions
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Table 7.1 Verilog Operators.
1 COMP541 Video Monitors Montek Singh Oct 1, 2014.
Sumitha Ajith Saicharan Bandarupalli Mahesh Borgaonkar.
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
Slide 1 7. Verilog: Combinational always statements. VHDL: Combinational Processes: To avoid (I.E. DO NOT What in your HDL code?) Cases that generate Synthesis.
1 COMP541 Sequential Circuits Montek Singh Sep 17, 2014.
C HAPTER 20: G ETTING T ECHNICAL – T HE V IDEO S IGNAL.
Monochrome Television Block Diagram
LAB 3 – Review of the Assignment. -- Clarifications Vikram Murali. TA : CSE 140L Prof. CK Cheng.
Display Technology  Images stolen from various locations on the web...
1 COMP541 Combinational Logic and Design Montek Singh Jan 30, 2007.
1 COMP541 Sequencing and Control Montek Singh Mar 29, 2007.
Lecture 121 Lecture 12: VGA Video ECE 412: Microcomputer Laboratory.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 8, 2007.
Imaging Science Fundamentals Chester F. Carlson Center for Imaging Science Display Systems Viewing Images.
1 CCTV SYSTEMS CCTV MONITORS. 2 CCTV SYSTEMS A monitor simply allows remote viewing of cameras in a CCTV system from a control room or other location.
ECEN 248 Lab 6: De-Bouncing, Counters & LCD Display Control
Overview Logistics Last lecture Today HW5 due today
Video Monitor Uses raster scanning to display images
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Lecture No. 3.  Screen resolution  Color  Blank space between the pixels  Intentional image degradation  Brightness  Contrast  Refresh rate  Sensitivity.
ECE 448: Lab 6 VGA Display (mini chess game). Video Graphic Array (VGA) Resolution: 640x480 Display: 16 colors (4 bits), 256 colors (8 bits) Refresh Rate:
Introduction to Experiment 5 VGA Signal Generator ECE 448 Spring 2009.
L 13: – Spring Introductory Digital Systems Laboratory L13 - Video Slides 2-10 courtesy of Tayo Akinwande Take the graduate course,
Memory Layout and SLC500 System Addresses. Processor Memory Division An SLC 500 processor's memory is divided into two storage areas. Like two drawers.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VGA Display Part 1 VGA Synchronization ECE 448 Lecture 9.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Overview of Graphics Systems. Cathode-ray Tube (CRT) - colors are represented using Red, Green, and Blue components - the CRT has a mechanism for.
Introduction to VGA 數位電路實驗 TA: 吳柏辰 Author: Trumen.
Lecture 9. MIPS Processor Design – Instruction Fetch Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education &
COMP541 Video Monitors Montek Singh Oct 2, 2015.
1 CSE370, Lecture 17 Lecture 17 u Logistics n Lab 7 this week n HW6 is due Friday n Office Hours íMine: Friday 10:00-11:00 as usual íSara: Thursday 2:30-3:20.
Introduction to Graphical Hardware Display Technologies
Display Technology  Images stolen from various locations on the web...
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
2/1 A Look at Monitors Roll call Video: monitors Step-by-step lecture.
Ch5: TELEVISION.
ECE 448: Lab 4 VGA Display. Bouncing Ball.. Organization and Grading.
IT253: Computer Organization Lecture 9: Making a Processor: Single-Cycle Processor Design Tonga Institute of Higher Education.
ECE 448: Lab 5 VGA Display. Breaking-Bricks..
Figure 10.1 Color CRT and Phosphor Dots on Face of Display.
Computer Fundamentals MSCH 233 Lecture 5. The Monitor A Monitor is a video screen that looks like a TV. It displays both the input data and instructions,
1 COMP541 Combinational Logic - 3 Montek Singh Jan 23, 2012.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 11, 2010.
CRT Display Technology
10/19 Monitors CRT monitors: Flat-panel displays Electron guns
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
Week 9 Monitors and output to the screen. Monitors, also known as Visual display units (V.D.Us) Desktop computers contain a Cathode Ray Tube (C.R.T.)
1 COMP541 State Machines - II Montek Singh Feb 13, 2012.
Computer Graphics Lecture -02. Frame Buffer The image being displayed is stored in a dedicated system memory area that is often referred.
1.  The primary output device in a graphics system is a video monitor. These monitors are based on Cathode Ray Tube (CRT) design.  CRT is a vacuum tube/electron.
1 COMP541 Video Monitors Montek Singh Mar 11, 2016.
How Does Your TV Work? A brief introduction.. Two Amazing Things about the Brain 1.Connecting the dots Pixels and resolution 2.Connecting the frames 15.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Implementation of Pong over VGA on the Nexys 4 FPGA
COMP541 Video Monitors Montek Singh Oct 7, 2016.
COMP541 Video Monitors Montek Singh Sep 15, 2017.
VGA Display Part 1 VGA Synchronization
COMP541 Video Monitors Montek Singh Feb 20, 2015.
COMP541 Sequential Logic – 2: Finite State Machines
Introduction to VGA Digital Circuit Lab TA: Po-Chen Wu.
COMP541 Video Monitors Montek Singh Feb 6, 2019.
Chapter 2 Overview of Graphics Systems
VGA Display: VGA Synchronization & Pixel Generation
Presentation transcript:

1 COMP541 More on State Machines; and Video Scanout Montek Singh Feb 16, 2010

Outline  Last Friday’s lab Tips/discussion Tips/discussion  Look at Verilog coding practices Avoid generating latches Avoid generating latches Parameterized Modules Parameterized Modules  How to generate video signal 2

3 What did you have trouble with in lab?

Testing  How do you simulate/test a module that outputs a signal every millionth time? 4

Off By One?  Did you have problems if you designed a counter out of one-digit modules? 5

Good Verilog Practices  Best to use single clock for all FFs Make all signals synchronous to one clk Make all signals synchronous to one clk  no posedge button or posedge pulse  –not supported by current board Avoids “weird” and frustrating problems Avoids “weird” and frustrating problems  Multiple modules Tested individually Tested individually Top level has input and outputs Top level has input and outputs  One module per file Just to make it easier to follow and test Just to make it easier to follow and test 6

Button Debounce  Mechanical switches can “bounce”  May get a fast series of Hs and Ls 10s of milliseconds 10s of milliseconds  How do we avoid problems? 7

Button Debounce and Synchronize  Let’s try to make it simpler this time! Use it as input to test in an always statement that’s clocked by the master clock Use it as input to test in an always statement that’s clocked by the master clock State machine to detect down/up? State machine to detect down/up?  Wait for N clock cycles and then use it! 8

What else did you have trouble with in lab? 9

10 Assignment (of signals)  Continuous  Procedural Note there are two uses for always Note there are two uses for always  To generate FFs and latches (plus gates)  To generate combinational logic only –Latter does not introduce unnecessary FFs … –… if synthesizer detects all possibilities covered (i.e. no state needed)  Look at the synthesizer log

Procedural Assignment 1 module C2(output reg C = 0, input A, input B); (A or B) case ({A, B}) 2'b11: C <= 1; default: C <= 0; endcaseendmodule  Schematic next page 11

12Schematic  LUT is a look-up table  Double clicking it shows

Procedural Assignment 2 module C1(output reg C = 0, input A, input B); (A or B) begin if(A == 1 && B == 1) C <= 1; endendmodule  Synthesizer now says WARNING:Xst:737 - Found 1-bit latch for signal. WARNING:Xst: The value init of the FF/Latch C hinder the constant cleaning in the block C1. 13

14Schematic  LDE is latch  Small box is clock driver

15 In fact…  If I change the INIT of C like it says output reg C = 1 output reg C = 1  Synthesizer says INFO:Xst: Contents of register in unit never changes during circuit operation. The register is replaced by logic. INFO:Xst: Contents of register in unit never changes during circuit operation. The register is replaced by logic.

Schematic module C1(output reg C = 1, input A, input B); (A or B) begin if(A == 1 && B == 1) C <= 1; endendmodule 16

Parameterized Modules 2:1 mux: module mux2 #(parameter width = 8) // name and default value #(parameter width = 8) // name and default value (input [width-1:0] d0, d1, (input [width-1:0] d0, d1, input s, input s, output [width-1:0] y); output [width-1:0] y); assign y = s ? d1 : d0; assign y = s ? d1 : d0;endmodule Instance with 8-bit bus width (uses default): mux2 mux1(d0, d1, s, out); mux2 mux1(d0, d1, s, out); Instance with 12-bit bus width: mux2 #(12) lowmux(d0, d1, s, out);

VGA Monitors 18

19 How Do Monitors Work?  Origin is TV, so let’s look at that LCDs work on different principle, but all signaling still derived from TV of 1940s LCDs work on different principle, but all signaling still derived from TV of 1940s  Relies on your brain to do two things Integrate over space Integrate over space Integrate over time Integrate over time

Many Still Images  Video (and movies) are a series of stills If stills go fast enough your brain interprets as moving imagery If stills go fast enough your brain interprets as moving imagery  Hz or more to not see flicker In fact, even single “still” image displayed repeatedly over time In fact, even single “still” image displayed repeatedly over time Phosphor persistence varies Phosphor persistence varies 20

Cathode Ray Tube 21 From wikipedia:

Deflection Coils 22

Simple Scanning TV  Electron beam scans across  Turned off when Scanning back to the left (horizontal retrace) Scanning back to the left (horizontal retrace) Scanning to the top (vertical retrace) Scanning to the top (vertical retrace) 23

Scanning  TVs use interlacing Every other scan line is swept per field Every other scan line is swept per field Two fields per frame (30Hz) Two fields per frame (30Hz) Way to make movement less disturbing Way to make movement less disturbing  Computers use progressive scan Whole frame refreshed at once Whole frame refreshed at once 60Hz or more, 72Hz looks better 60Hz or more, 72Hz looks better 24

Color  Three colors of phosphor  Beams hit each  Black – beam off  White – all on 25 Picture is a bit misleading. Mask (or aperture grill) ensures beams hit only correct color phosphor.

Aside  Frustrated with Verilog  See what to do to relieve stress  Educational too 26

What about LCD?  We’ll talk about how they work later  They don’t scan  However, signaling is the same! For compatibility For compatibility  Same goes for micro-mirror projectors 27

28 VGA Signaling  RGB and two synchronization pulses, horizontal and vertical

VGA Timing  You supply two pulses, hsync and vsync, that let the monitor lock onto timing  One hsync per scan line  One vsync per frame  Continuous Don’t stop hsync Don’t stop hsync 29 Image from dell.com

Horizontal Timing Terms  hsync pulse  Back porch (left side of display)  Active Video Video should be blanked (not sent) at other times Video should be blanked (not sent) at other times  Front porch (right side) 30 Picture not accurate for our case; just for illustration. Video and HSYNC not on same wire

Horizontal Timing Horizontal Dots Horiz. Sync Polarity NEG Scanline time (A) us Sync pulse length (B) 3.77 us Back porch (C) 1.89 us Active video (D) us Front porch (E) 0.94 us Image from This diagram shows video as a digital signal. It’s not – video is an analog level.

Vertical Timing (note ms, not us) 32 Vert. Sync Polarity NEG Vertical Frequency 60Hz Total frame time (O) ms Sync length (P) 0.06 ms Back porch (Q) 1.02 ms Active video (R) ms Front porch (S) 0.35 ms

Timing as Pixels  Easiest to derive all timing from single-pixel timing  How “long” is a pixel? Active video / number of pixels Active video / number of pixels us / 640 = 39.32ns us / 640 = 39.32ns Conveniently close to 25 MHz – just use that Conveniently close to 25 MHz – just use that Actual VESA spec is MHz Actual VESA spec is MHz 33

Standards  640 x 480 (sometimes x 60Hz) is “VGA” I will give you spec sheets in lab I will give you spec sheets in lab  You can try for 800x600 at 60 Hz (40 MHz exactly) or 800x600 at 72 Hz (50 MHz exactly) or 800x600 at 72 Hz (50 MHz exactly)  Note that some standards have vsync and hsync positive true, some negative true – choose correct one 34

Color Depth  Voltage of each of RGB determines color  3-bit, 2-bit color here  All on for white 35

What To Do Friday 1. First finish previous lab 2. Make Verilog module to generate hsync, vsync, horizontal count, vertical count, and signal to indicate active video hsync, vsync, horizontal count, vertical count, and signal to indicate active video 3. Use higher-level module to drive RGB using counts gated by active Just do something simple; need to meet 25MHz constraint Just do something simple; need to meet 25MHz constraint 4. Later will use memory addressed by counts to make terminal 36

37 What do you Need for VGA?  Think first Need counter(s)? Need counter(s)? Will you need a state machine? Will you need a state machine?  Sketch out a design Block diagram Block diagram  Test individually in lab  Keep in Mind Verilog has all these operators (and more; see Verilog ref.) Verilog has all these operators (and more; see Verilog ref.) ==,, = ==,, =

Next week’s lab: Character Terminal?  No frame buffer  Character terminal 38

Future Labs Preview  VGA timing generator  Character terminal (learn memories)  MIPS datapath  Add load/store  Add branching  Peripherals  Final project 39

VGA Links  VGA Timing  Code (more complex than you want)  Interesting Liquid Crystals by S. Chandrasekhar, Cambridge Univ. Press Liquid Crystals by S. Chandrasekhar, Cambridge Univ. Press 40

Next Time  Sequential Timing  Metastability  Homework due 41