Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fpga_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mlinkó Péter
fpga_project
Commits
e4385599
Commit
e4385599
authored
6 years ago
by
Mlinkó Péter
Browse files
Options
Downloads
Patches
Plain Diff
Main file modified
parent
06e01d3d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game_of_life_v2/game_of_life_v2.srcs/sources_1/new/game_of_life.vhd
+41
-6
41 additions, 6 deletions
...fe_v2/game_of_life_v2.srcs/sources_1/new/game_of_life.vhd
with
41 additions
and
6 deletions
game_of_life_v2/game_of_life_v2.srcs/sources_1/new/game_of_life.vhd
+
41
−
6
View file @
e4385599
...
...
@@ -58,8 +58,8 @@ port
end
component
;
signal
clk_25MHz
,
locked
:
std_logic
;
signal
cells
:
std_logic_vector
(
0
to
cell_number
-1
)
:
=
(
others
=>
'0'
);
signal
cells_to_draw
:
std_logic_vector
(
0
to
cell_number
-1
)
:
=
(
others
=>
'0'
);
signal
cells
:
std_logic_vector
(
0
to
cell_number
*
cell_number
-1
)
:
=
(
511
=>
'1'
,
512
=>
'1'
,
513
=>
'1'
,
others
=>
'0'
);
signal
cells_to_draw
:
std_logic_vector
(
0
to
cell_number
*
cell_number
-1
)
:
=
(
others
=>
'0'
);
-- drawing period's constants
constant
HORIZONTAL_SYNC_PULSE
:
integer
:
=
800
;
...
...
@@ -96,6 +96,7 @@ clk_gen_25MHz : clk_wiz_0
);
options
:
process
(
clk_25MHz
,
locked
)
variable
neighbour_cnt
:
unsigned
(
3
downto
0
)
:
=
(
others
=>
'0'
);
begin
if
locked
=
'0'
then
horizontal_counter
<=
(
others
=>
'0'
);
...
...
@@ -131,11 +132,45 @@ begin
end
if
;
-- handle shift registers
if
horizontal_counter
(
9
downto
3
)
<
cell_number
and
vertical_counter
(
9
downto
3
)
<
cell_number
then
if
horizontal_counter
(
9
downto
3
)
<
cell_number
+
2
and
vertical_counter
(
9
downto
3
)
<
cell_number
+
2
then
shift_register_top
<=
shift_register_top
(
1
to
cell_number
-1
)
&
shift_register_middle
(
0
);
shift_register_middle
<=
shift_register_middle
(
1
to
cell_number
-1
)
&
cells
(
to_integer
(
vertical_counter
(
9
downto
3
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)));
neighbours
<=
neighbours
(
3
to
8
)
&
shift_register_top
(
0
)
&
shift_register_middle
(
0
)
&
cells
(
to_integer
(
vertical_counter
(
9
downto
3
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)));
-- TODO
if
horizontal_counter
(
9
downto
3
)
/=
0
and
horizontal_counter
(
9
downto
3
)
<
cell_number
+
1
and
vertical_counter
(
9
downto
3
)
/=
0
and
vertical_counter
(
9
downto
3
)
<
cell_number
+
1
then
shift_register_middle
<=
shift_register_middle
(
1
to
cell_number
-1
)
&
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
));
neighbours
<=
neighbours
(
3
to
8
)
&
shift_register_top
(
0
)
&
shift_register_middle
(
0
)
&
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
));
else
shift_register_middle
<=
shift_register_middle
(
1
to
cell_number
-1
)
&
'0'
;
neighbours
<=
neighbours
(
3
to
8
)
&
shift_register_top
(
0
)
&
shift_register_middle
(
0
)
&
'0'
;
end
if
;
if
vertical_counter
(
9
downto
3
)
>=
2
and
horizontal_counter
(
9
downto
3
)
>=
2
then
neighbour_cnt
:
=
(
others
=>
'0'
);
for
i
in
0
to
8
loop
if
(
neighbours
(
i
))
=
'1'
then
neighbour_cnt
:
=
neighbour_cnt
+
1
;
end
if
;
end
loop
;
if
neighbours
(
4
)
=
'1'
then
if
neighbour_cnt
=
3
or
neighbour_cnt
=
4
then
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'1'
;
cells_to_draw
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'1'
;
else
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'0'
;
cells_to_draw
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'0'
;
end
if
;
else
if
neighbour_cnt
=
3
then
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'1'
;
cells_to_draw
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'1'
;
else
cells
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'0'
;
cells_to_draw
(
to_integer
((
vertical_counter
(
9
downto
3
)
-1
)
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)
-1
))
<=
'0'
;
end
if
;
end
if
;
end
if
;
end
if
;
-- sign options
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment