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

Subversion Repositories graphiti

[/] [graphiti/] [trunk/] [xilinx/] [miniga.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 pototschni
-------------------------------------------------------------------------------
2
--      MiniGA
3
--  Author: Thomas Pototschnig (thomas.pototschnig@gmx.de)
4
--
5
--  License: Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License
6
--           http://creativecommons.org/licenses/by-nc-sa/2.0/de/
7
--
8
--  If you want to use MiniGA for commercial purposes please contact the author
9
--
10
--  clkin = 45MHz
11
-------------------------------------------------------------------------------
12
library IEEE;
13
use IEEE.STD_LOGIC_1164.ALL;
14
use IEEE.STD_LOGIC_ARITH.ALL;
15
use IEEE.STD_LOGIC_UNSIGNED.ALL;
16
 
17
entity miniga is
18
        generic (
19
                ADR_WIDTH : integer := 19; -- A0 bis A18
20
                DATA_WIDTH : integer := 16 -- D0 bis A15
21
        );
22
        port (
23
                clkin : in std_logic;
24
                reset : in std_logic;
25
 
26
-- das digitale video   
27
                pixelclock : out std_logic;
28
                digitalvideo : out std_logic_vector (9 downto 0);
29
 
30
                ram_adr : out std_logic_vector ((ADR_WIDTH-1) downto 0);
31
                ram_data: inout std_logic_vector ((DATA_WIDTH-1) downto 0);
32
                ram_rd : out std_logic;
33
                ram_wr : out std_logic;
34
                ram_cs : out std_logic;
35
 
36
-- spi-interface
37
                spi_ss : in std_logic;
38
                spi_clk : in std_logic;
39
                spi_data : in std_logic;
40
                spi_cd : in std_logic
41
        );
42
end miniga;
43
 
44
 
45
architecture behaviour of miniga is
46
signal clk60M : std_logic;
47
signal clk15M : std_logic;
48
signal clk45M : std_logic;
49
signal sync : std_logic;
50
 
51
signal adr1 : std_logic_vector ((ADR_WIDTH-1) downto 0);
52
signal data1_in : std_logic_vector ((DATA_WIDTH-1) downto 0);
53
signal data1_out : std_logic_vector ((DATA_WIDTH-1) downto 0);
54
signal wr1 : std_logic;
55
 
56
signal adr2 : std_logic_vector ((ADR_WIDTH-1) downto 0);
57
signal data2_in : std_logic_vector ((DATA_WIDTH-1) downto 0);
58
signal data2_out : std_logic_vector ((DATA_WIDTH-1) downto 0);
59
signal rd2 : std_logic;
60
 
61
signal picdata : std_logic_vector (15 downto 0);
62
 
63
signal framereset : std_logic;
64
signal readmem : std_logic;
65
 
66
signal en_bild : std_logic;
67
 
68
signal dummy : std_logic_vector (5 downto 0);
69
 
70
signal testbild_r : std_logic_vector (4 downto 0);
71
signal testbild_g : std_logic_vector (4 downto 0);
72
signal testbild_b : std_logic_vector (4 downto 0);
73
 
74
signal testbild_data : std_logic_vector (15 downto 0);
75
 
76
signal memory_data : std_logic_vector (15 downto 0);
77
 
78
signal testbild_en : std_logic;
79
 
80
component clk is
81
        port (
82
                clkin : in std_logic;
83
                reset : in std_logic;
84
                clk60M : out std_logic;
85
                clk45M : out std_logic;
86
                clk15M : out std_logic;
87
                pixclk : out std_logic;
88
                sync : out std_logic
89
        );
90
end component;
91
 
92
component csr is
93
        generic (
94
                ADR_WIDTH : integer := 19; -- A0 bis A18
95
                DATA_WIDTH : integer := 16 -- D0 bis D15
96
        );
97
        port (
98
                clk4x : in std_logic;
99
                reset : in std_logic;
100
                clk : in std_logic;
101
                sync : in std_logic;
102
 
103
                ram_adr : out std_logic_vector ((ADR_WIDTH-1) downto 0);
104
                ram_data: inout std_logic_vector ((DATA_WIDTH-1) downto 0);
105
                ram_rd : out std_logic;
106
                ram_wr : out std_logic;
107
                ram_cs : out std_logic; -- insg. 2 SRAMs mit verschiedene CS!
108
 
109
                adr1 : in std_logic_vector ((ADR_WIDTH-1) downto 0);
110
                data1_in : in std_logic_vector ((DATA_WIDTH-1) downto 0);
111
                data1_out : out std_logic_vector ((DATA_WIDTH-1) downto 0);
112
                rd1 : in std_logic;
113
                wr1 : in std_logic;
114
 
115
                adr2 : in std_logic_vector ((ADR_WIDTH-1) downto 0);
116
                data2_in : in std_logic_vector ((DATA_WIDTH-1) downto 0);
117
                data2_out : out std_logic_vector ((DATA_WIDTH-1) downto 0);
118
                rd2 : in std_logic;
119
                wr2 : in std_logic
120
        );
121
end component;
122
 
123
component spi is
124
        port (
125
                clk : in std_logic;
126
                reset : in std_logic;
127
                spi_ss : in std_logic;
128
                spi_clk : in std_logic;
129
                spi_data : in std_logic;
130
                spi_cd : in std_logic;
131
 
132
                out_adr : out std_logic_vector (18 downto 0);
133
                out_data : out std_logic_vector (15 downto 0);
134
                out_wr : out std_logic;
135
 
136
                testbild_en : out std_logic
137
        );
138
end component;
139
 
140
component pal is
141
        Port (
142
                clk : in std_logic;
143
                clk15M : in std_logic;
144
                reset : in std_logic;
145
                output : out std_logic_vector (15 downto 0);
146
                in_r : in std_logic_vector (4 downto 0);
147
                in_g : in std_logic_vector (4 downto 0);
148
                in_b : in std_logic_vector (4 downto 0);
149
                framereset : out std_logic;
150
                en_bild : out std_logic;
151
                readmem: out std_logic
152
        );
153
end component;
154
 
155
 
156
begin
157
 
158
I3: pal port map (
159
        clk => clk45M,
160
        clk15M => clk15M,
161
        reset => reset,
162
        output (15 downto 6) => digitalvideo,
163
        output (5 downto 0) => dummy,
164
        in_r => picdata (15 downto 11),
165
        in_g => picdata (10 downto 6),
166
        in_b => picdata (4 downto 0),
167
        framereset => framereset,
168
        en_bild => en_bild,
169
        readmem => readmem
170
 
171
);
172
 
173
I0: clk port map (
174
        clkin => clkin,
175
        reset => reset,
176
        clk60M => clk60M,
177
        clk15M => clk15M,
178
        clk45M => clk45M,
179
        pixclk => pixelclock,
180
        sync => sync
181
);
182
 
183
I1: csr port map (
184
        clk4x => clk60M,
185
        clk => clk15M,
186
        reset => reset,
187
        sync => sync,
188
 
189
-- direkt mappen
190
        ram_data => ram_data,
191
        ram_cs => ram_cs,
192
-- die hier gehen erstmal über signale
193
        ram_adr => ram_adr,
194
        ram_rd => ram_rd,
195
        ram_wr => ram_wr,
196
 
197
-- spi
198
        adr1 => adr1,
199
        data1_in => data1_in,
200
        data1_out => data1_out,
201
        rd1 => '1',     -- wird nicht gelesen
202
        wr1 => wr1,
203
-- pixel lesen  
204
        adr2 => adr2,
205
        data2_in => data2_in,
206
        data2_out => data2_out,
207
        rd2 => rd2,
208
        wr2 => '1' -- wird nicht geschrieben
209
);
210
 
211
I2: spi port map (
212
        clk => clk15M,
213
        reset => reset,
214
        spi_ss => spi_ss,
215
        spi_clk => spi_clk,
216
        spi_data => spi_data,
217
        spi_cd => spi_cd,
218
        out_adr => adr1,
219
        out_data => data1_in,
220
        out_wr => wr1,
221
        testbild_en => testbild_en
222
 
223
);
224
 
225
testbild_data (15 downto 11) <= testbild_r;
226
testbild_data (10 downto 6) <= testbild_g;
227
testbild_data (4 downto 0) <= testbild_b;
228
testbild_data (5) <= '0';
229
 
230
with testbild_en select
231
   picdata <= testbild_data when '1', memory_data when others;
232
 
233
 
234
        process (clk15M, en_bild, reset)
235
        variable r2yctr : integer := 0;
236
        variable ctr2 : integer := 0;
237
        begin
238
                if en_bild='0' or reset='0' then
239
                        r2yctr :=0 ;
240
                        ctr2 := 0;
241
                        testbild_r <= "00000";
242
                        testbild_g <= "00000";
243
                        testbild_b <= "00000";
244
                elsif clk15m'event and clk15m='1' then
245
                        case r2yctr is
246
                                when 0 => testbild_r <= "11111"; testbild_g <= "11111"; testbild_b <= "11111";
247
                                when 1 => testbild_r <= "11111"; testbild_g <= "11111"; testbild_b <= "00000";
248
                                when 2 => testbild_r <= "00000"; testbild_g <= "11111"; testbild_b <= "11111";
249
                                when 3 => testbild_r <= "00000"; testbild_g <= "11111"; testbild_b <= "00000";
250
                                when 4 => testbild_r <= "11111"; testbild_g <= "00000"; testbild_b <= "11111";
251
                                when 5 => testbild_r <= "11111"; testbild_g <= "00000"; testbild_b <= "00000";
252
                                when 6 => testbild_r <= "00000"; testbild_g <= "00000"; testbild_b <= "11111";
253
                                when 7 => testbild_r <= "00000"; testbild_g <= "00000"; testbild_b <= "00000";
254
                                when others => testbild_r <= "00000"; testbild_g <= "00000"; testbild_b <= "00000";
255
                        end case;
256
                        ctr2 := ctr2 + 1;
257
                        if ctr2 = 90 then
258
                                ctr2 := 0;
259
                                r2yctr := r2yctr + 1;
260
                                if (r2yctr = 8) then
261
                                        r2yctr := 0;
262
                                end if;
263
                        end if;
264
                end if;
265
        end process;
266
 
267
-- fpga adresse inkrementieren
268
process (clk15M, framereset, reset)
269
variable colctr, rowctr : integer;
270
variable adrctr : integer := 0;
271
 
272
begin
273
        if reset='0' or framereset='1' then
274
                adrctr := 0;
275
                rowctr := 0;
276
                colctr := 0;
277
                rd2 <='1';
278
        elsif clk15M'event and clk15M='1' then
279
                rd2 <='0';
280
                memory_data <= data2_out;
281
                if en_bild = '1' AND readmem = '1' then
282
                        if colctr = 779 then
283
                                adrctr := adrctr + 781;
284
                                colctr := 0;
285
                                rowctr := rowctr + 1;
286
                        else
287
                                adrctr := adrctr + 1;
288
                                colctr := colctr + 1;
289
                        end if;
290
                        if rowctr = 288 then
291
                                adrctr := 780;
292
                                colctr := 0;
293
                                rowctr := 289;
294
                        elsif rowctr = 577 then
295
                                adrctr := 0;
296
                                colctr := 0;
297
                                rowctr := 0;
298
                        end if;
299
                        adr2 <= conv_std_logic_vector(adrctr,19);
300
                else
301
                        rd2 <= '1';
302
                        adrctr := adrctr;
303
                        memory_data <= (others => '0');
304
                        adr2 <= (others => '0');
305
                end if;
306
        end if;
307
end process;
308
 
309
data2_in <= "0000000000000000";
310
 
311
end architecture;

powered by: WebSVN 2.1.0

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