Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393_sata
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
x393_sata
Commits
2140df17
Commit
2140df17
authored
Jan 26, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more debugging
parent
1ccc21c0
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
600 additions
and
104 deletions
+600
-104
ahci_ctrl_stat.v
ahci/ahci_ctrl_stat.v
+1
-1
ahci_dma.v
ahci/ahci_dma.v
+1
-1
ahci_fis_receive.v
ahci/ahci_fis_receive.v
+3
-2
ahci_fis_transmit.v
ahci/ahci_fis_transmit.v
+8
-9
ahci_fsm.v
ahci/ahci_fsm.v
+2
-2
ahci_sata_layers.v
ahci/ahci_sata_layers.v
+1
-1
ahci_top.v
ahci/ahci_top.v
+1
-1
sata_ahci_top.v
ahci/sata_ahci_top.v
+4
-4
action_decoder.v
generated/action_decoder.v
+1
-1
condition_mux.v
generated/condition_mux.v
+1
-1
tb_ahci.tf
tb/tb_ahci.tf
+112
-24
tb_ahci_01.sav
tb_ahci_01.sav
+465
-57
No files found.
ahci/ahci_ctrl_stat.v
View file @
2140df17
...
@@ -151,7 +151,7 @@ module ahci_ctrl_stat #(
...
@@ -151,7 +151,7 @@ module ahci_ctrl_stat #(
wire
swr_HBA_PORT__PxSCTL
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxSCTL__SPD__ADDR
)
;
wire
swr_HBA_PORT__PxSCTL
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxSCTL__SPD__ADDR
)
;
// wire swr_HBA_PORT__PxSSTS = soft_write_en && (soft_write_addr == HBA_PORT__PxSSTS__SPD__ADDR);
// wire swr_HBA_PORT__PxSSTS = soft_write_en && (soft_write_addr == HBA_PORT__PxSSTS__SPD__ADDR);
wire
swr_HBA_PORT__PxSERR
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxSERR__DIAG__X__ADDR
)
;
wire
swr_HBA_PORT__PxSERR
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxSERR__DIAG__X__ADDR
)
;
wire
swr_HBA_PORT__PxCI
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxCI__CI__
DFLT
)
;
wire
swr_HBA_PORT__PxCI
=
soft_write_en
&&
(
soft_write_addr
==
HBA_PORT__PxCI__CI__
ADDR
)
;
reg
hba_rst_r
=
1
;
reg
hba_rst_r
=
1
;
reg
rst_por
;
reg
rst_por
;
...
...
ahci/ahci_dma.v
View file @
2140df17
...
@@ -321,7 +321,7 @@ module ahci_dma (
...
@@ -321,7 +321,7 @@ module ahci_dma (
if
(
cmd_start_hclk
)
ct_maddr
[
31
:
4
]
<=
{
ctba_r
[
31
:
7
]
,
3'b0
};
if
(
cmd_start_hclk
)
ct_maddr
[
31
:
4
]
<=
{
ctba_r
[
31
:
7
]
,
3'b0
};
else
if
(
ct_done
)
ct_maddr
[
31
:
4
]
<=
ct_maddr
[
31
:
4
]
+
16
;
else
if
(
ct_done
)
ct_maddr
[
31
:
4
]
<=
ct_maddr
[
31
:
4
]
+
8
;
//
16;
else
if
(
wcount_set
)
ct_maddr
[
31
:
4
]
<=
ct_maddr
[
31
:
4
]
+
1
;
else
if
(
wcount_set
)
ct_maddr
[
31
:
4
]
<=
ct_maddr
[
31
:
4
]
+
1
;
// overall sequencing makes sure that there will be no new requests until older served
// overall sequencing makes sure that there will be no new requests until older served
...
...
ahci/ahci_fis_receive.v
View file @
2140df17
...
@@ -77,7 +77,7 @@ module ahci_fis_receive#(
...
@@ -77,7 +77,7 @@ module ahci_fis_receive#(
// TODO: Add writing PRDBC here?
// TODO: Add writing PRDBC here?
output
reg
pPioXfer
,
// state variable
output
reg
pPioXfer
,
// state variable
output
[
7
:
0
]
tfd_sts
,
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
output
[
7
:
0
]
tfd_sts
,
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
// tfd_sts[7] - BSY, tfd_sts[
4
] - DRQ, tfd_sts[0] - ERR
// tfd_sts[7] - BSY, tfd_sts[
3
] - DRQ, tfd_sts[0] - ERR
output
[
7
:
0
]
tfd_err
,
// Current PxTFD error field (updated after regFIS and SDB)
output
[
7
:
0
]
tfd_err
,
// Current PxTFD error field (updated after regFIS and SDB)
output
reg
fis_i
,
// value of "I" field in received regsD2H or SDB FIS or DMA Setup FIS
output
reg
fis_i
,
// value of "I" field in received regsD2H or SDB FIS or DMA Setup FIS
output
reg
sdb_n
,
// value of "N" field in received SDB FIS
output
reg
sdb_n
,
// value of "N" field in received SDB FIS
...
@@ -307,7 +307,8 @@ localparam DATA_TYPE_ERR = 3;
...
@@ -307,7 +307,8 @@ localparam DATA_TYPE_ERR = 3;
get_fis_done
<=
get_fis_busy_r
&&
(
too_long_err
||
fis_end_w
)
;
get_fis_done
<=
get_fis_busy_r
&&
(
too_long_err
||
fis_end_w
)
;
if
(
hba_rst
||
get_fis
)
fis_first_vld
<=
0
;
// if (hba_rst || get_fis) fis_first_vld <= 0;
if
(
hba_rst
||
fis_end_w
)
fis_first_vld
<=
0
;
// is_FIS_HEAD stays on longer than just get_fis
else
if
(
is_FIS_HEAD
)
fis_first_vld
<=
1
;
else
if
(
is_FIS_HEAD
)
fis_first_vld
<=
1
;
if
(
hba_rst
||
get_fis
)
fis_ok
<=
0
;
if
(
hba_rst
||
get_fis
)
fis_ok
<=
0
;
...
...
ahci/ahci_fis_transmit.v
View file @
2140df17
...
@@ -129,7 +129,8 @@ module ahci_fis_transmit #(
...
@@ -129,7 +129,8 @@ module ahci_fis_transmit #(
reg
[
READ_REG_LATENCY
:
0
]
reg_re_r
;
reg
[
READ_REG_LATENCY
:
0
]
reg_re_r
;
wire
reg_re_w
;
// combined conditions to read register memory
wire
reg_re_w
;
// combined conditions to read register memory
/// wire reg_stb = reg_re_r[READ_REG_LATENCY];
/// wire reg_stb = reg_re_r[READ_REG_LATENCY];
wire
pre_reg_stb
=
reg_re_r
[
READ_REG_LATENCY
-
1
]
;
/// wire reg_stb = reg_re_r[READ_REG_LATENCY-1];
wire
pre_reg_stb
=
reg_re_r
[
READ_REG_LATENCY
-
1
]
&&
!
reg_re_r
[
READ_REG_LATENCY
]
;
// only first, to make running 1
reg
[
3
:
0
]
fetch_chead_r
;
reg
[
3
:
0
]
fetch_chead_r
;
reg
[
3
:
0
]
fetch_chead_stb_r
;
reg
[
3
:
0
]
fetch_chead_stb_r
;
wire
chead_done_w
=
fetch_chead_stb_r
[
2
]
;
// done fetching command header
wire
chead_done_w
=
fetch_chead_stb_r
[
2
]
;
// done fetching command header
...
@@ -177,7 +178,8 @@ module ahci_fis_transmit #(
...
@@ -177,7 +178,8 @@ module ahci_fis_transmit #(
assign
ch_p
=
ch_p_r
;
assign
ch_p
=
ch_p_r
;
assign
ch_w
=
ch_w_r
;
assign
ch_w
=
ch_w_r
;
assign
ch_a
=
ch_a_r
;
assign
ch_a
=
ch_a_r
;
assign
ch_cfl
=
cfis_acmd_left_r
;
// assign ch_cfl = cfis_acmd_left_r;
assign
ch_cfl
=
ch_cmd_len_r
;
assign
reg_re_w
=
fetch_cmd
||
chead_bsy_re
;
assign
reg_re_w
=
fetch_cmd
||
chead_bsy_re
;
assign
dma_ctba_ld
=
fetch_chead_stb_r
[
2
]
;
assign
dma_ctba_ld
=
fetch_chead_stb_r
[
2
]
;
assign
dma_start
=
fetch_chead_stb_r
[
3
]
;
// next cycle after dma_ctba_ld
assign
dma_start
=
fetch_chead_stb_r
[
3
]
;
// next cycle after dma_ctba_ld
...
@@ -210,12 +212,10 @@ module ahci_fis_transmit #(
...
@@ -210,12 +212,10 @@ module ahci_fis_transmit #(
// Read 3 DWORDs from the command header
// Read 3 DWORDs from the command header
if
(
hba_rst
)
fetch_chead_r
<=
0
;
// running 1
if
(
hba_rst
)
fetch_chead_r
<=
0
;
// running 1
else
if
(
fetch_cmd
)
fetch_chead_r
<=
1
;
else
fetch_chead_r
<=
{
fetch_chead_r
[
2
:
0
]
,
fetch_cmd
};
else
fetch_chead_r
<=
fetch_chead_r
<<
1
;
if
(
hba_rst
)
fetch_chead_stb_r
<=
0
;
if
(
hba_rst
)
fetch_chead_stb_r
<=
0
;
else
if
(
pre_reg_stb
&&
chead_bsy
)
fetch_chead_stb_r
<=
1
;
else
fetch_chead_stb_r
<=
{
fetch_chead_stb_r
[
2
:
0
]
,
pre_reg_stb
&&
chead_bsy
};
else
fetch_chead_stb_r
<=
fetch_chead_stb_r
<<
1
;
if
(
hba_rst
)
chead_bsy
<=
0
;
if
(
hba_rst
)
chead_bsy
<=
0
;
else
if
(
fetch_cmd
)
chead_bsy
<=
1
;
else
if
(
fetch_cmd
)
chead_bsy
<=
1
;
...
@@ -226,8 +226,7 @@ module ahci_fis_transmit #(
...
@@ -226,8 +226,7 @@ module ahci_fis_transmit #(
else
if
(
fetch_chead_r
[
1
])
chead_bsy_re
<=
0
;
// read 3 dwords
else
if
(
fetch_chead_r
[
1
])
chead_bsy_re
<=
0
;
// read 3 dwords
if
(
hba_rst
)
reg_re_r
<=
0
;
// [0] -> reg_re output
if
(
hba_rst
)
reg_re_r
<=
0
;
// [0] -> reg_re output
else
if
(
reg_re_w
)
reg_re_r
<=
1
;
else
reg_re_r
<=
{
reg_re
[
1
:
0
]
,
reg_re_w
};
else
reg_re_r
<=
reg_re_r
<<
1
;
if
(
fetch_cmd
)
reg_addr
<=
CLB_OFFS32
;
// there will be more conditions
if
(
fetch_cmd
)
reg_addr
<=
CLB_OFFS32
;
// there will be more conditions
else
if
(
reg_re_r
[
0
])
reg_addr
<=
reg_addr
+
1
;
else
if
(
reg_re_r
[
0
])
reg_addr
<=
reg_addr
+
1
;
...
...
ahci/ahci_fsm.v
View file @
2140df17
...
@@ -194,7 +194,7 @@ module ahci_fsm
...
@@ -194,7 +194,7 @@ module ahci_fsm
input
pxcmd_fre
,
// control bit enables saving FIS to memory
input
pxcmd_fre
,
// control bit enables saving FIS to memory
input
pPioXfer
,
// state variable
input
pPioXfer
,
// state variable
input
[
7
:
0
]
tfd_sts
,
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
input
[
7
:
0
]
tfd_sts
,
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
// tfd_sts[7] - BSY, tfd_sts[
4
] - DRQ, tfd_sts[0] - ERR
// tfd_sts[7] - BSY, tfd_sts[
3
] - DRQ, tfd_sts[0] - ERR
/// input [7:0] tfd_err, // Current PxTFD error field (updated after regFIS and SDB)
/// input [7:0] tfd_err, // Current PxTFD error field (updated after regFIS and SDB)
input
fis_i
,
// value of "I" field in received regsD2H or SDB FIS
input
fis_i
,
// value of "I" field in received regsD2H or SDB FIS
/// input sdb_n, // value of "N" field in received SDB FIS
/// input sdb_n, // value of "N" field in received SDB FIS
...
@@ -241,7 +241,7 @@ module ahci_fsm
...
@@ -241,7 +241,7 @@ module ahci_fsm
`include
"includes/ahci_localparams.vh"
// @SuppressThisWarning VEditor : Unused localparams
`include
"includes/ahci_localparams.vh"
// @SuppressThisWarning VEditor : Unused localparams
`include
"includes/fis_types.vh"
// @SuppressThisWarning VEditor : Some localparams unused
`include
"includes/fis_types.vh"
// @SuppressThisWarning VEditor : Some localparams unused
wire
tfd_bsy
=
tfd_sts
[
7
]
;
wire
tfd_bsy
=
tfd_sts
[
7
]
;
wire
tfd_drq
=
tfd_sts
[
4
]
;
wire
tfd_drq
=
tfd_sts
[
3
]
;
wire
tfd_sts_err
=
tfd_sts
[
0
]
;
wire
tfd_sts_err
=
tfd_sts
[
0
]
;
reg
[
9
:
0
]
pgm_waddr
;
reg
[
9
:
0
]
pgm_waddr
;
...
...
ahci/ahci_sata_layers.v
View file @
2140df17
...
@@ -170,7 +170,7 @@ module ahci_sata_layers #(
...
@@ -170,7 +170,7 @@ module ahci_sata_layers #(
assign
d2h_valid
=
d2h_nempty
;
assign
d2h_valid
=
d2h_nempty
;
assign
d2h_many
=
|
d2h_fill
[
FIFO_ADDR_WIDTH
:
3
]
;
//
assign
d2h_many
=
|
d2h_fill
[
FIFO_ADDR_WIDTH
:
3
]
;
//
assign
h2d_ready
=
h2d_fill
[
FIFO_ADDR_WIDTH
]
&&
!
(
&
h2d_fill
[
FIFO_ADDR_WIDTH
:
3
])
;
assign
h2d_ready
=
!
h2d_fill
[
FIFO_ADDR_WIDTH
]
&&
!
(
&
h2d_fill
[
FIFO_ADDR_WIDTH
:
3
])
;
assign
ll_d2h_almost_full
=
d2h_fill
[
FIFO_ADDR_WIDTH
]
||
&
d2h_fill
[
FIFO_ADDR_WIDTH
-
1
:
6
]
;
// 63 dwords (maybe use :5?) - time to tell device to stop
assign
ll_d2h_almost_full
=
d2h_fill
[
FIFO_ADDR_WIDTH
]
||
&
d2h_fill
[
FIFO_ADDR_WIDTH
-
1
:
6
]
;
// 63 dwords (maybe use :5?) - time to tell device to stop
assign
ll_frame_req_w
=
!
ll_frame_busy
&&
h2d_pending
&&
(((
h2d_type
==
H2D_TYPE_FIS_LAST
)
&&
h2d_fifo_wr
)
||
(
|
h2d_fill
[
FIFO_ADDR_WIDTH
:
BITS_TO_START_XMIT
]))
;
assign
ll_frame_req_w
=
!
ll_frame_busy
&&
h2d_pending
&&
(((
h2d_type
==
H2D_TYPE_FIS_LAST
)
&&
h2d_fifo_wr
)
||
(
|
h2d_fill
[
FIFO_ADDR_WIDTH
:
BITS_TO_START_XMIT
]))
;
...
...
ahci/ahci_top.v
View file @
2140df17
...
@@ -307,7 +307,7 @@ module ahci_top#(
...
@@ -307,7 +307,7 @@ module ahci_top#(
// fsm <- state variables that are maintained inside 'ahc_fis_receive'
// fsm <- state variables that are maintained inside 'ahc_fis_receive'
wire
[
7
:
0
]
tfd_sts
;
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
wire
[
7
:
0
]
tfd_sts
;
// Current PxTFD status field (updated after regFIS and SDB - certain fields)
// tfd_sts[7] - BSY, tfd_sts[
4
] - DRQ, tfd_sts[0] - ERR
// tfd_sts[7] - BSY, tfd_sts[
3
] - DRQ, tfd_sts[0] - ERR
// wire [7:0] tfd_err; // Current PxTFD error field (updated after regFIS and SDB)
// wire [7:0] tfd_err; // Current PxTFD error field (updated after regFIS and SDB)
wire
fis_i
;
// value of "I" field in received regsD2H or SDB FIS
wire
fis_i
;
// value of "I" field in received regsD2H or SDB FIS
/// wire sdb_n; // value of "N" field in received SDB FIS
/// wire sdb_n; // value of "N" field in received SDB FIS
...
...
ahci/sata_ahci_top.v
View file @
2140df17
...
@@ -221,12 +221,12 @@
...
@@ -221,12 +221,12 @@
wire
[
3
:
0
]
sctl_ipm
;
// Interface power management transitions allowed
wire
[
3
:
0
]
sctl_ipm
;
// Interface power management transitions allowed
wire
[
3
:
0
]
sctl_spd
;
// Interface maximal speed
wire
[
3
:
0
]
sctl_spd
;
// Interface maximal speed
reg
[
2
:
0
]
hrst_r
;
reg
[
2
:
0
]
n
hrst_r
;
wire
hrst
=
hrst_r
[
2
]
;
wire
hrst
=
!
n
hrst_r
[
2
]
;
always
@
(
posedge
hclk
or
posedge
arst
)
begin
always
@
(
posedge
hclk
or
posedge
arst
)
begin
if
(
arst
)
hrst_r
<=
0
;
if
(
arst
)
n
hrst_r
<=
0
;
else
hrst_r
<=
(
hrst_r
<<
1
)
|
1
;
else
nhrst_r
<=
(
n
hrst_r
<<
1
)
|
1
;
end
end
...
...
generated/action_decoder.v
View file @
2140df17
/*******************************************************************************
/*******************************************************************************
* Module: action_decoder
* Module: action_decoder
* Date:2016-01-2
4
* Date:2016-01-2
5
* Author: auto-generated file, see ahci_fsm_sequence.py
* Author: auto-generated file, see ahci_fsm_sequence.py
* Description: Decode sequencer code to 1-hot actions
* Description: Decode sequencer code to 1-hot actions
*******************************************************************************/
*******************************************************************************/
...
...
generated/condition_mux.v
View file @
2140df17
/*******************************************************************************
/*******************************************************************************
* Module: condition_mux
* Module: condition_mux
* Date:2016-01-2
4
* Date:2016-01-2
5
* Author: auto-generated file, see ahci_fsm_sequence.py
* Author: auto-generated file, see ahci_fsm_sequence.py
* Description: Select condition
* Description: Select condition
*******************************************************************************/
*******************************************************************************/
...
...
tb/tb_ahci.tf
View file @
2140df17
This diff is collapsed.
Click to expand it.
tb_ahci_01.sav
View file @
2140df17
This diff is collapsed.
Click to expand it.
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