OpenCores
URL https://opencores.org/ocsvn/z80soc/z80soc/trunk

Subversion Repositories z80soc

[/] [z80soc/] [trunk/] [V0.7.1a/] [S3E/] [vhdl/] [video.vhd] - Blame information for rev 42

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 41 rrred
-- Z80SoC for Spartan 3E
2
-- Ronivon Candido Costa
3
--
4
-- 2010 - 02 - 17 Update
5
-- Changed the entity to include signals for the char memory
6
-- The char memory is a dual port ram memory, and now
7
--     the char paterns can be modified by software.
8
-- 
9
--
10
library IEEE;
11
use  IEEE.STD_LOGIC_1164.all;
12
use  IEEE.STD_LOGIC_ARITH.all;
13
use  IEEE.STD_LOGIC_UNSIGNED.all;
14
use  work.z80soc_pack.all;
15
 
16
ENTITY video is
17
        PORT(   CLOCK_25                : IN STD_LOGIC;
18
                        VRAM_DATA               : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
19
                        VRAM_ADDR               : OUT STD_LOGIC_VECTOR(12 DOWNTO 0);
20
                        VRAM_CLOCK              : OUT STD_LOGIC;
21
                        VRAM_WREN               : OUT STD_LOGIC_VECTOR(0 DOWNTO 0);
22
                        CRAM_DATA               : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
23
                        CRAM_ADDR               : OUT STD_LOGIC_VECTOR(10 DOWNTO 0);
24
                        CRAM_WEB                        : OUT STD_LOGIC_VECTOR(0 DOWNTO 0);
25
                        VGA_R,
26
                        VGA_G,
27
                        VGA_B                           : OUT STD_LOGIC;
28
                        VGA_HS,
29
                        VGA_VS                  : OUT STD_LOGIC);
30
END video;
31
 
32
ARCHITECTURE A OF video IS
33
 
34
 
35
 
36
        -- Added for VDU support
37
        constant vid_width                      : std_logic_vector := "001010000"; -- 80 columns
38
        signal Clock_video                      : std_logic;
39
        signal VGA_R_sig                                : std_logic;
40
        signal VGA_G_sig                                : std_logic;
41
        signal VGA_B_sig                                : std_logic;
42
        signal pixel_row_sig                    : std_logic_vector(9 downto 0);
43
        signal pixel_column_sig         : std_logic_vector(9 downto 0);
44
        --signal pixel_row_sigFF                : std_logic_vector(9 downto 0);
45
        --signal pixel_column_sigFF     : std_logic_vector(9 downto 0);
46
        signal pixel_clock_sig          : std_logic;
47
        signal char_addr_sig                    : std_logic_vector(7 downto 0);
48
        signal font_row_sig                     : std_logic_vector(2 downto 0);
49
        signal font_col_sig                     : std_logic_vector(2 downto 0);
50
        signal pixel_sig                                : std_logic;
51
        signal video_on_sig                     : std_logic;
52
 
53
        constant sv1                            : integer := 3 + pixelsxchar - 1;
54
        constant sv2                            : integer := 9 + pixelsxchar - 1;
55
        constant cv1                            : integer := 0 + pixelsxchar - 1;
56
        constant cv2                            : integer := 2 + pixelsxchar - 1;
57
        signal fix                                      : integer;
58
 
59
COMPONENT VGA_SYNC
60
        PORT(   clock_25Mhz                                                     : IN    STD_LOGIC;
61
                        red, green, blue                                        : IN    STD_LOGIC;
62
                        red_out, green_out, blue_out    : OUT   STD_LOGIC;
63
                        horiz_sync_out, vert_sync_out,
64
                        video_on, pixel_clock                   : OUT   STD_LOGIC;
65
                        pixel_row, pixel_column                 : OUT   STD_LOGIC_VECTOR(9 DOWNTO 0));
66
END COMPONENT;
67
 
68
BEGIN
69
 
70
        VGA_R_sig <= '0';
71
        VGA_G_sig <= '0';
72
        VGA_B_sig <= pixel_sig;
73
 
74
        -- Fonts ROM read
75
        VRAM_WREN(0) <= '1';
76
        VRAM_CLOCK <= pixel_clock_sig;
77
        VRAM_ADDR <= pixel_row_sig(sv2 downto sv1) * conv_std_logic_vector(vid_cols,7) + pixel_column_sig(sv2 downto sv1);
78
 
79
        -- Fonts RAM read
80
        -- Takes the letter, calculates the position in the char memory to get the pixel pattern
81
        -- Plot the pixel in the video
82
        -- Using pixel_row(3 downto 1) has the effect of "shifting" (multiplying by 2)
83
        -- This will plot 2 pixels on video for every pixel defined on char memory
84
        CRAM_WEB(0) <= '1';
85
        CRAM_ADDR <= VRAM_DATA & pixel_row_sig(cv2 downto cv1);
86
        fix <= 1 when pixelsxchar = 2 else 2;
87
        pixel_sig <= CRAM_DATA (CONV_INTEGER(NOT (pixel_column_sig(cv2 downto cv1) - fix)))  when
88
                    ( (pixel_row_sig < (pixelsxchar * 8 * vid_lines)) and (pixel_column_sig < (pixelsxchar * 8 * vid_cols)) ) else
89
                '0';
90
 
91
        vga_sync_inst : vga_sync
92
                port map (
93
                        clock_25Mhz                     => CLOCK_25,
94
                        red                                     => VGA_R_sig,
95
                        green                                   => VGA_G_sig,
96
                        blue                                    => VGA_B_sig,
97
                        red_out                         => VGA_R,
98
                        green_out                       => VGA_G,
99
                        blue_out                                => VGA_B,
100
                        horiz_sync_out          => VGA_HS,
101
                        vert_sync_out           => VGA_VS,
102
                        video_on                                => video_on_sig,
103
                        pixel_clock                     => pixel_clock_sig,
104
                        pixel_row                       => pixel_row_sig,
105
                        pixel_column            => pixel_column_sig
106
        );
107
 
108
END A;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.