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
09a4baf6
Commit
09a4baf6
authored
6 years ago
by
vagle
Browse files
Options
Downloads
Patches
Plain Diff
some edgy commit
parent
acc2b904
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
+40
-4
40 additions, 4 deletions
...fe_v2/game_of_life_v2.srcs/sources_1/new/game_of_life.vhd
with
40 additions
and
4 deletions
game_of_life_v2/game_of_life_v2.srcs/sources_1/new/game_of_life.vhd
+
40
−
4
View file @
09a4baf6
...
...
@@ -85,6 +85,11 @@ signal frame_sig : std_logic_vector(11 downto 0);
signal
shift_register_top
:
std_logic_vector
(
0
to
cell_number
-1
);
signal
shift_register_middle
:
std_logic_vector
(
0
to
cell_number
-1
);
signal
actual_register
:
std_logic_vector
(
0
to
0
);
--signal copy_shift_register_top : std_logic_vector(0 to cell_number-1);
--signal copy_shift_register_middle : std_logic_vector(0 to cell_number-1);
--signal copy_actual_register : std_logic_vector(0 to 0);
signal
neighbours
:
std_logic_vector
(
0
to
8
);
signal
neighbours_count
:
unsigned
(
3
downto
0
);
signal
frame_counter
:
unsigned
(
6
downto
0
);
...
...
@@ -162,17 +167,46 @@ begin
if
switch_mode
=
'1'
and
frame_counter
=
0
and
horizontal_counter
(
2
downto
0
)
=
0
and
horizontal_counter
(
9
downto
3
)
<
cell_number
and
vertical_counter
(
2
downto
0
)
=
0
and
vertical_counter
(
9
downto
3
)
<
cell_number
then
shift_register_top
<=
shift_register_top
(
1
to
cell_number
-1
)
&
shift_register_middle
(
0
);
--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
if
horizontal_counter
(
9
downto
3
)
<
cell_number
and
vertical_counter
(
9
downto
3
)
<
cell_number
then
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
--if horizontal_counter(9 downto 3) < cell_number and vertical_counter(9 downto 3) < cell_number then
--copy_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
)
&
actual_register
;
--copy_shift_register_middle <= shift_register_middle(1 to cell_number-1) & actual_register;
neighbours
<=
neighbours
(
3
to
8
)
&
shift_register_top
(
0
)
&
shift_register_middle
(
0
)
&
actual_register
;
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
))
+
unsigned
(
shift_register_top
(
0
to
0
))
+
unsigned
(
shift_register_middle
(
0
to
0
))
+
unsigned
(
actual_register
);
actual_register
(
0
)
<=
cells
(
to_integer
((
vertical_counter
(
9
downto
3
))
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)));
--copy_actual_register(0) <= cells(to_integer((vertical_counter(9 downto 3))* to_unsigned(cell_number,8) + horizontal_counter(9 downto 3)));
else
shift_register_middle
<=
shift_register_middle
(
1
to
cell_number
-1
)
&
actual_register
;
neighbours
<=
neighbours
(
3
to
8
)
&
shift_register_top
(
0
)
&
shift_register_middle
(
0
)
&
actual_register
;
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
))
+
unsigned
(
shift_register_top
(
0
to
0
))
+
unsigned
(
shift_register_middle
(
0
to
0
))
+
unsigned
(
actual_register
);
actual_register
<=
(
others
=>
'0'
);
-- left top corner
if
horizontal_counter
(
9
downto
3
)
=
0
and
vertical_counter
(
9
downto
3
)
=
0
then
neighbours_count
<=
neighbours_count
+
unsigned
(
neighbours
(
8
to
8
))
+
unsigned
(
shift_register_middle
(
0
to
0
))
+
unsigned
(
actual_register
);
-- right top corner
elsif
horizontal_counter
(
9
downto
3
)
=
cell_number
-1
and
vertical_counter
(
9
downto
3
)
=
0
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
));
-- left bottom corner
elsif
horizontal_counter
(
9
downto
3
)
=
0
and
vertical_counter
(
9
downto
3
)
=
cell_number
-1
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
))
-
unsigned
(
neighbours
(
3
to
3
))
-
unsigned
(
neighbours
(
4
to
4
))
-
unsigned
(
neighbours
(
5
to
5
))
+
unsigned
(
neighbours
(
6
to
6
))
+
unsigned
(
neighbours
(
7
to
7
))
+
unsigned
(
neighbours
(
8
to
8
))
+
unsigned
(
shift_register_top
(
0
to
0
))
+
unsigned
(
shift_register_middle
(
0
to
0
));
-- right bottom corner
elsif
horizontal_counter
(
9
downto
3
)
=
cell_number
-1
and
vertical_counter
(
9
downto
3
)
=
cell_number
-1
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
));
-- top edge
elsif
vertical_counter
(
9
downto
3
)
=
0
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
))
+
unsigned
(
shift_register_middle
(
0
to
0
))
+
unsigned
(
actual_register
);
-- left edge
elsif
horizontal_counter
(
9
downto
3
)
=
0
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
))
-
unsigned
(
neighbours
(
3
to
3
))
-
unsigned
(
neighbours
(
4
to
4
))
-
unsigned
(
neighbours
(
5
to
5
))
+
unsigned
(
neighbours
(
6
to
6
))
+
unsigned
(
neighbours
(
7
to
7
))
+
unsigned
(
neighbours
(
8
to
8
))
+
unsigned
(
shift_register_top
(
0
to
0
))
+
unsigned
(
shift_register_middle
(
0
to
0
))
+
unsigned
(
actual_register
);
-- right edge
elsif
horizontal_counter
(
9
downto
3
)
=
cell_number
-1
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
-
unsigned
(
neighbours
(
2
to
2
));
-- bottom edge
elsif
vertical_counter
(
9
downto
3
)
=
cell_number
-1
then
neighbours_count
<=
neighbours_count
-
unsigned
(
neighbours
(
0
to
0
))
-
unsigned
(
neighbours
(
1
to
1
))
+
unsigned
(
shift_register_top
(
0
to
0
))
+
unsigned
(
shift_register_middle
(
0
to
0
));
end
if
;
actual_register
(
0
)
<=
cells
(
to_integer
((
vertical_counter
(
9
downto
3
))
*
to_unsigned
(
cell_number
,
8
)
+
horizontal_counter
(
9
downto
3
)));
end
if
;
if
vertical_counter
(
9
downto
3
)
>=
2
and
horizontal_counter
(
9
downto
3
)
>=
2
then
...
...
@@ -251,6 +285,8 @@ begin
-- position changing
if
vertical_counter
=
VERTICAL_SYNC_PULSE
-1
then
vertical_counter
<=
(
others
=>
'0'
);
neighbours_count
<=
(
others
=>
'0'
);
neighbours
<=
(
others
=>
'0'
);
if
frame_counter
=
63
then
frame_counter
<=
(
others
=>
'0'
);
else
...
...
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