l'affichage marche presque
This commit is contained in:
parent
94e7110845
commit
175d0d37b7
@ -59,55 +59,61 @@ signal snakeHere: std_logic; --1 si on doit afficher le pixel 0 sinon
|
||||
signal dx : signed(2 downto 0);
|
||||
signal dy : signed(2 downto 0);
|
||||
signal running : std_logic;
|
||||
signal startUpdate : std_logic;
|
||||
signal snakePresentBuffer : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
|
||||
-- Process de calcul d'affichage
|
||||
process(X,Y,clk,reset,running,dx,dy,updateOrder,currentSnake,snakeHere)
|
||||
process(X,Y,clk,reset,running,dx,dy,updateOrder,currentSnake,snakeHere,snakePresentBuffer)
|
||||
begin
|
||||
--if(updateOrder'event and updateOrder = '1') then
|
||||
-- running <= '1';
|
||||
-- snakeHere <= '0';
|
||||
-- dx <= to_signed(-1,3);
|
||||
-- dy <= to_signed(-1,3);
|
||||
--end if;
|
||||
if(updateOrder'event and updateOrder = '1') then
|
||||
snakePresentBuffer <= snakeHere;
|
||||
startUpdate <= '1';
|
||||
end if;
|
||||
|
||||
--if(reset = '0') then
|
||||
-- dx <= to_signed(-1,3);
|
||||
-- dy <= to_signed(-1,3);
|
||||
-- running <= '0';
|
||||
-- snakeHere <= '0';
|
||||
--elsif(clk'event and clk = '1') then
|
||||
-- if(running = '1') then
|
||||
-- dx <= dx + 1;
|
||||
if(reset = '0') then
|
||||
running <= '0';
|
||||
snakeHere <= '0';
|
||||
snakePresentBuffer <= '0';
|
||||
elsif(clk'event and clk = '1') then
|
||||
if(startUpdate = '1') then
|
||||
running <= '1';
|
||||
snakeHere <= '0';
|
||||
dx <= to_signed(-1,3);
|
||||
dy <= to_signed(-1,3);
|
||||
end if;
|
||||
if(running = '1') then
|
||||
dx <= dx + 1;
|
||||
if(dx = 2) then
|
||||
dx <= to_signed(-1,3);
|
||||
dy <= dy + 1;
|
||||
end if;
|
||||
|
||||
if(dy = 2) then
|
||||
dy <= to_signed(-1,3);
|
||||
running <= '0';
|
||||
end if;
|
||||
|
||||
-- if(dx = 2) then
|
||||
-- dx <= to_signed(-1,3);
|
||||
-- dy <= dy + 1;
|
||||
-- end if;
|
||||
-- end if;
|
||||
--end if;
|
||||
if(clk'event and clk = '1') then
|
||||
if(currentSnake.isDefined = '1') then
|
||||
--if(X>=currentSnake.X-8 and X<=currentSnake.X+8 and Y>=currentSnake.Y-8 and Y<=currentSnake.Y+8) then
|
||||
snakeHere <= '1';
|
||||
--end if;
|
||||
else
|
||||
snakeHere <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
--if(dy = 2) then
|
||||
-- dy <= to_signed(-1,3);
|
||||
-- running <= '0';
|
||||
--end if;
|
||||
if(running = '1') then
|
||||
startUpdate <= '0';
|
||||
end if;
|
||||
|
||||
end process;
|
||||
|
||||
--matAddress <= resize(shift_right(to_unsigned(to_integer(Y)+to_integer(dy),9),4)*40+shift_right(to_unsigned(to_integer(X)+to_integer(dx),10),4),SNAKE_ADDRESS_SIZE); --on resize parce qu'il as décidé que le resultat faisait 18bits au lieu des 11 attendus
|
||||
matAddress <= resize(shift_right(Y,4)*40+shift_right(X,4),SNAKE_ADDRESS_SIZE);
|
||||
matAddress <= resize(shift_right(to_unsigned(to_integer(Y)+to_integer(dy),9),4)*40+shift_right(to_unsigned(to_integer(X)+to_integer(dx),10),4),SNAKE_ADDRESS_SIZE); --on resize parce qu'il as décidé que le resultat faisait 18bits au lieu des 11 attendus
|
||||
--matAddress <= '0' & X/16;--resize(shift_right(Y,4)*40+shift_right(X,4),SNAKE_ADDRESS_SIZE);
|
||||
|
||||
currentAddress <= listRef;
|
||||
|
||||
snakePresent <= snakeHere;
|
||||
snakePresent <= snakePresentBuffer;
|
||||
end Behavioral;
|
||||
|
@ -247,7 +247,7 @@ U6 : snakeRAM --La RAM pour le snake
|
||||
address1 => displayRAMAddress,
|
||||
data1 => displayRAMdata,
|
||||
writeEnable1 => '0',
|
||||
clk1 => pxl_clk,
|
||||
clk1 => H125MHz,
|
||||
|
||||
address2 => updateRAMAddress,
|
||||
data2 => updateRAMData,
|
||||
@ -265,7 +265,7 @@ U7 : snakeRAM --La RAM pour la matrice de correspondance
|
||||
address1 => matdispRAMAddress,
|
||||
data1 => matdispRAMdata,
|
||||
writeEnable1 => '0',
|
||||
clk1 => pxl_clk,
|
||||
clk1 => H125MHz,
|
||||
|
||||
address2 => matupdRAMAddress,
|
||||
data2 => std_logic_vector(matupdRAMData),
|
||||
@ -273,5 +273,6 @@ U7 : snakeRAM --La RAM pour la matrice de correspondance
|
||||
clk2 => H125MHz
|
||||
);
|
||||
|
||||
led <= std_logic_vector(displayRAMData(3 downto 0));
|
||||
led(0) <= resetGeneral;
|
||||
led(1) <= updateRAMWE;
|
||||
end Behavioral;
|
||||
|
@ -96,7 +96,7 @@ begin
|
||||
currentSnake.dirY <= to_signed(0,2);
|
||||
currentSnake.isDefined <= '0';
|
||||
|
||||
matAddress <= to_unsigned(10,SNAKE_ADDRESS_SIZE);
|
||||
matAddress <= index;
|
||||
matData <= to_unsigned(10,SNAKE_ADDRESS_SIZE);
|
||||
end if;
|
||||
end process;
|
||||
|
Loading…
x
Reference in New Issue
Block a user