Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Gateware
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
12
Issues
12
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Gateware
Commits
1c33a80f
Commit
1c33a80f
authored
Aug 09, 2019
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrsw_ext_board: synchronous reset for FSM
parent
78d3f242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
ext_board_check.vhd
modules/wrsw_ext_board/ext_board_check.vhd
+32
-30
No files found.
modules/wrsw_ext_board/ext_board_check.vhd
View file @
1c33a80f
...
...
@@ -85,42 +85,44 @@ begin
FSM_INST
:
process
(
clk_sys_i
)
begin
if
rst_n_i
=
'0'
then
board_detected_o
<=
'0'
;
fsm_state
<=
INIT
;
elsif
rising_edge
(
clk_sys_i
)
then
case
fsm_state
is
when
INIT
=>
board_detected_o
<=
'0'
;
bit_position
<=
0
;
fsm_state
<=
WRITE_BIT
;
error_detected
<=
'0'
;
if
rising_edge
(
clk_sys_i
)
then
if
rst_n_i
=
'0'
then
board_detected_o
<=
'0'
;
fsm_state
<=
INIT
;
else
case
fsm_state
is
when
INIT
=>
board_detected_o
<=
'0'
;
bit_position
<=
0
;
fsm_state
<=
WRITE_BIT
;
error_detected
<=
'0'
;
when
WRITE_BIT
=>
loopback_o
<=
g_pattern
(
bit_position
);
if
(
clk_en
=
'1'
)
then
fsm_state
<=
READ_BIT
;
end
if
;
when
WRITE_BIT
=>
loopback_o
<=
g_pattern
(
bit_position
);
if
(
clk_en
=
'1'
)
then
fsm_state
<=
READ_BIT
;
end
if
;
when
READ_BIT
=>
if
(
g_pattern
(
bit_position
)
=
loopback_i
)
then
if
(
bit_position
=
g_pattern
'length
-1
)
then
fsm_state
<=
DONE
;
when
READ_BIT
=>
if
(
g_pattern
(
bit_position
)
=
loopback_i
)
then
if
(
bit_position
=
g_pattern
'length
-1
)
then
fsm_state
<=
DONE
;
else
bit_position
<=
bit_position
+
1
;
fsm_state
<=
WRITE_BIT
;
end
if
;
else
bit_position
<=
bit_position
+
1
;
fsm_state
<=
WRITE_BIT
;
error_detected
<=
'1'
;
fsm_state
<=
DONE
;
end
if
;
else
error_detected
<=
'1'
;
fsm_state
<=
DONE
;
end
if
;
when
DONE
=>
board_detected_o
<=
not
error_detected
;
when
DONE
=>
board_detected_o
<=
not
error_detected
;
when
others
=>
fsm_state
<=
INIT
;
end
case
;
when
others
=>
fsm_state
<=
INIT
;
end
case
;
end
if
;
end
if
;
end
process
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment