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;
|