Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `ifndef _vga_svh_
- `define _vga_svh_
- // `define RGB
- `ifndef RGB
- `define WHITE
- `endif
- // `define VGA640X480
- `define VGA1280X1024
- `ifdef VGA640X480
- // VGA Signal 640 x 480 @ 60 Hz Industry standard timing
- // http://tinyvga.com/vga-timing/640x480@60Hz
- // General timing
- // Screen refresh rate 60 Hz
- // Vertical refresh 31.46875 kHz
- // Pixel freq. 25.175 MHz
- // Horizontal timing (line)
- // Polarity of horizontal sync pulse is negative.
- // Scanline part Pixels Time [µs]
- // Visible area 640 25.422045680238
- `define VISIBLE_LINE_PXLS 640
- // Front porch 16 0.63555114200596
- `define HORIZ_FRONT_PORCH_PXLS 16
- // Sync pulse start = 640 + 16 = 656
- // Sync pulse 96 3.8133068520357
- `define HORIZ_SYNC_PULSE_PXLS 96
- // Sync pulse end = 640 + 16 + 96 = 752
- // Back porch 48 1.9066534260179
- // Whole line 800 31.777557100298
- `define WHOLE_LINE_PXLS 800
- // Vertical timing (frame)
- // Polarity of vertical sync pulse is negative.
- // Frame part Lines Time [ms]
- // Visible area 480 15.253227408143
- `define VISIBLE_FRAME_PXLS 480
- // Front porch 10 0.31777557100298
- `define VERT_FRONT_PORCH_PXLS 10
- // Sync pulse start = 480 + 10 = 490
- // Sync pulse 2 0.063555114200596
- `define VERT_SYNC_PULSE_PXLS 2
- // Back porch 33 1.0486593843098
- // Sync pulse end = 480 + 10 + 2 = 492
- // Whole frame 525 16.683217477656
- `define VERT_FRAME_PXLS 525
- // counters dim to hold max of `WHOLE_LINE_PXLS and `VERT_FRAME_PXLS
- `define CNT_WDT 10
- `elsif VGA1280X1024
- // VESA Signal 1280 x 1024 @ 60 Hz timing
- // http://tinyvga.com/vga-timing/1280x1024@60Hz
- // General timing
- // Screen refresh rate 60 Hz
- // Vertical refresh 63.981042654028 kHz
- // Pixel freq. 108.0 MHz
- // Horizontal timing (line)
- // Polarity of horizontal sync pulse is positive.
- // Scanline part Pixels Time [µs]
- // Visible area 1280 11.851851851852
- `define VISIBLE_LINE_PXLS 1280
- // Front porch 48 0.44444444444444
- `define HORIZ_FRONT_PORCH_PXLS 48
- // Sync pulse 112 1.037037037037
- `define HORIZ_SYNC_PULSE_PXLS 112
- // Back porch 248 2.2962962962963
- // Whole line 1688 15.62962962963
- `define WHOLE_LINE_PXLS 1688
- // Vertical timing (frame)
- // Polarity of vertical sync pulse is positive.
- // Frame part Lines Time [ms]
- // Visible area 1024 16.004740740741
- `define VISIBLE_FRAME_PXLS 1024
- // Front porch 1 0.01562962962963
- `define VERT_FRONT_PORCH_PXLS 1
- // Sync pulse 3 0.046888888888889
- `define VERT_SYNC_PULSE_PXLS 3
- // Back porch 38 0.59392592592593
- // Whole frame 1066 16.661185185185
- `define VERT_FRAME_PXLS 1066
- `define CNT_WDT 11
- `else // defaulf - for test purposes
- `define VISIBLE_LINE_PXLS 100
- `define HORIZ_FRONT_PORCH_PXLS 2
- `define HORIZ_SYNC_PULSE_PXLS 4
- `define WHOLE_LINE_PXLS 150
- `define VISIBLE_FRAME_PXLS 50
- `define VERT_FRONT_PORCH_PXLS 3
- `define VERT_SYNC_PULSE_PXLS 2
- `define VERT_FRAME_PXLS 70
- `endif
- // Sync pulse start = Visible area + Front porch
- `define HORIZ_SYNC_PRE_PXLS (`VISIBLE_LINE_PXLS + `HORIZ_FRONT_PORCH_PXLS)
- // Sync pulse end = Visible area + Front porch + Sync pulse
- `define HORIZ_SYNC_POST_PXLS (`VISIBLE_LINE_PXLS + `HORIZ_FRONT_PORCH_PXLS + `HORIZ_SYNC_PULSE_PXLS)
- // Sync pulse start = Visible area + Front porch
- `define VERT_SYNC_PRE_PXLS (`VISIBLE_FRAME_PXLS + `VERT_FRONT_PORCH_PXLS)
- // Sync pulse end = Visible area + Front porch + Sync pulse
- `define VERT_SYNC_POST_PXLS (`VISIBLE_FRAME_PXLS + `VERT_FRONT_PORCH_PXLS + `VERT_SYNC_PULSE_PXLS)
- `define CNT_RNG [`CNT_WDT-1:0]
- `define FIRST_HORIZ_BORDER_PXLS (`VISIBLE_FRAME_PXLS / 3)
- `define SECOND_HORIZ_BORDER_PXLS (`VISIBLE_FRAME_PXLS - `VISIBLE_FRAME_PXLS / 3)
- `endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement