Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
canbus
CTU CAN FD IP Core
Commits
bbe2eb29
Commit
bbe2eb29
authored
Jun 08, 2018
by
Ille, Ondrej, Ing.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added seed to CAN test entity. Seed set externally.
Random pool pointer manipulated internally in the test.
parent
4415494c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
23 deletions
+56
-23
test/lib/CANtestLib.vhd
test/lib/CANtestLib.vhd
+56
-23
No files found.
test/lib/CANtestLib.vhd
View file @
bbe2eb29
...
...
@@ -579,6 +579,22 @@ package CANtestLib is
);
----------------------------------------------------------------------------
-- Sets random counter based on the seed that was given. To differentiate
-- individual counters, fixed offset can be added.
--
-- Arguments:
-- seed Random seed input.
-- offset Offset of counter
-- rand_ctr Random counter to set.
----------------------------------------------------------------------------
procedure
apply_rand_seed
(
constant
seed
:
in
natural
;
constant
offset
:
in
natural
;
signal
rand_ctr
:
out
natural
range
0
to
RAND_POOL_SIZE
);
----------------------------------------------------------------------------
-- Decode data length code from value as defined in CAN FD Standard to
-- length of frame in bytes.
...
...
@@ -1349,6 +1365,9 @@ package CANtestLib is
----------------------------------------------------------------------------
----------------------------------------------------------------------------
component
CAN_test
is
generic
(
constant
seed
:
in
natural
:
=
0
);
port
(
signal
run
:
in
boolean
;
signal
iterations
:
in
natural
;
...
...
@@ -1554,6 +1573,19 @@ package body CANtestLib is
end
;
procedure
apply_rand_seed
(
constant
seed
:
in
natural
;
constant
offset
:
in
natural
;
signal
rand_ctr
:
out
natural
range
0
to
RAND_POOL_SIZE
)
is
variable
tmp
:
natural
;
begin
tmp
:
=
seed
+
offset
;
rand_ctr
<=
tmp
mod
RAND_POOL_SIZE
;
wait
for
0
ns
;
end
procedure
;
procedure
decode_dlc
(
signal
dlc
:
in
std_logic_vector
(
3
downto
0
);
variable
length
:
out
natural
...
...
@@ -3254,36 +3286,37 @@ end package body;
USE
work
.
CANtestLib
.
All
;
-------------------------------------------------------------
-- Main test entity. Each test of the unit test environment
-- implements architecture of this entity!
-------------------------------------------------------------
--------------------------------------------------------------------------------
-- Main test entity. Each test implements architecture of this entity.
--------------------------------------------------------------------------------
entity
CAN_test
is
port
(
generic
(
constant
seed
:
in
natural
:
=
0
);
port
(
-- Input trigger, test starts running when true
signal
run
:
in
boolean
;
-- Input trigger, test starts running when true
signal
run
:
in
boolean
;
-- Number of iterations that test should do
signal
iterations
:
in
natural
;
-- Number of iterations that test should do
signal
iterations
:
in
natural
;
-- Logging level, severity which should be shown
signal
log_level
:
in
log_lvl_type
;
-- Logging level, severity which should be shown
signal
log_level
:
in
log_lvl_type
;
-- Test behaviour when error occurs: Quit, or Go on
signal
error_beh
:
in
err_beh_type
;
-- Test behaviour when error occurs: Quit, or Go on
signal
error_beh
:
in
err_beh_type
;
-- Error tolerance, error counter should not
-- exceed this value in order for the test to pass
signal
error_tol
:
in
natural
;
-- Status of the test
signal
status
:
out
test_status_type
;
-- Error tolerance, error counter should not
-- exceed this value in order for the test to pass
signal
error_tol
:
in
natural
;
-- Status of the test
signal
status
:
out
test_status_type
;
-- Amount of errors which appeared in the test
signal
errors
:
out
natural
--TODO: Error log results
);
-- Amount of errors which appeared in the test
signal
errors
:
out
natural
);
--Internal test signals
signal
error_ctr
:
natural
:
=
0
;
...
...
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