TTT.VHD


1
library IEEE;
2
3
use IEEE.std_logic_1164.all;
4
5
use IEEE.std_logic_unsigned.all;
6
7
8
9
entity ttt is
10
11
  port
12
13
  (
14
  
15
    kb_data: in std_logic;      -- serieller Dateneingang der Tastatur
16
    
17
    kb_clk: in std_logic;      -- clock-Signal der Tastatur
18
19
    reset: in std_logic;      -- reset
20
21
    clock: in std_logic;      -- VGA dot clock
22
23
    hsyncb: buffer std_logic;    -- horizontal (line) sync
24
25
    vsyncb: out std_logic;      -- vertical (frame) sync
26
27
    rgb: out std_logic_vector(5 downto 0)  -- red,green,blue colors
28
29
  );
30
31
end ttt;
32
33
34
35
architecture ttt_arch of ttt is
36
37
signal hcnt: std_logic_vector(8 downto 0);  -- horizontal pixel counter
38
39
signal vcnt: std_logic_vector(9 downto 0);  -- vertical line counter
40
41
signal eingabe: std_logic_vector(10 downto 0);  -- Tastatureingabe
42
43
signal tmp_eingabe: std_logic_vector(10 downto 0);  -- Tastatureingabe (Puffer)
44
45
signal r_taste: std_logic_vector(10 downto 0);  -- Keyboard-Code: r_taste
46
47
signal eins: std_logic_vector(10 downto 0);  -- Keyboard-Code: eins
48
49
signal zwei: std_logic_vector(10 downto 0);  -- Keyboard-Code: zwei
50
51
signal drei: std_logic_vector(10 downto 0);  -- Keyboard-Code: drei
52
53
signal vier: std_logic_vector(10 downto 0);  -- Keyboard-Code: vier
54
55
signal fuenf: std_logic_vector(10 downto 0);  -- Keyboard-Code: fuenf
56
57
signal sechs: std_logic_vector(10 downto 0);  -- Keyboard-Code: sechs
58
59
signal sieben: std_logic_vector(10 downto 0);  -- Keyboard-Code: sieben
60
61
signal acht: std_logic_vector(10 downto 0);  -- Keyboard-Code: acht
62
63
signal neun: std_logic_vector(10 downto 0);  -- Keyboard-Code: neun
64
65
signal spielfeld: std_logic_vector(17 downto 0);-- Zustandskodierung des Spielfeldes
66
67
signal kb_clock: std_logic;      -- Behelfs-clock-Signal
68
69
signal datachange: std_logic;      -- gibt an ob eine neue Taste gedrueckt wurde
70
71
signal spieler1: std_logic;      -- gibt an ob Spieler 1 oder 2 dran ist
72
73
signal ende: std_logic;        -- gibt an ob das Spiel zu Ende ist
74
75
signal blank: std_logic;      -- video blanking signal
76
77
signal pblank: std_logic;      -- pipelined video blanking signal
78
79
signal sieger_rot: std_logic;      -- gibt an ob Spieler 1 gewonnen hat
80
81
signal sieger_blau: std_logic;      -- gibt an ob Spieler 2 gewonnen hat
82
83
begin
84
85
86
87
r_taste<="11001011010";
88
89
eins<="11011010010";
90
91
zwei<="11011100100";
92
93
drei<="10011110100";
94
95
vier<="10011010110";
96
97
fuenf<="10011100110";
98
99
sechs<="11011101000";
100
101
sieben<="11011011000";
102
103
acht<="10011101010";
104
105
neun<="11011111010";
106
107
108
109
A: process(clock)
110
111
begin
112
113
  if (clock'event and clock='1') then
114
  
115
    kb_clock<=kb_clk;
116
  
117
  end if;
118
  
119
end process;
120
121
122
123
B: process(kb_clock)
124
125
begin
126
127
  if (kb_clock'event and kb_clock='0') then
128
  
129
    tmp_eingabe<=kb_data & tmp_eingabe(10 downto 1);
130
131
  end if;
132
  
133
end process;
134
135
136
137
C: process (kb_clock,clock)
138
139
begin
140
141
  if rising_edge(kb_clock) then
142
    
143
    datachange <= '1';
144
145
  end if;
146
147
  if (vcnt=11 and hcnt=77) then -- einmal pro bild
148
149
    if datachange = '0' then
150
151
      eingabe <= tmp_eingabe;
152
153
    end if;
154
155
    datachange <= '0';
156
    
157
  end if;
158
159
end process;
160
161
162
163
D: process(clock,reset)
164
165
begin
166
167
  -- reset asynchronously clears pixel counter
168
169
  if reset='1' then
170
171
    hcnt <= "000000000";
172
173
  -- horiz. pixel counter increments on rising edge of dot clock
174
175
  elsif (clock'event and clock='1') then
176
177
    -- horiz. pixel counter rolls-over after 381 pixels
178
179
    if hcnt<380 then
180
181
      hcnt <= hcnt + 1;
182
183
    else
184
185
      hcnt <= "000000000";
186
187
    end if;
188
189
  end if;
190
191
end process;
192
193
194
195
E: process(hsyncb,reset)
196
197
begin
198
199
  -- reset asynchronously clears line counter
200
201
  if reset='1' then
202
203
    vcnt <= "0000000000";
204
205
  -- vert. line counter increments after every horiz. line
206
207
  elsif (hsyncb'event and hsyncb='1') then
208
209
    -- vert. line counter rolls-over after 528 lines
210
211
    if vcnt<527 then
212
213
      vcnt <= vcnt + 1;
214
215
    else
216
217
      vcnt <= "0000000000";
218
219
    end if;
220
221
  end if;
222
223
end process;
224
225
226
227
F: process(clock,reset)
228
229
begin
230
231
  -- reset asynchronously sets horizontal sync to inactive
232
233
  if reset='1' then
234
235
    hsyncb <= '1';
236
237
  -- horizontal sync is recomputed on the rising edge of every dot clock
238
239
  elsif (clock'event and clock='1') then
240
241
    -- horiz. sync is low in this interval to signal start of a new line
242
243
    if (hcnt>=291 and hcnt<337) then
244
245
      hsyncb <= '0';
246
247
    else
248
249
      hsyncb <= '1';
250
251
    end if;
252
253
  end if;
254
255
end process;
256
257
258
259
G: process(hsyncb,reset)
260
261
begin
262
263
  -- reset asynchronously sets vertical sync to inactive
264
265
  if reset='1' then
266
267
    vsyncb <= '1';
268
269
  -- vertical sync is recomputed at the end of every line of pixels
270
271
  elsif (hsyncb'event and hsyncb='1') then
272
273
    -- vert. sync is low in this interval to signal start of a new frame
274
275
    if (vcnt>=490 and vcnt<492) then
276
277
      vsyncb <= '0';
278
279
    else
280
281
      vsyncb <= '1';
282
283
    end if;
284
285
  end if;
286
287
end process;
288
289
290
291
-- blank video outside of visible region: (0,0) -> (265,479)
292
293
H: blank <= '1' when (hcnt>=266 or vcnt>=480) else '0';
294
295
-- store the blanking signal for use in the next pipeline stage
296
297
I: process(clock,reset)
298
299
begin
300
301
  if reset='1' then
302
303
    pblank <= '0';
304
305
  elsif (clock'event and clock='1') then
306
307
    pblank <= blank;
308
309
  end if;
310
311
end process;
312
313
314
315
J: process(hsyncb,eingabe)
316
317
begin
318
319
   if rising_edge(hsyncb) then
320
   
321
  if (eingabe=r_taste) then  -- r
322
323
    spielfeld <= "000000000000000000";
324
        
325
    spieler1 <= '1';
326
327
  elsif (eingabe=eins) then  -- eins 
328
         
329
     if (spieler1='1') and (ende='0') then
330
    
331
    if (spielfeld(1 downto 0)="00") then
332
    
333
      spielfeld(1 downto 0) <= "01";
334
      
335
      spieler1 <= '0';
336
    
337
    end if;
338
  
339
     elsif (spieler1='0') and (ende='0') then
340
341
    if (spielfeld(1 downto 0)="00") then
342
    
343
      spielfeld(1 downto 0) <= "10";
344
      
345
      spieler1 <= '1';
346
    
347
    end if;
348
      
349
     end if;
350
     
351
  elsif (eingabe=zwei) then  -- zwei
352
353
     if (spieler1='1') and (ende='0') then
354
     
355
    if (spielfeld(3 downto 2)="00") then
356
    
357
      spielfeld(3 downto 2) <= "01";
358
      
359
      spieler1 <= '0';
360
361
    end if;
362
363
     elsif (spieler1='0') and (ende='0') then
364
     
365
    if (spielfeld(3 downto 2)="00") then
366
    
367
      spielfeld(3 downto 2) <= "10";
368
      
369
      spieler1 <= '1';
370
371
    end if;
372
373
     end if;
374
     
375
  elsif (eingabe=drei) then  -- drei
376
  
377
     if (spieler1='1') and (ende='0') then
378
    
379
    if (spielfeld(5 downto 4)="00") then
380
    
381
      spielfeld(5 downto 4) <= "01";
382
      
383
      spieler1 <= '0';
384
    
385
    end if;
386
  
387
     elsif (spieler1='0') and (ende='0') then
388
389
    if (spielfeld(5 downto 4)="00") then
390
    
391
      spielfeld(5 downto 4) <= "10";
392
      
393
      spieler1 <= '1';
394
    
395
    end if;
396
      
397
     end if;  
398
    
399
  elsif (eingabe=vier) then  -- vier
400
401
     if (spieler1='1') and (ende='0') then
402
    
403
    if (spielfeld(7 downto 6)="00") then
404
    
405
      spielfeld(7 downto 6) <= "01";
406
      
407
      spieler1 <= '0';
408
    
409
    end if;
410
  
411
     elsif (spieler1='0') and (ende='0') then
412
413
    if (spielfeld(7 downto 6)="00") then
414
    
415
      spielfeld(7 downto 6) <= "10";
416
      
417
      spieler1 <= '1';
418
    
419
    end if;
420
      
421
     end if;  
422
  
423
  
424
  elsif (eingabe=fuenf) then  -- fuenf
425
426
    if (spieler1='1') and (ende='0') then
427
    
428
    if (spielfeld(9 downto 8)="00") then
429
    
430
      spielfeld(9 downto 8) <= "01";
431
      
432
      spieler1 <= '0';
433
    
434
    end if;
435
  
436
     elsif (spieler1='0') and (ende='0') then
437
438
    if (spielfeld(9 downto 8)="00") then
439
    
440
      spielfeld(9 downto 8) <= "10";
441
      
442
      spieler1 <= '1';
443
    
444
    end if;
445
      
446
     end if; 
447
  
448
  
449
  elsif (eingabe=sechs) then  -- sechs
450
451
     if (spieler1='1') and (ende='0') then
452
    
453
    if (spielfeld(11 downto 10)="00") then
454
    
455
      spielfeld(11 downto 10) <= "01";
456
      
457
      spieler1 <= '0';
458
    
459
    end if;
460
  
461
     elsif (spieler1='0') and (ende='0') then
462
463
    if (spielfeld(11 downto 10)="00") then
464
    
465
      spielfeld(11 downto 10) <= "10";
466
      
467
      spieler1 <= '1';
468
    
469
    end if;
470
      
471
     end if;  
472
    
473
  elsif (eingabe=sieben) then  -- sieben
474
475
     if (spieler1='1') and (ende='0') then
476
    
477
    if (spielfeld(13 downto 12)="00") then
478
    
479
      spielfeld(13 downto 12) <= "01";
480
      
481
      spieler1 <= '0';
482
    
483
    end if;
484
  
485
     elsif (spieler1='0') and (ende='0') then
486
487
    if (spielfeld(13 downto 12)="00") then
488
    
489
      spielfeld(13 downto 12) <= "10";
490
      
491
      spieler1 <= '1';
492
    
493
    end if;
494
      
495
     end if;  
496
    
497
  elsif (eingabe=acht) then  -- acht
498
499
     if (spieler1='1') and (ende='0') then
500
    
501
    if (spielfeld(15 downto 14)="00") then
502
    
503
      spielfeld(15 downto 14) <= "01";
504
      
505
      spieler1 <= '0';
506
    
507
    end if;
508
  
509
     elsif (spieler1='0') and (ende='0') then
510
511
    if (spielfeld(15 downto 14)="00") then
512
    
513
      spielfeld(15 downto 14) <= "10";
514
      
515
      spieler1 <= '1';
516
    
517
    end if;
518
      
519
     end if;  
520
    
521
  elsif (eingabe=neun) then  -- neun
522
523
     if (spieler1='1') and (ende='0') then
524
    
525
    if (spielfeld(17 downto 16)="00") then
526
    
527
      spielfeld(17 downto 16) <= "01";
528
      
529
      spieler1 <= '0';
530
    
531
    end if;
532
  
533
     elsif (spieler1='0') and (ende='0') then
534
535
    if (spielfeld(17 downto 16)="00") then
536
    
537
      spielfeld(17 downto 16) <= "10";
538
      
539
      spieler1 <= '1';
540
    
541
    end if;
542
      
543
     end if;
544
    
545
  end if;
546
  
547
   end if;
548
549
end process;
550
551
552
553
K: process(spielfeld)
554
555
begin
556
557
  if (spielfeld="000000000000000000") then
558
  
559
    ende<='0';
560
    
561
    sieger_rot<='0';
562
    
563
    sieger_blau<='0';
564
    
565
  end if;
566
  
567
  -- Abfrage, ob ein Spieler gewonnen hat:
568
  
569
  -- Rot (oder Blau) gewinnt mit der Reihe 1-2-3 
570
571
  if (spielfeld(1 downto 0)="01") and (spielfeld(3 downto 2)="01") and (spielfeld(5 downto 4)="01") then
572
573
    ende<='1';
574
575
    sieger_rot<='1';
576
    
577
  elsif (spielfeld(1 downto 0)="10") and (spielfeld(3 downto 2)="10") and (spielfeld(5 downto 4)="10") then
578
579
    ende<='1';
580
581
    sieger_blau<='1';
582
583
  end if;
584
  
585
  -- Rot (oder Blau) gewinnt mit der Reihe 4-5-6   
586
  
587
  if (spielfeld(7 downto 6)="01") and (spielfeld(9 downto 8)="01") and (spielfeld(11 downto 10)="01") then
588
589
    ende<='1';
590
    
591
    sieger_rot<='1';
592
    
593
  elsif (spielfeld(7 downto 6)="10") and (spielfeld(9 downto 8)="10") and (spielfeld(11 downto 10)="10") then
594
595
    ende<='1';
596
    
597
    sieger_blau<='1';
598
    
599
  end if;
600
  
601
  -- Rot (oder Blau) gewinnt mit der Reihe 7-8-9
602
  
603
  if (spielfeld(13 downto 12)="01") and (spielfeld(15 downto 14)="01") and (spielfeld(17 downto 16)="01") then
604
605
    ende<='1';
606
  
607
    sieger_rot<='1';
608
  
609
  elsif (spielfeld(13 downto 12)="10") and (spielfeld(15 downto 14)="10") and (spielfeld(17 downto 16)="10") then
610
611
    ende<='1';
612
  
613
    sieger_blau<='1';
614
  
615
  end if;  
616
  
617
  -- Rot (oder Blau) gewinnt mit der Reihe 1-4-7
618
  
619
  if (spielfeld(1 downto 0)="01") and (spielfeld(7 downto 6)="01") and (spielfeld(13 downto 12)="01") then
620
621
    ende<='1';
622
  
623
    sieger_rot<='1';
624
  
625
  elsif (spielfeld(1 downto 0)="10") and (spielfeld(7 downto 6)="10") and (spielfeld(13 downto 12)="10") then
626
627
    ende<='1';
628
  
629
    sieger_blau<='1';
630
  
631
  end if;  
632
  
633
  -- Rot (oder Blau) gewinnt mit der Reihe 2-5-8
634
  
635
  if (spielfeld(3 downto 2)="01") and (spielfeld(9 downto 8)="01") and (spielfeld(15 downto 14)="01") then
636
637
    ende<='1';
638
  
639
    sieger_rot<='1';
640
  
641
  elsif (spielfeld(3 downto 2)="10") and (spielfeld(9 downto 8)="10") and (spielfeld(15 downto 14)="10") then
642
643
    ende<='1';
644
  
645
    sieger_blau<='1';
646
  
647
  end if;
648
  
649
  -- Rot (oder Blau) gewinnt mit der Reihe 3-6-9
650
  
651
  if (spielfeld(5 downto 4)="01") and (spielfeld(11 downto 10)="01") and (spielfeld(17 downto 16)="01") then
652
653
    ende<='1';
654
  
655
    sieger_rot<='1';
656
  
657
  elsif (spielfeld(5 downto 4)="10") and (spielfeld(11 downto 10)="10") and (spielfeld(17 downto 16)="10") then
658
659
    ende<='1';
660
  
661
    sieger_blau<='1';
662
  
663
  end if;  
664
  
665
  -- Rot (oder Blau) gewinnt mit der Reihe 1-5-9
666
  
667
  if (spielfeld(1 downto 0)="01") and (spielfeld(9 downto 8)="01") and (spielfeld(17 downto 16)="01") then
668
669
    ende<='1';
670
  
671
    sieger_rot<='1';
672
  
673
  elsif (spielfeld(1 downto 0)="10") and (spielfeld(9 downto 8)="10") and (spielfeld(17 downto 16)="10") then
674
675
    ende<='1';
676
  
677
    sieger_blau<='1';
678
  
679
  end if;  
680
  
681
  -- Rot (oder Blau) gewinnt mit der Reihe 3-5-7
682
  
683
  if (spielfeld(5 downto 4)="01") and (spielfeld(9 downto 8)="01") and (spielfeld(13 downto 12)="01") then
684
685
    ende<='1';
686
  
687
    sieger_rot<='1';
688
  
689
  elsif (spielfeld(5 downto 4)="10") and (spielfeld(9 downto 8)="10") and (spielfeld(13 downto 12)="10") then
690
691
    ende<='1';
692
  
693
    sieger_blau<='1';
694
    
695
  end if;  
696
    
697
end process;
698
699
700
701
L: process(clock,spielfeld,reset, spieler1)
702
703
begin
704
705
  
706
     -- blank the video on reset
707
708
     if reset='1' then
709
710
  rgb <= "000000";
711
712
     -- update the color outputs on every dot clock
713
714
     elsif (clock'event and clock='1') then
715
     
716
  if pblank='0' then
717
718
    if (vcnt>30 and vcnt<35) and (hcnt>10 and hcnt<35) then
719
       
720
      rgb<="100000";  -- roter Balken links oben
721
         
722
    elsif (vcnt>30 and vcnt<35) and (hcnt>235 and hcnt<260) then  
723
724
      rgb<="000010";  -- blauer Balken rechts oben
725
       
726
    elsif (vcnt>185 and vcnt<195) and (hcnt>45 and hcnt<225) then
727
       
728
      rgb<="101010";  -- 1. Waagerechte
729
         
730
    elsif (vcnt>285 and vcnt<295) and (hcnt>45 and hcnt<225) then  
731
732
      rgb<="101010";  -- 2. Waagerechte
733
         
734
    elsif (vcnt>90 and vcnt<390) and (hcnt>102 and hcnt<108) then  
735
      
736
      rgb<="101010";  -- 1. Senkrechte
737
         
738
          elsif (vcnt>90 and vcnt<390) and (hcnt>162 and hcnt<168) then  
739
740
      rgb<="101010";  -- 2. Senkrechte
741
      
742
    else
743
      
744
      rgb<="000000";
745
      
746
    end if;  
747
    
748
  else
749
      
750
    rgb <= "000000";  -- black
751
752
  end if;  
753
    
754
    
755
    if (spieler1='1') then
756
  
757
      if (vcnt>40 and vcnt<45) and (hcnt>20 and hcnt<25) then
758
       
759
      rgb<="111111";  -- Spieleranzeige
760
      
761
      end if;
762
      
763
    end if;
764
765
    if (spieler1='0') then
766
    
767
      if (vcnt>40 and vcnt<45) and (hcnt>245 and hcnt<250) then  
768
769
      rgb<="111111";  -- Spieleranzeige
770
  
771
      end if;
772
    
773
    end if;
774
    
775
    
776
    
777
    if (sieger_rot='1') then  -- Siegesumrandung fuer Rot
778
    
779
      if (vcnt>20 and vcnt<25) and (hcnt>5 and hcnt<40) then
780
       
781
        rgb<="111111";  
782
         
783
      elsif (vcnt>40 and vcnt<45) and (hcnt>5 and hcnt<40) then  
784
785
        rgb<="111111";  
786
    
787
      elsif (vcnt>20 and vcnt<45) and (hcnt>5 and hcnt<8) then
788
       
789
        rgb<="111111";  
790
         
791
      elsif (vcnt>20 and vcnt<45) and (hcnt>37 and hcnt<40) then  
792
793
        rgb<="111111";  
794
    
795
      end if;
796
    
797
    end if;
798
    
799
    if (sieger_blau='1') then  -- Siegesumrandung fuer Blau
800
    
801
      if (vcnt>20 and vcnt<25) and (hcnt>230 and hcnt<265) then
802
       
803
        rgb<="111111";  
804
         
805
      elsif (vcnt>40 and vcnt<45) and (hcnt>230 and hcnt<265) then  
806
807
        rgb<="111111";  
808
    
809
      elsif (vcnt>20 and vcnt<45) and (hcnt>230 and hcnt<233) then
810
       
811
        rgb<="111111";  
812
         
813
      elsif (vcnt>20 and vcnt<45) and (hcnt>262 and hcnt<265) then  
814
815
        rgb<="111111";  
816
    
817
      end if;
818
    
819
    end if;
820
    
821
     
822
  
823
    if (spielfeld(1 downto 0)="01") then
824
  
825
      if (vcnt>305 and vcnt<380) and (hcnt>50 and hcnt<97) then
826
       
827
        rgb<="100000"; -- rotes Rechteck in Feld 1
828
      
829
      end if;
830
    
831
    elsif (spielfeld(1 downto 0)="10") then
832
  
833
      if (vcnt>305 and vcnt<380) and (hcnt>50 and hcnt<97) then
834
       
835
           rgb<="000010"; -- blaues Rechteck in Feld 1
836
      
837
      end if;
838
    
839
    end if;
840
  
841
    if (spielfeld(3 downto 2)="01") then
842
  
843
      if (vcnt>305 and vcnt<380) and (hcnt>113 and hcnt<157) then  
844
      
845
        rgb<="100000"; -- rotes Rechteck in Feld 2
846
847
      end if;
848
    
849
    elsif (spielfeld(3 downto 2)="10") then
850
  
851
      if (vcnt>305 and vcnt<380) and (hcnt>113 and hcnt<157) then  
852
853
        rgb<="000010"; -- blaues Rechteck in Feld 2
854
855
      end if;
856
    
857
    end if;         
858
859
    if (spielfeld(5 downto 4)="01") then
860
  
861
      if (vcnt>305 and vcnt<380) and (hcnt>173 and hcnt<220) then
862
       
863
        rgb<="100000"; -- rotes Rechteck in Feld 3
864
      
865
      end if;
866
    
867
    elsif (spielfeld(5 downto 4)="10") then
868
  
869
      if (vcnt>305 and vcnt<380) and (hcnt>173 and hcnt<220) then
870
       
871
        rgb<="000010"; -- blaues Rechteck in Feld 3
872
      
873
      end if;
874
  
875
    end if;
876
  
877
    if (spielfeld(7 downto 6)="01") then
878
  
879
      if (vcnt>205 and vcnt<275) and (hcnt>50 and hcnt<97) then  
880
881
        rgb<="100000"; -- rotes Rechteck in Feld 4
882
883
      end if;
884
    
885
    elsif (spielfeld(7 downto 6)="10") then
886
  
887
      if (vcnt>205 and vcnt<275) and (hcnt>50 and hcnt<97) then  
888
889
        rgb<="000010"; -- blaues Rechteck in Feld 4
890
891
      end if;
892
    
893
    end if;  
894
895
    if (spielfeld(9 downto 8)="01") then
896
  
897
      if (vcnt>205 and vcnt<275) and (hcnt>113 and hcnt<157) then
898
       
899
        rgb<="100000"; -- rotes Rechteck in Feld 5
900
      
901
      end if;
902
    
903
    elsif (spielfeld(9 downto 8)="10") then
904
  
905
      if (vcnt>205 and vcnt<275) and (hcnt>113 and hcnt<157) then
906
       
907
        rgb<="000010"; -- blaues Rechteck in Feld 5
908
      
909
      end if;
910
  
911
    end if;
912
  
913
    if (spielfeld(11 downto 10)="01") then
914
  
915
      if (vcnt>205 and vcnt<275) and (hcnt>173 and hcnt<220) then  
916
917
        rgb<="100000"; -- rotes Rechteck in Feld 6
918
919
    end if;
920
    
921
    elsif (spielfeld(11 downto 10)="10") then
922
  
923
      if (vcnt>205 and vcnt<275) and (hcnt>173 and hcnt<220) then  
924
925
        rgb<="000010"; -- blaues Rechteck in Feld 6
926
927
      end if;
928
    
929
    end if;         
930
931
    if (spielfeld(13 downto 12)="01") then
932
  
933
      if (vcnt>100 and vcnt<175) and (hcnt>50 and hcnt<97) then  
934
935
        rgb<="100000"; -- rotes Rechteck in Feld 7
936
937
      end if;
938
    
939
    elsif (spielfeld(13 downto 12)="10") then
940
  
941
      if (vcnt>100 and vcnt<175) and (hcnt>50 and hcnt<97) then  
942
943
        rgb<="000010"; -- blaues Rechteck in Feld 7
944
945
      end if;
946
    
947
    end if;  
948
949
    if (spielfeld(15 downto 14)="01") then
950
  
951
      if (vcnt>100 and vcnt<175) and (hcnt>113 and hcnt<157) then
952
       
953
        rgb<="100000"; -- rotes Rechteck in Feld 8
954
      
955
      end if;
956
    
957
    elsif (spielfeld(15 downto 14)="10") then
958
  
959
      if (vcnt>100 and vcnt<175) and (hcnt>113 and hcnt<157) then
960
       
961
        rgb<="000010"; -- blaues Rechteck in Feld 8
962
      
963
      end if;
964
  
965
    end if;
966
  
967
    if (spielfeld(17 downto 16)="01") then
968
  
969
      if (vcnt>100 and vcnt<175) and (hcnt>173 and hcnt<220) then  
970
971
        rgb<="100000"; -- rotes Rechteck in Feld 9
972
973
      end if;
974
    
975
    elsif (spielfeld(17 downto 16)="10") then
976
  
977
      if (vcnt>100 and vcnt<175) and (hcnt>173 and hcnt<220) then  
978
979
        rgb<="000010"; -- blaues Rechteck in Feld 9
980
981
      end if;
982
    
983
    end if;  
984
  
985
     end if;
986
987
end process;
988
989
990
991
end ttt_arch;