Skip to content

Commit

Permalink
Test angepasst damit sie wieder lauffähig sind. Field Object Test hin…
Browse files Browse the repository at this point in the history
…zugefügt.
  • Loading branch information
Bhaallord authored and Bhaallord committed Aug 31, 2012
1 parent ac1d76a commit 00daf4d
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 956 deletions.
10 changes: 6 additions & 4 deletions src/ball_object.vhd
Expand Up @@ -125,9 +125,10 @@ MAIN:process(CLK,RESET,RESET_2)
end if;
--PADDLE BEWEGUNG(BALL RUNTER)
if(PADDLE_1_UP='1' and OFFSET_Y=-1) then
COUNTER_START_Y<=COUNTER_START_Y+BALL_SPEED_UP_Y;
if(COUNTER_START_Y>BALL_Y_START_COUNT_MAX) then
if(COUNTER_START_Y+BALL_SPEED_UP_Y>BALL_Y_START_COUNT_MAX) then
OFFSET_Y<=-OFFSET_Y;
else
COUNTER_START_Y<=COUNTER_START_Y+BALL_SPEED_UP_Y;
end if;
end if;
if(PADDLE_1_DOWN='1' and OFFSET_Y=-1) then
Expand All @@ -142,9 +143,10 @@ MAIN:process(CLK,RESET,RESET_2)
end if;
end if;
if(PADDLE_1_DOWN='1' and OFFSET_Y=1) then
COUNTER_START_Y<=COUNTER_START_Y+BALL_SPEED_UP_Y;
if(COUNTER_START_Y>BALL_Y_START_COUNT_MAX) then
if(COUNTER_START_Y+BALL_SPEED_UP_Y>BALL_Y_START_COUNT_MAX) then
OFFSET_Y<=-OFFSET_Y;
else
COUNTER_START_Y<=COUNTER_START_Y+BALL_SPEED_UP_Y;
end if;
end if;
--
Expand Down
28 changes: 20 additions & 8 deletions src/game_controller.vhd
Expand Up @@ -113,9 +113,9 @@ component BALL_OBJECT
BALL_Y_START_COUNT:natural :=200000;
BALL_SPEED_UP:natural := 10000;
BALL_SPEED_UP_Y:natural := 50000;
BALL_Y_START_COUNT_MAX:natural :=100000;
BALL_Y_START_COUNT_MAX:natural :=400000;
BALL_Y_START_COUNT_MIN:natural :=50000;
BALL_MIN_COUNT: natural := 50000;
BALL_MIN_COUNT: natural := 40000;
BALL_DIMENSION:natural:=50
);
port(
Expand Down Expand Up @@ -145,18 +145,29 @@ end component BALL_OBJECT;
--PADDLE Komponente
component PADDLE_OBJECT is
generic(
--! Oberes Limit des Spieler Paddles
PADDLE_TOP_LIMIT: integer range 0 to 1199:=199;
--! Untere Limit des Spieler Paddles
PADDLE_BOTTOM_LIMIT: integer range 0 to 1199:=1100;
PADDLE_TOP_START: integer range 0 to 1199:=600;
--! Obere Position des Paddles bei einen Reset
PADDLE_TOP_START: integer range 0 to 1199:=500;
--! Vertikale Position des Paddles
PADDLE_POS_X:integer range 0 to 1599:=90;
--! Höhe des Paddles, in Pixel
PADDLE_HEIGTH: integer range 0 to 1199:=100;
--! Breite des Paddles, in Pixel
PADDLE_WIDTH:integer range 0 to 1599:=10;
PADDLE_STEP_WIDTH: integer range 1 to 200:=10
--! Pixel Schrittweite bei einen Bewegung
PADDLE_STEP_WIDTH: integer range 1 to 200:=10;
--! Verzögerung bei der erkennung der letzten Bewegungsrichtung
MOVE_REACTION: positive:=1000000
);
port(
--! Takteingang
CLK: in bit;
CLK: in bit;
--! L_NOTR gibt die Drehrichtung des Drehgebers an.
L_NOTR: in bit;
--! Mit jeder Flanke von Step wird eine Bewegung nach unten oder nach oben vollzogen
STEP: in bit;
--! Setzt das Paddle mit einer '1' zurück zur Startposition
RESET: in bit;
Expand All @@ -170,8 +181,9 @@ component PADDLE_OBJECT is
PADDLE_TOP: out integer range 0 to 1199;
--! Aktuelle untere Position des Paddles
PADDLE_BOTTOM: out integer range 0 to 1199;

--! Die Letzte Bewegung des Paddles ging nach oben
UP_SIG: out std_logic;
--! Die Letzte Bewegung des Paddles ging nach unten
DOWN_SIG: out std_logic
);
end component PADDLE_OBJECT;
Expand Down Expand Up @@ -305,9 +317,9 @@ GAME_AUTOMATE:process(ZUSTAND,BALL_X_CURRENT)
BALL_RESET_1<='1';
--Spiel läuft
when z1=>
if(BALL_X_CURRENT=100 and (BALL_Y_CURRENT<PADDLE_TOP_PLAYER_1 or BALL_Y_CURRENT>PADDLE_BOTTOM_PLAYER_1)) then
if(BALL_X_CURRENT=100 and (BALL_Y_CURRENT<PADDLE_TOP_PLAYER_1-15 or BALL_Y_CURRENT>PADDLE_BOTTOM_PLAYER_1+15)) then
FOLGE_Z<=z3;
elsif(BALL_X_CURRENT=1500 and (BALL_Y_CURRENT<PADDLE_TOP_PLAYER_2 or BALL_Y_CURRENT>PADDLE_BOTTOM_PLAYER_2)) then
elsif(BALL_X_CURRENT=1500 and (BALL_Y_CURRENT<PADDLE_TOP_PLAYER_2-15 or BALL_Y_CURRENT>PADDLE_BOTTOM_PLAYER_2+15)) then
FOLGE_Z<=z2;
else
FOLGE_Z<=z1;
Expand Down
4 changes: 2 additions & 2 deletions src/main.bdf
Expand Up @@ -58,7 +58,7 @@ applicable agreement for further details.
(input)
(rect 56 224 224 240)
(text "INPUT" (rect 133 0 161 10)(font "Arial" (font_size 6)))
(text "SW[17..16]" (rect 5 0 60 12)(font "Arial" ))
(text "GPIO_0[0..1]" (rect 5 0 69 12)(font "Arial" ))
(pt 168 8)
(drawing
(line (pt 92 12)(pt 117 12)(line_width 1))
Expand All @@ -75,7 +75,7 @@ applicable agreement for further details.
(input)
(rect 56 192 224 208)
(text "INPUT" (rect 133 0 161 10)(font "Arial" (font_size 6)))
(text "GPIO_1[2]" (rect 5 0 56 12)(font "Arial" ))
(text "SW[0]" (rect 5 0 35 12)(font "Arial" ))
(pt 168 8)
(drawing
(line (pt 92 12)(pt 117 12)(line_width 1))
Expand Down
2 changes: 1 addition & 1 deletion src/paddle.vhd
Expand Up @@ -41,7 +41,7 @@ begin
ZUSTAND <= Z00;
COUNTER <= 0;
elsif CLK_50Mhz = '1' and CLK_50Mhz'event then
if(COUNTER=4000) then
if(COUNTER=12000) then
ZUSTAND <= FOLGEZUSTAND;
COUNTER <= 0;
else
Expand Down
23 changes: 17 additions & 6 deletions src/paddle_object.vhd
Expand Up @@ -74,9 +74,17 @@ PLAYER_PADDLE:process(STEP,RESET)
PADDLE_TOP_SIG<=PADDLE_TOP_START;
elsif (STEP'EVENT and STEP='1') then
if(L_NOTR='1' and PADDLE_TOP_SIG>PADDLE_TOP_LIMIT) then
PADDLE_TOP_SIG<=PADDLE_TOP_SIG-PADDLE_STEP_WIDTH;
if(PADDLE_TOP_SIG-PADDLE_STEP_WIDTH>PADDLE_TOP_LIMIT) then
PADDLE_TOP_SIG<=PADDLE_TOP_SIG-PADDLE_STEP_WIDTH;
else
PADDLE_TOP_SIG<=PADDLE_TOP_LIMIT;
end if;
elsif(L_NOTR='0' and PADDLE_TOP_SIG+PADDLE_HEIGTH<PADDLE_BOTTOM_LIMIT) then
PADDLE_TOP_SIG<=PADDLE_TOP_SIG+PADDLE_STEP_WIDTH;
if(PADDLE_TOP_SIG+PADDLE_STEP_WIDTH+PADDLE_HEIGTH<PADDLE_BOTTOM_LIMIT) then
PADDLE_TOP_SIG<=PADDLE_TOP_SIG+PADDLE_STEP_WIDTH;
else
PADDLE_TOP_SIG<=PADDLE_BOTTOM_LIMIT-PADDLE_HEIGTH;
end if;
end if;
end if;
end process PLAYER_PADDLE;
Expand All @@ -96,7 +104,7 @@ PADDLE_TOP<=PADDLE_TOP_SIG;
PADDLE_BOTTOM<=PADDLE_TOP_SIG+PADDLE_HEIGTH;

--! Prozess zur Berechnung der letzten Bewegung
MOVEMENT:process(CLK)
MOVEMENT:process(CLK,RESET)
begin
if(CLK'event and CLK='1') then
if(PADDLE_TOP_SIG=PADDLE_TOP_SIG_LAST) then
Expand All @@ -109,17 +117,20 @@ MOVEMENT:process(CLK)
else
COUNT<=0;
if(PADDLE_TOP_SIG<PADDLE_TOP_SIG_LAST) then
UP_SIG<='1';
else
UP_SIG<='0';
DOWN_SIG<='1';
else
UP_SIG<='1';
DOWN_SIG<='0';
end if;
end if;
end if;
end process;

--! Prozess zum Speichern der letzten Bewegung
MOVEMENT_2:process(CLK)
MOVEMENT_2:process(CLK,RESET)
begin

if(CLK'event and CLK='1') then
if(COUNT_2>2) then
PADDLE_TOP_SIG_LAST<=PADDLE_TOP_SIG;
Expand Down

0 comments on commit 00daf4d

Please sign in to comment.