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
3ea79a7e
Commit
3ea79a7e
authored
Jun 12, 2018
by
Ille, Ondrej, Ing.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added procedure for reading traffic counters
to CAN Test library.
parent
ea4f1dfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
test/lib/CANtestLib.vhd
test/lib/CANtestLib.vhd
+41
-0
No files found.
test/lib/CANtestLib.vhd
View file @
3ea79a7e
...
...
@@ -207,6 +207,13 @@ package CANtestLib is
end
record
;
-- Traffic counters
type
SW_traffic_counters
is
record
rx_frames
:
natural
;
tx_frames
:
natural
;
end
record
;
-- RX Buffer info and status
type
SW_RX_Buffer_info
is
record
rx_buff_size
:
natural
range
0
to
2
**
13
-
1
;
...
...
@@ -1396,6 +1403,22 @@ package CANtestLib is
signal
mem_bus
:
inout
Avalon_mem_type
);
----------------------------------------------------------------------------
-- Read traffic counters.
--
-- Arguments:
-- ctr Variable in which traffic counters will be stored
-- ID Index of CTU CAN FD Core instance.
-- mem_bus Avalon memory bus to execute the access on.
----------------------------------------------------------------------------
procedure
read_traffic_counters
(
variable
ctr
:
out
SW_traffic_counters
;
constant
ID
:
in
natural
range
0
to
15
;
signal
mem_bus
:
inout
Avalon_mem_type
);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- sanity test Stuff; must be in a package
...
...
@@ -3410,6 +3433,24 @@ package body CANtestLib is
end
procedure
;
procedure
read_traffic_counters
(
variable
ctr
:
out
SW_traffic_counters
;
constant
ID
:
in
natural
range
0
to
15
;
signal
mem_bus
:
inout
Avalon_mem_type
)
is
variable
data
:
std_logic_vector
(
31
downto
0
);
begin
CAN_read
(
data
,
RX_COUNTER_ADR
,
ID
,
mem_bus
);
ctr
.
rx_frames
:
=
to_integer
(
unsigned
(
data
(
RX_COUNTER_VAL_H
downto
RX_COUNTER_VAL_L
)));
CAN_read
(
data
,
TX_COUNTER_ADR
,
ID
,
mem_bus
);
ctr
.
tx_frames
:
=
to_integer
(
unsigned
(
data
(
TX_COUNTER_VAL_H
downto
TX_COUNTER_VAL_L
)));
end
procedure
;
end
package
body
;
...
...
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