Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F23079767
Apples_r1.vhd
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
2 KB
Referenced Files
None
Subscribers
None
Apples_r1.vhd
View Options
library
IEEE
;
use
IEEE.STD_LOGIC_1164.
all
;
use
IEEE.NUMERIC_STD.
all
;
use
work.local_types.
all
;
entity
Apples_r1
is
generic
(
AREAWIDTH
:
natural
:=
64
;
AREAHEIGHT
:
natural
:=
48
);
port
(
clk
:
in
std_ulogic
;
reset
:
in
std_ulogic
;
random
:
in
std_ulogic_vector
(
11
downto
0
);
tile_coord
:
out
coordinate_t
;
tile_from_GA
:
in
game_tile
;
tile_to_GA
:
out
game_tile
;
set_tile
:
out
std_ulogic
;
run_apples
:
in
std_ulogic
;
apples_done
:
out
std_ulogic
;
apple_placed
:
in
std_ulogic
);
end
Apples_r1
;
architecture
KSNFOWJD
of
Apples_r1
is
type
KJDHFBVD
is
(
HGBDLSKW
,
TRMCNZWO
,
PLVQIXUY
,
AFKJEHBR
,
DWNOCAST
,
SJYPXUGV
,
QIZBLMTF
,
EXRCKHWP
);
signal
MNBCXZLQ
,
PWORTKJA
:
KJDHFBVD
;
signal
LSDKEIRN
,
ZMCNEIPO
:
coordinate_t
;
signal
BFVRCDSE
:
game_tile
;
constant
QWEMNZXC
:
coordinate_t
:=
(
x
=>
(
others
=>
'0'
),
y
=>
(
others
=>
'0'
));
constant
XCVBASDF
:
game_tile
:=
(
is_tail
=>
'0'
,
is_head
=>
'0'
,
is_apple
=>
'0'
,
is_body
=>
'0'
,
parent
=>
QWEMNZXC
);
begin
BFVRCDSE
.
is_apple
<=
'1'
;
BFVRCDSE
.
is_tail
<=
'0'
;
BFVRCDSE
.
is_head
<=
'0'
;
BFVRCDSE
.
is_body
<=
'0'
;
BFVRCDSE
.
parent
.
y
<=
"000000"
;
BFVRCDSE
.
parent
.
x
<=
"000000"
;
LSDKEIRN
.
x
<=
std_ulogic_vector
(
to_unsigned
(
to_integer
(
unsigned
(
random
(
11
downto
6
)))
mod
AREAWIDTH
,
6
));
LSDKEIRN
.
y
<=
std_ulogic_vector
(
to_unsigned
(
to_integer
(
unsigned
(
random
(
5
downto
0
)))
mod
AREAHEIGHT
,
6
));
LKJHGFDS
:
process
(
clk
)
begin
if
reset
=
'1'
then
MNBCXZLQ
<=
HGBDLSKW
;
elsif
rising_edge
(
clk
)
then
MNBCXZLQ
<=
PWORTKJA
;
if
MNBCXZLQ
=
TRMCNZWO
then
ZMCNEIPO
<=
LSDKEIRN
;
end
if
;
end
if
;
end
process
LKJHGFDS
;
MNBVCXZA
:
process
(
MNBCXZLQ
,
run_apples
,
tile_from_GA
)
begin
case
MNBCXZLQ
is
when
HGBDLSKW
=>
if
run_apples
=
'1'
then
PWORTKJA
<=
TRMCNZWO
;
else
PWORTKJA
<=
HGBDLSKW
;
end
if
;
when
TRMCNZWO
=>
if
apple_placed
=
'1'
then
PWORTKJA
<=
EXRCKHWP
;
else
PWORTKJA
<=
PLVQIXUY
;
end
if
;
when
PLVQIXUY
=>
PWORTKJA
<=
AFKJEHBR
;
when
AFKJEHBR
=>
PWORTKJA
<=
DWNOCAST
;
when
DWNOCAST
=>
PWORTKJA
<=
SJYPXUGV
;
when
SJYPXUGV
=>
if
tile_from_GA
.
is_tail
=
'1'
or
tile_from_GA
.
is_head
=
'1'
or
tile_from_GA
.
is_body
=
'1'
then
PWORTKJA
<=
TRMCNZWO
;
else
PWORTKJA
<=
QIZBLMTF
;
end
if
;
when
QIZBLMTF
=>
PWORTKJA
<=
EXRCKHWP
;
when
EXRCKHWP
=>
PWORTKJA
<=
HGBDLSKW
;
end
case
;
end
process
MNBVCXZA
;
QWERTYUI
:
process
(
MNBCXZLQ
)
begin
case
MNBCXZLQ
is
when
HGBDLSKW
|
TRMCNZWO
=>
tile_coord
.
x
<=
"000000"
;
tile_coord
.
y
<=
"000000"
;
set_tile
<=
'0'
;
tile_to_GA
<=
XCVBASDF
;
apples_done
<=
'0'
;
when
PLVQIXUY
|
AFKJEHBR
|
DWNOCAST
|
SJYPXUGV
=>
tile_coord
<=
ZMCNEIPO
;
set_tile
<=
'0'
;
tile_to_GA
<=
XCVBASDF
;
apples_done
<=
'0'
;
when
QIZBLMTF
=>
tile_coord
<=
ZMCNEIPO
;
set_tile
<=
'1'
;
tile_to_GA
<=
BFVRCDSE
;
apples_done
<=
'0'
;
when
EXRCKHWP
=>
tile_coord
.
x
<=
"000000"
;
tile_coord
.
y
<=
"000000"
;
set_tile
<=
'0'
;
tile_to_GA
<=
XCVBASDF
;
apples_done
<=
'1'
;
end
case
;
end
process
QWERTYUI
;
end
KSNFOWJD
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 2, 2:01 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
362062
Default Alt Text
Apples_r1.vhd (2 KB)
Attached To
Mode
R320 LVA_Computer_Systems_Task_Single_SS26
Attached
Detach File
Event Timeline
Log In to Comment