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
78d3f242
Commit
78d3f242
authored
Aug 09, 2019
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrsw_ext_board: fix formatting, no technical change
parent
a8d8867f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
69 deletions
+69
-69
Manifest.py
modules/wrsw_ext_board/Manifest.py
+1
-1
ext_board_check.vhd
modules/wrsw_ext_board/ext_board_check.vhd
+68
-68
No files found.
modules/wrsw_ext_board/Manifest.py
View file @
78d3f242
files
=
[
"ext_board_check.vhd"
];
files
=
[
"ext_board_check.vhd"
];
modules/wrsw_ext_board/ext_board_check.vhd
View file @
78d3f242
...
...
@@ -5,8 +5,6 @@
-- File : ext_board_check.vhd
-- Author : Mattia Rzzi
-- Company : CERN BE-CO-HT
-- Created : 2012-03-07
-- Last update: 2014-03-20
-- Platform : FPGA-generic
-- Standard : VHDL
-------------------------------------------------------------------------------
...
...
@@ -44,84 +42,86 @@ use work.wr_fabric_pkg.all;
use
work
.
endpoint_pkg
.
all
;
use
work
.
wrsw_top_pkg
.
all
;
library
UNISIM
;
use
UNISIM
.
vcomponents
.
all
;
entity
ext_board_check
is
generic
(
g_pattern
:
std_logic_vector
(
63
downto
0
)
:
=
x"CAFED00DCAFED00D"
;
g_clk_divider
:
integer
:
=
16
);
g_pattern
:
std_logic_vector
(
63
downto
0
)
:
=
x"CAFED00DCAFED00D"
;
g_clk_divider
:
integer
:
=
16
);
port
(
clk_sys_i
:
in
std_logic
;
rst_n_i
:
in
std_logic
;
loopback_i
:
in
std_logic
;
loopback_o
:
out
std_logic
;
board_detected_o
:
out
std_logic
);
clk_sys_i
:
in
std_logic
;
rst_n_i
:
in
std_logic
;
loopback_i
:
in
std_logic
;
loopback_o
:
out
std_logic
;
board_detected_o
:
out
std_logic
);
end
ext_board_check
;
architecture
Behavioral
of
ext_board_check
is
signal
clk_divider
:
integer
range
0
to
g_clk_divider
-1
;
signal
clk_en
:
std_logic
;
signal
bit_position
:
integer
range
0
to
g_pattern
'length
-1
;
type
fsm_states
is
(
init
,
write_bit
,
read_bit
,
done
);
signal
fsm_state
:
fsm_states
:
=
init
;
signal
error_detected
:
std_logic
;
begin
signal
clk_divider
:
integer
range
0
to
g_clk_divider
-1
;
signal
clk_en
:
std_logic
;
signal
bit_position
:
integer
range
0
to
g_pattern
'length
-1
;
signal
error_detected
:
std_logic
;
clock_divider_inst
:
process
(
clk_sys_i
)
begin
if
rising_edge
(
clk_sys_i
)
then
clk_divider
<=
clk_divider
+
1
;
if
(
clk_divider
=
g_clk_divider
-
1
)
then
clk_divider
<=
0
;
clk_en
<=
'1'
;
else
clk_en
<=
'0'
;
end
if
;
end
if
;
end
process
;
type
fsm_states
is
(
INIT
,
WRITE_BIT
,
READ_BIT
,
DONE
);
signal
fsm_state
:
fsm_states
:
=
INIT
;
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'
;
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
;
else
bit_position
<=
bit_position
+
1
;
fsm_state
<=
write_bit
;
end
if
;
else
error_detected
<=
'1'
;
fsm_state
<=
done
;
end
if
;
when
done
=>
board_detected_o
<=
not
error_detected
;
when
others
=>
fsm_state
<=
init
;
end
case
;
end
if
;
end
process
;
clock_divider_inst
:
process
(
clk_sys_i
)
begin
if
rising_edge
(
clk_sys_i
)
then
clk_divider
<=
clk_divider
+
1
;
if
(
clk_divider
=
g_clk_divider
-
1
)
then
clk_divider
<=
0
;
clk_en
<=
'1'
;
else
clk_en
<=
'0'
;
end
if
;
end
if
;
end
process
;
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'
;
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
;
else
bit_position
<=
bit_position
+
1
;
fsm_state
<=
WRITE_BIT
;
end
if
;
else
error_detected
<=
'1'
;
fsm_state
<=
DONE
;
end
if
;
when
DONE
=>
board_detected_o
<=
not
error_detected
;
when
others
=>
fsm_state
<=
INIT
;
end
case
;
end
if
;
end
process
;
end
Behavioral
;
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