EmbDev.net

Forum: FPGA, VHDL & Verilog SNAKE GAME VHDL


Author: Ya Y. (Company: enseirb) (lichentine)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hi
I am trying to develop a snake game using a Nexys 4 board and oled rgb 
screen.
I can't generate automaticaly an other point on the screen when the 
snake's head meets the food and while the head is moving . My random 
generator(control_pomme) seems to work .  I didn't base my project on 
the use of a RAM , do you think it is necessary because  almost all the 
snake-like  vga projects on the web seem to use this approach .

Author: Klakx (Guest)
Posted on:

Rate this post
0 useful
not useful
None of the vhdl-files instantiate each other. Therefore, I cannot 
reproduce any tests.

If you need a lot of memory then you can use ram. Otherwise, FFs will do 
the job well.

Author: Ya Y. (Company: enseirb) (lichentine)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Thanks for your reply

Author: Lothar M. (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Ya Y. wrote:
> Thanks for your reply
           b_up       : in STD_LOGIC;
           b_down     : in STD_LOGIC;
           b_left     : in STD_LOGIC;
           b_right    : in STD_LOGIC;
If those are asynchronous real world buttons, then you must sync them 
to your clock. Otherwise you will encouter curious problems.
    type etat is (init, snake_right, snake_left, snake_up, snake_down, snake_pause);
:
:
        case etat_present is
:
:
        when others => go_up <= '0';     --others = snake_down
Instead of "others" you better should have written "snake_down", because 
then there would remain no "others" and the obfuscating "others" clause 
would be not needed.
signal sspixcol : unsigned( 6 downto 0 ):="0110000";
signal sspixrow : unsigned( 5 downto 0 ):="100000";
signal noir : STD_LOGIC_VECTOR (15 downto 0) :="0000000000000000";
signal vert : STD_LOGIC_VECTOR (15 downto 0) :="0000001111100000";
:
:
        sspixrow <= sspixrow - "000001";
Why don't you work with integers throughout? Then you could use "real 
world numbers" instead of unreadable binary codes. And the arithmetic 
operations would be much easier to understand...
signal sspixcol : integer range 0 to 127 := 96;
signal sspixrow : integer range 0 to 63  := 32;
:
:
        sspixrow <= sspixrow - 1;

: Edited by Moderator
Author: Ya Y. (Company: enseirb) (lichentine)
Posted on:

Rate this post
0 useful
not useful
I use a debouncer for the buttons , all project files are in the second 
post.
Thanks for  the other  remarks

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.