EmbDev.net

Forum: FPGA, VHDL & Verilog SNAKE GAME VHDL


von Ya Y. (Company: enseirb) (lichentine)


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 .

von Klakx (Guest)


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.

von Ya Y. (Company: enseirb) (lichentine)


Attached files:

Rate this post
0 useful
not useful
Thanks for your reply

von Lothar M. (lkmiller) (Moderator)


Rate this post
0 useful
not useful
Ya Y. wrote:
> Thanks for your reply
1
           b_up       : in STD_LOGIC;
2
           b_down     : in STD_LOGIC;
3
           b_left     : in STD_LOGIC;
4
           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.
1
    type etat is (init, snake_right, snake_left, snake_up, snake_down, snake_pause);
2
:
3
:
4
        case etat_present is
5
:
6
:
7
        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.
1
signal sspixcol : unsigned( 6 downto 0 ):="0110000";
2
signal sspixrow : unsigned( 5 downto 0 ):="100000";
3
signal noir : STD_LOGIC_VECTOR (15 downto 0) :="0000000000000000";
4
signal vert : STD_LOGIC_VECTOR (15 downto 0) :="0000001111100000";
5
:
6
:
7
        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...
1
signal sspixcol : integer range 0 to 127 := 96;
2
signal sspixrow : integer range 0 to 63  := 32;
3
:
4
:
5
        sspixrow <= sspixrow - 1;

: Edited by Moderator
von Ya Y. (Company: enseirb) (lichentine)


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.