Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
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
Commits
f948ab8f
Commit
f948ab8f
authored
Jan 21, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
next snapshot
parent
b8040cc2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
273 additions
and
117 deletions
+273
-117
address_map.txt
address_map.txt
+4
-0
ddr_refresh.v
memctrl/ddr_refresh.v
+17
-8
memctrl16.v
memctrl/memctrl16.v
+225
-102
scheduler16.v
memctrl/scheduler16.v
+6
-6
mcontr_sequencer.v
phy/mcontr_sequencer.v
+1
-1
x393.v
x393.v
+20
-0
No files found.
address_map.txt
View file @
f948ab8f
...
@@ -28,6 +28,10 @@
...
@@ -28,6 +28,10 @@
parameter MCONTR_PHY_16BIT_WBUF_DELAY = 'h2, // 4 bits - extra delay (in mclk cycles) to add to write buffer enable (DDR3 read data)
parameter MCONTR_PHY_16BIT_WBUF_DELAY = 'h2, // 4 bits - extra delay (in mclk cycles) to add to write buffer enable (DDR3 read data)
parameter MCONTR_PHY_16BIT_EXTRA_REL = 'h3, // 1 bit - set extra parameters (currently just inv_clk_div)
parameter MCONTR_PHY_16BIT_EXTRA_REL = 'h3, // 1 bit - set extra parameters (currently just inv_clk_div)
parameter MCONTR_PHY_STATUS_CNTRL = 'h4, // 8 bits - write to status control
parameter MCONTR_PHY_STATUS_CNTRL = 'h4, // 8 bits - write to status control
0x1060..106f: arbiter priority data
parameter MCONTR_ARBIT_ADDR = 'h060, // Address to set channel priorities
parameter MCONTR_ARBIT_ADDR_MASK = 'h3f0, // Address mask to set channel priorities
// Status read address
// Status read address
parameter STATUS_ADDR = 'h1400, // AXI write address of status read registers
parameter STATUS_ADDR = 'h1400, // AXI write address of status read registers
parameter STATUS_ADDR_MASK = 'h1400, // AXI write address of status registers
parameter STATUS_ADDR_MASK = 'h1400, // AXI write address of status registers
...
...
memctrl/ddr_refresh.v
View file @
f948ab8f
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
module
ddr_refresh
(
module
ddr_refresh
(
input
rst
,
input
rst
,
input
clk
,
input
clk
,
input
[
7
:
0
]
refresh_period
,
// in 16*clk
input
[
7
:
0
]
refresh_period
,
// in 16*clk
, 0 - disable refresh, turn off requests
input
set
,
// and reset counters
input
set
,
// and reset counters
output
want
,
// turns off next cycle after grant (or stays on if more are needed)
output
reg
want
,
// turns off next cycle after grant (or stays on if more are needed)
output
need
,
output
reg
need
,
input
grant
// 1 cycle
input
grant
// 1 cycle
)
;
)
;
reg
[
3
:
0
]
pre_div
;
reg
[
3
:
0
]
pre_div
;
...
@@ -35,12 +35,15 @@ module ddr_refresh(
...
@@ -35,12 +35,15 @@ module ddr_refresh(
reg
cry
;
reg
cry
;
wire
over
=
(
period_cntr
==
0
)
&&
cry
;
wire
over
=
(
period_cntr
==
0
)
&&
cry
;
reg
refresh_due
;
reg
refresh_due
;
assign
want
=
pending_rq
!=
0
;
reg
en_refresh
;
assign
need
=
pending_rq
[
4
:
3
]
!=
0
;
always
@
(
posedge
rst
or
posedge
clk
)
begin
always
@
(
posedge
rst
or
posedge
clk
)
begin
if
(
rst
)
pre_div
<=
0
;
if
(
rst
)
en_refresh
<=
0
;
else
if
(
set
)
pre_div
<=
0
;
else
if
(
set
)
en_refresh
<=
(
refresh_period
!=
0
)
;
else
pre_div
<=
pre_div
+
1
;
if
(
rst
)
pre_div
<=
0
;
else
if
(
set
||
!
en_refresh
)
pre_div
<=
0
;
else
pre_div
<=
pre_div
+
1
;
if
(
rst
)
cry
<=
0
;
if
(
rst
)
cry
<=
0
;
else
if
(
set
)
cry
<=
0
;
else
if
(
set
)
cry
<=
0
;
...
@@ -58,6 +61,12 @@ module ddr_refresh(
...
@@ -58,6 +61,12 @@ module ddr_refresh(
else
if
(
set
)
pending_rq
<=
0
;
else
if
(
set
)
pending_rq
<=
0
;
else
if
(
refresh_due
&&
!
grant
)
pending_rq
<=
pending_rq
+
1
;
else
if
(
refresh_due
&&
!
grant
)
pending_rq
<=
pending_rq
+
1
;
else
if
(
!
refresh_due
&&
grant
)
pending_rq
<=
pending_rq
-
1
;
else
if
(
!
refresh_due
&&
grant
)
pending_rq
<=
pending_rq
-
1
;
if
(
rst
)
want
<=
0
;
else
want
<=
en_refresh
&&
(
pending_rq
!=
0
)
;
if
(
rst
)
need
<=
0
;
else
need
<=
en_refresh
&&
(
pending_rq
[
4
:
3
]
!=
0
)
;
end
end
endmodule
endmodule
memctrl/memctrl16.v
View file @
f948ab8f
This diff is collapsed.
Click to expand it.
memctrl/scheduler16.v
View file @
f948ab8f
...
@@ -27,10 +27,10 @@ module scheduler16 #(
...
@@ -27,10 +27,10 @@ module scheduler16 #(
input
clk
,
input
clk
,
input
[
15
:
0
]
want_rq
,
// both want_rq and need_rq should go inactive after being granted
input
[
15
:
0
]
want_rq
,
// both want_rq and need_rq should go inactive after being granted
input
[
15
:
0
]
need_rq
,
input
[
15
:
0
]
need_rq
,
input
en_sch
,
// needs to be disabled before next access can be scheduled
input
en_sch
edul
,
// needs to be disabled before next access can be scheduled
output
need
,
// granted access is "needed" one, not just "wanted"
output
need
,
// granted access is "needed" one, not just "wanted"
output
grant
,
// single-cycle granted channel access
output
grant
,
// single-cycle granted channel access
output
[
3
:
0
]
grant_chn
,
// granted channel number, valid with grant, stays valid until en_sch is deasserted
output
[
3
:
0
]
grant_chn
,
// granted channel number, valid with grant, stays valid until en_sch
edul
is deasserted
// todo: add programming sequencer address for software sequencer program? Or should it come from the channel?
// todo: add programming sequencer address for software sequencer program? Or should it come from the channel?
input
[
3
:
0
]
pgm_addr
,
// channel address to program priority
input
[
3
:
0
]
pgm_addr
,
// channel address to program priority
input
[
width
-
1
:
0
]
pgm_data
,
// priority data for the channel
input
[
width
-
1
:
0
]
pgm_data
,
// priority data for the channel
...
@@ -52,7 +52,7 @@ module scheduler16 #(
...
@@ -52,7 +52,7 @@ module scheduler16 #(
wire
[
3
:
0
]
index
;
// channel index to select
wire
[
3
:
0
]
index
;
// channel index to select
wire
index_valid
;
// selected index valid ("needed" or "wanted")
wire
index_valid
;
// selected index valid ("needed" or "wanted")
reg
grant_r
;
// 1 cycle long
reg
grant_r
;
// 1 cycle long
reg
grant_sent
;
// turns on after grant, until en_sch is de-asserted
reg
grant_sent
;
// turns on after grant, until en_sch
edul
is de-asserted
reg
[
3
:
0
]
grant_chn_r
;
reg
[
3
:
0
]
grant_chn_r
;
wire
grant_w
;
wire
grant_w
;
// assign event_w=new_want | new_need;
// assign event_w=new_want | new_need;
...
@@ -60,7 +60,7 @@ module scheduler16 #(
...
@@ -60,7 +60,7 @@ module scheduler16 #(
assign
next_need_conf
=
(
need_conf
&
need_rq
)
|
need_set
;
assign
next_need_conf
=
(
need_conf
&
need_rq
)
|
need_set
;
assign
grant
=
grant_r
;
assign
grant
=
grant_r
;
assign
grant_chn
=
grant_chn_r
;
assign
grant_chn
=
grant_chn_r
;
assign
grant_w
=
en_sch
&&
index_valid
&&
!
grant_sent
;
assign
grant_w
=
en_sch
edul
&&
index_valid
&&
!
grant_sent
;
generate
generate
genvar
i
;
genvar
i
;
for
(
i
=
0
;
i
<
16
;
i
=
i
+
1
)
begin
:
pri_reg_block
for
(
i
=
0
;
i
<
16
;
i
=
i
+
1
)
begin
:
pri_reg_block
...
@@ -129,8 +129,8 @@ module scheduler16 #(
...
@@ -129,8 +129,8 @@ module scheduler16 #(
grant_sent
<=
0
;
grant_sent
<=
0
;
grant_chn_r
<=
0
;
grant_chn_r
<=
0
;
end
else
begin
end
else
begin
grant_r
<=
grant_w
;
// en_sch && index_valid && !grant_sent;
grant_r
<=
grant_w
;
// en_sch
edul
&& index_valid && !grant_sent;
grant_sent
<=
(
grant_sent
&&
en_sch
)
||
grant_r
;
grant_sent
<=
(
grant_sent
&&
en_sch
edul
)
||
grant_r
;
if
(
grant_w
)
grant_chn_r
<=
index
[
3
:
0
]
;
if
(
grant_w
)
grant_chn_r
<=
index
[
3
:
0
]
;
end
end
end
end
...
...
phy/mcontr_sequencer.v
View file @
f948ab8f
...
@@ -324,7 +324,7 @@ module mcontr_sequencer #(
...
@@ -324,7 +324,7 @@ module mcontr_sequencer #(
.
NUM_CYCLES
(
4
)
,
.
NUM_CYCLES
(
4
)
,
.
ADDR_WIDTH
(
3
)
,
.
ADDR_WIDTH
(
3
)
,
.
DATA_WIDTH
(
16
)
.
DATA_WIDTH
(
16
)
)
cmd_deser_
0
bit_i
(
)
cmd_deser_
16
bit_i
(
.
rst
(
rst
)
,
// input
.
rst
(
rst
)
,
// input
.
clk
(
mclk
)
,
// input
.
clk
(
mclk
)
,
// input
.
ad
(
cmd_ad
)
,
// input[7:0]
.
ad
(
cmd_ad
)
,
// input[7:0]
...
...
x393.v
View file @
f948ab8f
...
@@ -315,6 +315,26 @@ module x393 #(
...
@@ -315,6 +315,26 @@ module x393 #(
wire
[
10
:
0
]
refresh_address
;
wire
[
10
:
0
]
refresh_address
;
wire
refresh_en
;
wire
refresh_en
;
wire
refresh_set
;
wire
refresh_set
;
reg
[
AXI_WR_ADDR_BITS
-
1
:
0
]
axiwr_bram_waddr_d
;
reg
[
31
:
0
]
axiwr_bram_wdata_d
;
reg
mcontr_cmdseq_we
;
// .cmd0_clk (axi_aclk), // input
// .cmd0_we (en_cmd0_wr), // input
// .cmd0_addr (axiwr_bram_waddr[9:0]), // input[9:0]
// .cmd0_data (axiwr_bram_wdata[31:0]), // input[31:0]
// register address/data to write copmmand sequencer port 0 (PS)
always
@
(
posedge
axi_rst
or
posedge
axi_aclk
)
begin
if
(
axi_rst
)
mcontr_cmdseq_we
<=
1'b0
;
else
mcontr_cmdseq_we
<=
axiwr_bram_wen
&&
(((
axiwr_bram_waddr
^
CMD0_ADDR
)
&
CMD0_ADDR_MASK
)
==
0
)
;
end
always
@
(
posedge
axi_aclk
)
if
(
axiwr_bram_wen
)
begin
axiwr_bram_waddr_d
<=
axiwr_bram_waddr
;
axiwr_bram_wdata_d
<=
axiwr_bram_wdata
;
end
assign
port0_rd_match
=
(((
axird_bram_raddr
^
PORT0_RD_ADDR
)
&
PORT0_RD_ADDR_MASK
)
==
0
)
;
assign
port0_rd_match
=
(((
axird_bram_raddr
^
PORT0_RD_ADDR
)
&
PORT0_RD_ADDR_MASK
)
==
0
)
;
assign
en_cmd0_wr
=
axiwr_bram_wen
&&
(((
axiwr_bram_waddr
^
CMD0_ADDR
)
&
CMD0_ADDR_MASK
)
==
0
)
;
assign
en_cmd0_wr
=
axiwr_bram_wen
&&
(((
axiwr_bram_waddr
^
CMD0_ADDR
)
&
CMD0_ADDR_MASK
)
==
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