Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CTU CAN FD IP Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canbus
CTU CAN FD IP Core
Commits
d3787d7d
Commit
d3787d7d
authored
Sep 20, 2018
by
Ille, Ondrej, Ing.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Range filter part of the test.
parent
443d73fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
2 deletions
+158
-2
test/feature/feature_env_setup.tcl
test/feature/feature_env_setup.tcl
+11
-1
test/feature/message_filter_feature_tb.vhd
test/feature/message_filter_feature_tb.vhd
+146
-0
test/lib/CANtestLib.vhd
test/lib/CANtestLib.vhd
+1
-1
No files found.
test/feature/feature_env_setup.tcl
View file @
d3787d7d
...
...
@@ -91,7 +91,11 @@ add wave -group "RX Buffer (1)" \
-label
"Free words"
-unsigned $TCOMP/$INST1/rx_mem_free
\
-label
"Read pointer"
-unsigned $TCOMP/$INST1/rx_read_pointer_pos
\
-label
"Write pointer"
-unsigned $TCOMP/$INST1/rx_write_pointer_pos
\
-label
"Data overrun"
-unsigned $TCOMP/$INST1/rx_data_overrun
-label
"Store metadata"
-unsigned $TCOMP/$INST1/rx_store_metadata
\
-label
"RX Abort"
-unsigned $TCOMP/$INST1/rx_abort
\
-label
"RX Store data"
-unsigned $TCOMP/$INST1/rx_store_data_valid
\
-label
"RX Store valid"
-unsigned $TCOMP/$INST1/rec_message_store
\
-label
"Data overrun"
-unsigned $TCOMP/$INST1/rx_data_overrun
add wave -group
"TXT Buffers (1)"
\
-label
"FSM States"
$TCOMP/$INST1/txtb_fsms
\
...
...
@@ -128,8 +132,14 @@ add wave -group "Message filters" \
-label
"Filter A value"
$TCOMP/$INST1/mes_filt_comp/drv_filter_A_bits
\
-label
"Filter A control"
$TCOMP/$INST1/mes_filt_comp/drv_filter_A_ctrl
\
-label
"Filter A valid"
$TCOMP/$INST1/mes_filt_comp/int_filter_A_valid
\
-label
"Filter Range valid"
$TCOMP/$INST1/mes_filt_comp/int_filter_ran_valid
\
-label
"Filter Range HI Threshold"
$TCOMP/$INST1/mes_filt_comp/drv_filter_ran_hi_th
\
-label
"Filter Range LO Threshold"
$TCOMP/$INST1/mes_filt_comp/drv_filter_ran_lo_th
\
-label
"Filter Range control"
$TCOMP/$INST1/mes_filt_comp/drv_filter_ran_ctrl
\
-label
"Filter out valid"
$TCOMP/$INST1/mes_filt_comp/out_ident_valid
add wave -group
"Prescaler (1)"
\
-label
"Time quantum (Nominal)"
$TCOMP/$INST1/clk_tq_nbt
\
-label
"Time quantum (Data)"
$TCOMP/$INST1/clk_tq_dbt
\
...
...
test/feature/message_filter_feature_tb.vhd
View file @
d3787d7d
...
...
@@ -134,6 +134,8 @@ package body message_filter_feature is
variable
tmp_log
:
std_logic
:
=
'0'
;
variable
should_pass
:
boolean
:
=
false
;
variable
mask_filter
:
SW_CAN_mask_filter_type
;
variable
l_th
:
natural
:
=
0
;
variable
h_th
:
natural
:
=
0
;
begin
o
.
outcome
:
=
true
;
CAN_generate_frame
(
rand_ctr
,
CAN_frame
);
...
...
@@ -315,16 +317,160 @@ package body message_filter_feature is
-- Check!
if
((
rx_state
.
rx_empty
=
true
)
and
(
should_pass
=
true
))
then
-- LCOV_EXCL_START
report
"Frame should have passed but did NOT!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
if
((
rx_state
.
rx_empty
=
false
)
and
(
should_pass
=
false
))
then
-- LCOV_EXCL_START
report
"Frame should NOT have passed but did!"
severity
error
;
end
if
;
end
loop
;
end
loop
;
------------------------------------------------------------------------
-- Part 3 (Range filters)
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Disable mask fitlters
------------------------------------------------------------------------
mask_filt_config
.
acc_CAN_2_0
:
=
false
;
mask_filt_config
.
acc_CAN_FD
:
=
false
;
mask_filt_config
.
ID_mask
:
=
0
;
mask_filt_config
.
ID_value
:
=
0
;
CAN_set_mask_filter
(
filter_A
,
mask_filt_config
,
ID_1
,
mem_bus
(
1
));
CAN_set_mask_filter
(
filter_B
,
mask_filt_config
,
ID_1
,
mem_bus
(
1
));
CAN_set_mask_filter
(
filter_C
,
mask_filt_config
,
ID_1
,
mem_bus
(
1
));
------------------------------------------------------------------------
-- Generate random thresholds for identifier!
------------------------------------------------------------------------
if
(
CAN_frame
.
ident_type
=
BASE
)
then
rand_int_v
(
rand_ctr
,
(
2
**
6
),
l_th
);
rand_int_v
(
rand_ctr
,
(
2
**
11
)
-
1
,
h_th
);
else
rand_int_v
(
rand_ctr
,
(
2
**
14
),
l_th
);
rand_int_v
(
rand_ctr
,
(
2
**
28
)
-
1
,
h_th
);
end
if
;
-- Make sure upper threshold is not lower then low threshold!
-- Avoid 0, max ident. so that we can test all cases!
l_th
:
=
l_th
+
1
;
if
(
l_th
>=
h_th
)
then
h_th
:
=
l_th
+
5
;
end
if
;
h_th
:
=
h_th
-
1
;
------------------------------------------------------------------------
-- Configure Range filter
------------------------------------------------------------------------
range_filt_config
.
acc_CAN_2_0
:
=
true
;
range_filt_config
.
acc_CAN_FD
:
=
true
;
range_filt_config
.
ID_th_high
:
=
h_th
;
range_filt_config
.
ID_th_low
:
=
l_th
;
CAN_set_range_filter
(
range_filt_config
,
ID_1
,
mem_bus
(
1
));
CAN_generate_frame
(
rand_ctr
,
CAN_frame
);
CAN_frame
.
ident_type
:
=
BASE
;
CAN_frame
.
rtr
:
=
RTR_FRAME
;
report
"ID value: "
&
integer
'image
(
CAN_frame
.
identifier
);
report
"Low threshold: "
&
integer
'image
(
l_th
);
report
"High threshold: "
&
integer
'image
(
h_th
);
------------------------------------------------------------------------
-- Send frame with ID lower than low threshold! Check that frame
-- was not received!
------------------------------------------------------------------------
CAN_frame
.
identifier
:
=
l_th
-
1
;
command
.
release_rec_buffer
:
=
true
;
give_controller_command
(
command
,
ID_1
,
mem_bus
(
1
));
CAN_send_frame
(
CAN_frame
,
1
,
ID_2
,
mem_bus
(
2
),
frame_sent
);
CAN_wait_frame_sent
(
ID_1
,
mem_bus
(
1
));
get_rx_buf_state
(
rx_state
,
ID_1
,
mem_bus
(
1
));
if
(
not
rx_state
.
rx_empty
)
then
-- LCOV_EXCL_START
report
"Frame with lower than Low threshold passed, but should NOT!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
------------------------------------------------------------------------
-- Send frame with ID equal to low threshold! Check that frame
-- was received!
------------------------------------------------------------------------
CAN_frame
.
identifier
:
=
l_th
;
command
.
release_rec_buffer
:
=
true
;
give_controller_command
(
command
,
ID_1
,
mem_bus
(
1
));
CAN_send_frame
(
CAN_frame
,
1
,
ID_2
,
mem_bus
(
2
),
frame_sent
);
CAN_wait_frame_sent
(
ID_1
,
mem_bus
(
1
));
get_rx_buf_state
(
rx_state
,
ID_1
,
mem_bus
(
1
));
if
(
rx_state
.
rx_empty
)
then
-- LCOV_EXCL_START
report
"Frame ID equal to Low threshold did not pass, but should!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
------------------------------------------------------------------------
-- Send frame with ID between Low Threshold and High Threshold!
------------------------------------------------------------------------
CAN_frame
.
identifier
:
=
((
h_th
-
l_th
)
/
2
)
+
l_th
;
command
.
release_rec_buffer
:
=
true
;
give_controller_command
(
command
,
ID_1
,
mem_bus
(
1
));
CAN_send_frame
(
CAN_frame
,
1
,
ID_2
,
mem_bus
(
2
),
frame_sent
);
CAN_wait_frame_sent
(
ID_1
,
mem_bus
(
1
));
get_rx_buf_state
(
rx_state
,
ID_1
,
mem_bus
(
1
));
if
(
rx_state
.
rx_empty
)
then
-- LCOV_EXCL_START
report
"Frame with ID between Lower and Upper Threshold did not pass!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
------------------------------------------------------------------------
-- Send frame with ID equal to high threshold! Check that frame
-- was received!
------------------------------------------------------------------------
CAN_frame
.
identifier
:
=
h_th
;
command
.
release_rec_buffer
:
=
true
;
give_controller_command
(
command
,
ID_1
,
mem_bus
(
1
));
CAN_send_frame
(
CAN_frame
,
1
,
ID_2
,
mem_bus
(
2
),
frame_sent
);
CAN_wait_frame_sent
(
ID_1
,
mem_bus
(
1
));
get_rx_buf_state
(
rx_state
,
ID_1
,
mem_bus
(
1
));
if
(
rx_state
.
rx_empty
)
then
-- LCOV_EXCL_START
report
"Frame ID equal to High threshold did not pass, but should!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
------------------------------------------------------------------------
-- Send frame with ID higher than high threshold! Check that frame
-- was received!
------------------------------------------------------------------------
CAN_frame
.
identifier
:
=
h_th
+
1
;
command
.
release_rec_buffer
:
=
true
;
give_controller_command
(
command
,
ID_1
,
mem_bus
(
1
));
CAN_send_frame
(
CAN_frame
,
1
,
ID_2
,
mem_bus
(
2
),
frame_sent
);
CAN_wait_frame_sent
(
ID_1
,
mem_bus
(
1
));
get_rx_buf_state
(
rx_state
,
ID_1
,
mem_bus
(
1
));
if
(
not
rx_state
.
rx_empty
)
then
-- LCOV_EXCL_START
report
"Frame ID higher than High threshold did pass, but should NOT!"
severity
error
;
-- LCOV_EXCL_STOP
end
if
;
end
procedure
;
end
package
body
;
test/lib/CANtestLib.vhd
View file @
d3787d7d
...
...
@@ -2720,7 +2720,7 @@ package body CANtestLib is
begin
-- Check High threshold aint lower than Low threshold
if
(
config
.
ID_th_low
<
config
.
ID_th_high
)
then
if
(
config
.
ID_th_low
>
config
.
ID_th_high
)
then
report
"High threshold of Range filter Lower than Low threshold!"
severity
warning
;
end
if
;
...
...
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