Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gennum GN4124 core
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Gennum GN4124 core
Commits
e6162cf4
Commit
e6162cf4
authored
4 years ago
by
Tristan Gingold
Browse files
Options
Downloads
Patches
Plain Diff
l2p_dma_master: simplify the FSM
parent
2aea69b9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hdl/rtl/l2p_dma_master.vhd
+15
-16
15 additions, 16 deletions
hdl/rtl/l2p_dma_master.vhd
with
15 additions
and
16 deletions
hdl/rtl/l2p_dma_master.vhd
+
15
−
16
View file @
e6162cf4
...
...
@@ -98,7 +98,7 @@ architecture arch of l2p_dma_master is
type
l2p_dma_state_type
is
(
L2P_IDLE
,
L2P_WB_SETUP
,
L2P_SETUP
,
L2P_WAIT
,
L2P_HEADER
,
L2P_HOLD
,
L2P_ADDR_H
,
L2P_ADDR_L
,
L2P_DATA
,
L2P_NEXT
,
L2P_ERROR
);
L2P_ERROR
);
signal
l2p_dma_current_state
:
l2p_dma_state_type
:
=
L2P_IDLE
;
type
wb_dma_state_type
is
(
WB_IDLE
,
WB_SETUP
,
WB_DATA
,
WB_WAIT_ACK
);
...
...
@@ -222,9 +222,11 @@ begin
-- constant declaration).
if
dma_total_len
>
c_L2P_MAX_PAYLOAD
then
dma_packet_len
<=
to_unsigned
(
c_L2P_MAX_PAYLOAD
,
dma_packet_len
'length
);
dma_total_len
<=
dma_total_len
-
c_L2P_MAX_PAYLOAD
;
dma_last_packet
<=
'0'
;
else
dma_packet_len
<=
dma_total_len
(
5
downto
0
);
dma_total_len
<=
(
others
=>
'0'
);
dma_last_packet
<=
'1'
;
end
if
;
l2p_dma_current_state
<=
L2P_WAIT
;
...
...
@@ -281,20 +283,15 @@ begin
-- Already checked data_fifo_empty flag during L2P_WAIT.
-- Start readout here to get first data out on the next cycle.
data_fifo_rd
<=
'1'
;
-- Update host address (for the next transfer)
dma_host_addr
<=
dma_host_addr
+
4
*
c_L2P_MAX_PAYLOAD
;
l2p_dma_current_state
<=
L2P_DATA
;
when
L2P_HOLD
=>
l2p_fsm_dframe
<=
'1'
;
l2p_fsm_valid
<=
'0'
;
if
data_fifo_empty
=
'0'
and
l2p_rdy_i
=
'1'
then
data_fifo_rd
<=
'1'
;
l2p_dma_current_state
<=
L2P_DATA
;
end
if
;
when
L2P_DATA
=>
l2p_fsm_dframe
<=
'1'
;
-- Data FIFO readout
if
data_fifo_empty
=
'1'
or
l2p_rdy_i
=
'0'
then
-- Not ready - wait
l2p_dma_current_state
<=
L2P_HOLD
;
else
data_fifo_rd
<=
'1'
;
...
...
@@ -306,9 +303,8 @@ begin
l2p_fsm_dframe
<=
'0'
;
data_fifo_rd
<=
'0'
;
if
dma_last_packet
=
'0'
then
l2p_dma_current_state
<=
L2P_
NEXT
;
l2p_dma_current_state
<=
L2P_
SETUP
;
else
dma_total_len
<=
(
others
=>
'0'
);
l2p_dma_current_state
<=
L2P_IDLE
;
dma_ctrl_done_o
<=
'1'
;
end
if
;
...
...
@@ -325,11 +321,13 @@ begin
l2p_dma_current_state
<=
L2P_ERROR
;
end
if
;
when
L2P_NEXT
=>
dma_total_len
<=
dma_total_len
-
c_L2P_MAX_PAYLOAD
;
dma_target_addr
<=
dma_target_addr
+
c_L2P_MAX_PAYLOAD
;
dma_host_addr
<=
dma_host_addr
+
4
*
c_L2P_MAX_PAYLOAD
;
l2p_dma_current_state
<=
L2P_SETUP
;
when
L2P_HOLD
=>
l2p_fsm_dframe
<=
'1'
;
l2p_fsm_valid
<=
'0'
;
if
data_fifo_empty
=
'0'
and
l2p_rdy_i
=
'1'
then
data_fifo_rd
<=
'1'
;
l2p_dma_current_state
<=
L2P_DATA
;
end
if
;
when
L2P_ERROR
=>
wb_dma_fsm_en
<=
'0'
;
...
...
@@ -354,6 +352,7 @@ begin
-- Wishbone Master (in the Wishbone clock domain)
-------------------------------------------------
-- Info crossing clocks domains (GN -> DDR) at the start of a dma transfer.
dma_param_to_sync
(
59
downto
30
)
<=
std_logic_vector
(
dma_target_addr
);
dma_param_to_sync
(
29
downto
0
)
<=
std_logic_vector
(
dma_total_len
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment