OpenCores
URL https://opencores.org/ocsvn/ov7670-sccb/ov7670-sccb/trunk

Subversion Repositories ov7670-sccb

[/] [ov7670-sccb/] [trunk/] [hdl/] [turkish/] [hdl/] [SCCBRegisterTable.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 ibrahimvar
-----------------------------------------------------------------------------------
2
-- OV7670 CMOS kamera modulunun RGB565 modunda calismasini saglayan register
3
-- ve bu registerlerin olmasi gereken verileri icerir.
4
-----------------------------------------------------------------------------------
5
 
6
library IEEE;
7
use IEEE.STD_LOGIC_1164.all;
8
use IEEE.STD_LOGIC_UNSIGNED.all;
9
use IEEE.NUMERIC_STD.all;
10
 
11
entity SCCBRegisterTable is
12
    port (
13
        PIClock         : in    std_logic;
14
        PIReset         : in    std_logic;
15
        PITrig          : in    std_logic;
16
        PIDone          : in    std_logic;
17
        PIReady         : in    std_logic;
18
        POCfgFinished   : out   std_logic;
19
        POStart         : out   std_logic;
20
        POEnable        : out   std_logic;
21
        POAddress       : out   std_logic_vector(6 downto 0);
22
        PORegister      : out   std_logic_vector(7 downto 0);
23
        POWriteData     : out   std_logic_vector(7 downto 0)
24
    );
25
 
26
end SCCBRegisterTable;
27
 
28
architecture Behavioral of SCCBRegisterTable is
29
    constant    CDeviceBaseAddress  :   std_logic_vector(7 downto 0)    := x"21";
30
    constant    CDeviceWriteAddress :   std_logic_vector(7 downto 0)    := x"42";
31
    constant    CDeviceReadAddress  :   std_logic_vector(7 downto 0)    := x"43";
32
 
33
 
34
 
35
    signal      STrig               :   std_logic                       := '0';
36
    signal      SDone               :   std_logic                       := '0';
37
    signal      SReady              :   std_logic                       := '0';
38
    signal      SCfgFinished        :   std_logic                       := '0';
39
    signal      SStart              :   std_logic                       := '0';
40
    signal      SEnable             :   std_logic                       := '0';
41
    signal      SAddress            :   std_logic_vector(6 downto 0)    := (others => '0');
42
    signal      SRegister           :   std_logic_vector(7 downto 0)    := (others => '0');
43
    signal      SWriteData          :   std_logic_vector(7 downto 0)    := (others => '0');
44
 
45
 
46
    signal      STrigPrev           :   std_logic                       := '0';
47
    signal      STrigRising         :   std_logic                       := '0';
48
    signal      STrigFalling        :   std_logic                       := '0';
49
 
50
    signal      SReadyPrev          :   std_logic                       := '0';
51
    signal      SReadyRising        :   std_logic                       := '0';
52
 
53
    signal      SCounter            :   integer range 0 to 58           := 0;
54
 
55
 
56
    signal      SWaitCtr            :   integer range 0 to 255                           := 0;
57
 
58
 
59
begin
60
    STrig           <=  PITrig;
61
    SDone           <=  PIDone;
62
    SReady          <=  PIReady;
63
 
64
    POCfgFinished   <=  SCfgFinished;
65
    POStart         <=  SStart;
66
    POEnable        <=  SEnable;
67
    POAddress       <=  SAddress;
68
    PORegister      <=  SRegister;
69
    POWriteData     <=  SWriteData;
70
 
71
    READY_EDGE : process(PIClock, PIReset)
72
    begin
73
        if PIReset = '0' then
74
            SReadyPrev      <= '0';
75
            SReadyRising    <= '0';
76
        elsif rising_edge(PIClock) then
77
            SReadyPrev  <= SReady;
78
            if SReady = '1' and SReadyPrev = '0' then
79
                SReadyRising <= '1';
80
            else
81
                SReadyRising <= '0';
82
            end if;
83
        end if;
84
    end process;
85
 
86
    TRIG_EDGES :   process(PIClock, PIReset)
87
    begin
88
        if PIReset = '0' then
89
            STrigPrev       <= '0';
90
            STrigRising     <= '0';
91
            STrigFalling    <= '0';
92
        elsif rising_edge(PIClock) then
93
            STrigPrev   <= STrig;
94
            if STrig = '1' and STrigPrev = '0' then
95
                STrigRising     <= '1';
96
            else
97
                STrigRising     <= '0';
98
            end if;
99
 
100
            if STrig = '0' and STrigPrev = '1' then
101
                STrigFalling    <= '1';
102
            else
103
                STrigFalling    <= '0';
104
            end if;
105
        end if;
106
    end process;
107
 
108
    BACKEND :   process(PIClock, PIReset)
109
    begin
110
        if PIReset = '0' then
111
            SCfgFinished    <= '0';
112
            SStart          <= '0';
113
            SEnable         <= '0';
114
            SAddress        <= (others => '0');
115
            SRegister       <= (others => '0');
116
            SWriteData      <= (others => '0');
117
            SCounter        <= 0;
118
        elsif rising_edge(PIClock) then
119
                if SWaitCtr <= 254 then
120
                        SWaitCtr <= SWaitCtr + 1;
121
                else
122
                if (SReady = '1' and STrigFalling = '1' and SStart = '0') or (SStart = '1' and SReadyRising = '1') then
123
                    SEnable     <=  '1';
124
                    SStart      <=  '1';
125
                    SAddress    <=  CDeviceBaseAddress(6 downto 0);
126
                    if SCounter <= 56 then
127
                        SCounter    <= SCounter + 1;
128
                        case SCounter is
129
                            when 0 =>
130
                                SRegister   <= x"12";
131
                                SWriteData  <= x"80";
132
                            when 1 =>
133
 
134
                                SRegister   <= x"12";
135
                                SWriteData  <= x"80";
136
                            when 2 =>
137
                                SRegister   <= x"12";
138
                                SWriteData  <= x"04";
139
                            when 3 =>
140
                                SRegister   <= x"11";
141
                                SWriteData  <= x"00";
142
                            when 4 =>
143
                                SRegister   <= x"0C";
144
                                SWriteData  <= x"00";
145
                            when 5 =>
146
                                SRegister   <= x"3E";
147
                                SWriteData  <= x"00";
148
                            when 6 =>
149
                                SRegister   <= x"8C";
150
                                SWriteData  <= x"00";
151
                            when 7 =>
152
                                SRegister   <= x"04";
153
                                SWriteData  <= x"00";
154
                            when 8 =>
155
                                SRegister   <= x"40";
156
                                SWriteData  <= x"10";
157
                            when 9 =>
158
                                SRegister   <= x"3A";
159
                                SWriteData  <= x"04";
160
                            when 10 =>
161
                                SRegister   <= x"14";
162
                                SWriteData  <= x"38";
163
                            when 11 =>
164
                                SRegister   <= x"4F";
165
                                SWriteData  <= x"40";
166
                            when 12 =>
167
                                SRegister   <= x"50";
168
                                SWriteData  <= x"34";
169
                            when 13 =>
170
                                SRegister   <= x"51";
171
                                SWriteData  <= x"0C";
172
                            when 14 =>
173
                                SRegister   <= x"52";
174
                                SWriteData  <= x"17";
175
                            when 15 =>
176
                                SRegister   <= x"53";
177
                                SWriteData  <= x"29";
178
                            when 16 =>
179
                                SRegister   <= x"54";
180
                                SWriteData  <= x"40";
181
                            when 17 =>
182
                                SRegister   <= x"58";
183
                                SWriteData  <= x"1E";
184
                            when 18 =>
185
                                SRegister   <= x"3D";
186
                                SWriteData  <= x"C0";
187
                            when 19 =>
188
                                SRegister   <= x"11";
189
                                SWriteData  <= x"00";
190
                            when 20 =>
191
                                SRegister   <= x"17";
192
                                SWriteData  <= x"11";
193
                            when 21 =>
194
                                SRegister   <= x"18";
195
                                SWriteData  <= x"61";
196
                            when 22 =>
197
                                SRegister   <= x"32";
198
                                SWriteData  <= x"A4";
199
                            when 23 =>
200
                                SRegister   <= x"19";
201
                                SWriteData  <= x"03";
202
                            when 24 =>
203
                                SRegister   <= x"1A";
204
                                SWriteData  <= x"7B";
205
                            when 25 =>
206
                                SRegister   <= x"03";
207
                                SWriteData  <= x"0A";
208
                            when 26 =>
209
                                SRegister   <= x"0E";
210
                                SWriteData  <= x"61";
211
                            when 27 =>
212
                                SRegister   <= x"0F";
213
                                SWriteData  <= x"4B";
214
                            when 28 =>
215
                                SRegister   <= x"16";
216
                                SWriteData  <= x"02";
217
                            when 29 =>
218
                                SRegister   <= x"1E";
219
                                SWriteData  <= x"37";
220
                            when 30 =>
221
                                SRegister   <= x"21";
222
                                SWriteData  <= x"02";
223
                            when 31 =>
224
                                SRegister   <= x"22";
225
                                SWriteData  <= x"91";
226
                            when 32 =>
227
                                SRegister   <= x"29";
228
                                SWriteData  <= x"07";
229
                            when 33 =>
230
                                SRegister   <= x"33";
231
                                SWriteData  <= x"0B";
232
                            when 34 =>
233
                                SRegister   <= x"35";
234
                                SWriteData  <= x"0B";
235
                            when 35 =>
236
                                SRegister   <= x"37";
237
                                SWriteData  <= x"1D";
238
                            when 36 =>
239
                                SRegister   <= x"38";
240
                                SWriteData  <= x"71";
241
                            when 37 =>
242
                                SRegister   <= x"39";
243
                                SWriteData  <= x"2A";
244
                            when 38 =>
245
                                SRegister   <= x"3C";
246
                                SWriteData  <= x"78";
247
                            when 39 =>
248
                                SRegister   <= x"4D";
249
                                SWriteData  <= x"40";
250
                            when 40 =>
251
                                SRegister   <= x"4E";
252
                                SWriteData  <= x"20";
253
                            when 41 =>
254
                                SRegister   <= x"69";
255
                                SWriteData  <= x"00";
256
                            when 42 =>
257
                                SRegister   <= x"6B";
258
                                SWriteData  <= x"4A";
259
                            when 43 =>
260
                                SRegister   <= x"74";
261
                                SWriteData  <= x"10";
262
                            when 44 =>
263
                                SRegister   <= x"8D";
264
                                SWriteData  <= x"4F";
265
                            when 45 =>
266
                                SRegister   <= x"8E";
267
                                SWriteData  <= x"00";
268
                            when 46 =>
269
                                SRegister   <= x"8F";
270
                                SWriteData  <= x"00";
271
                            when 47 =>
272
                                SRegister   <= x"90";
273
                                SWriteData  <= x"00";
274
                            when 48 =>
275
                                SRegister   <= x"91";
276
                                SWriteData  <= x"00";
277
                            when 49 =>
278
                                SRegister   <= x"96";
279
                                SWriteData  <= x"00";
280
                            when 50 =>
281
                                SRegister   <= x"9A";
282
                                SWriteData  <= x"00";
283
                            when 51 =>
284
                                SRegister   <= x"B0";
285
                                SWriteData  <= x"84";
286
                            when 52 =>
287
                                SRegister   <= x"B1";
288
                                SWriteData  <= x"0C";
289
                            when 53 =>
290
                                SRegister   <= x"B2";
291
                                SWriteData  <= x"0E";
292
                            when 54 =>
293
                                SRegister   <= x"B3";
294
                                SWriteData  <= x"82";
295
                            when 55 =>
296
                                SRegister   <= x"B8";
297
                                SWriteData  <= x"0A";
298
 
299
                            when others =>
300
                                SRegister       <= x"FF";
301
                                SWriteData      <= x"FF";
302
                                SStart          <=  '0';
303
                                SEnable         <= '0';
304
                                SCfgFinished    <= '1';
305
                                SCounter        <= 0;
306
                    end case;
307
                    else
308
                        SAddress    <=  SAddress;
309
                        SEnable     <=  SEnable;
310
                        SStart      <=  '0';
311
                        SCounter    <= 0;
312
                        SRegister   <=  SRegister;
313
                        SWriteData  <=  SWriteData;
314
                    end if;
315
                else
316
                    SAddress    <=  SAddress;
317
                    SEnable     <=  SEnable;
318
                    SStart      <=  SStart;
319
                    SRegister   <=  SRegister;
320
                    SWriteData  <=  SWriteData;
321
                end if;
322
            end if;
323
        end if;
324
    end process;
325
 
326
end Behavioral;

powered by: WebSVN 2.1.0

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