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
d42ec457
Commit
d42ec457
authored
Sep 03, 2018
by
Ille, Ondrej, Ing.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added variable version of read timing function.
parent
16e53835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
2 deletions
+50
-2
test/lib/CANtestLib.vhd
test/lib/CANtestLib.vhd
+50
-2
No files found.
test/lib/CANtestLib.vhd
View file @
d42ec457
...
...
@@ -945,6 +945,22 @@ package CANtestLib is
signal
mem_bus
:
inout
Avalon_mem_type
);
----------------------------------------------------------------------------
-- Read Bus timing configuration from CTU CAN FD Core.
-- (duration of bit phases, synchronisation jump width, baud-rate prescaler)
--
-- Arguments:
-- bus_timing Bus timing structure that will be filled by timing
-- configuration.
-- ID Index of CTU CAN FD Core instance
-- mem_bus Avalon memory bus to execute the access on.
----------------------------------------------------------------------------
procedure
CAN_read_timing_v
(
variable
bus_timing
:
out
bit_time_config_type
;
constant
ID
:
in
natural
range
0
to
15
;
signal
mem_bus
:
inout
Avalon_mem_type
);
----------------------------------------------------------------------------
-- Print Bus timing configuration of CTU CAN FD Core.
...
...
@@ -2385,6 +2401,38 @@ package body CANtestLib is
end
procedure
;
procedure
CAN_read_timing_v
(
variable
bus_timing
:
out
bit_time_config_type
;
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
-- Bit timing register - Nominal
CAN_read
(
data
,
BTR_ADR
,
ID
,
mem_bus
);
bus_timing
.
tq_nbt
:
=
to_integer
(
unsigned
(
data
(
BRP_H
downto
BRP_L
)));
bus_timing
.
prop_nbt
:
=
to_integer
(
unsigned
(
data
(
PROP_H
downto
PROP_L
)));
bus_timing
.
ph1_nbt
:
=
to_integer
(
unsigned
(
data
(
PH1_H
downto
PH1_L
)));
bus_timing
.
ph2_nbt
:
=
to_integer
(
unsigned
(
data
(
PH2_H
downto
PH2_L
)));
bus_timing
.
sjw_nbt
:
=
to_integer
(
unsigned
(
data
(
SJW_H
downto
SJW_L
)));
-- Bit timing register - Data
CAN_read
(
data
,
BTR_FD_ADR
,
ID
,
mem_bus
);
bus_timing
.
tq_dbt
:
=
to_integer
(
unsigned
(
data
(
BRP_FD_H
downto
BRP_FD_L
)));
bus_timing
.
prop_dbt
:
=
to_integer
(
unsigned
(
data
(
PROP_FD_H
downto
PROP_FD_L
)));
bus_timing
.
ph1_dbt
:
=
to_integer
(
unsigned
(
data
(
PH1_FD_H
downto
PH1_FD_L
)));
bus_timing
.
ph2_dbt
:
=
to_integer
(
unsigned
(
data
(
PH2_FD_H
downto
PH2_FD_L
)));
bus_timing
.
sjw_dbt
:
=
to_integer
(
unsigned
(
data
(
SJW_FD_H
downto
SJW_FD_L
)));
end
procedure
;
procedure
CAN_print_timing
(
constant
bus_timing
:
in
bit_time_config_type
)
is
...
...
@@ -3046,11 +3094,11 @@ package body CANtestLib is
constant
ID
:
in
natural
range
0
to
15
;
signal
mem_bus
:
inout
Avalon_mem_type
)
is
signal
bus_timing
:
bit_time_config_type
;
variable
bus_timing
:
bit_time_config_type
;
variable
wait_time
:
integer
:
=
0
;
begin
-- Read config of the node
CAN_read_timing
(
bus_timing
,
ID
,
mem_bus
);
CAN_read_timing
_v
(
bus_timing
,
ID
,
mem_bus
);
-- Calculate number of clock cycles to wait
if
(
nominal
)
then
...
...
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