1 |
4 |
eyalhoc |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Author: Eyal Hochberg ////
|
4 |
|
|
//// eyal@provartec.com ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// Downloaded from: http://www.opencores.org ////
|
7 |
|
|
/////////////////////////////////////////////////////////////////////
|
8 |
|
|
//// ////
|
9 |
|
|
//// Copyright (C) 2010 Provartec LTD ////
|
10 |
|
|
//// www.provartec.com ////
|
11 |
|
|
//// info@provartec.com ////
|
12 |
|
|
//// ////
|
13 |
|
|
//// This source file may be used and distributed without ////
|
14 |
|
|
//// restriction provided that this copyright statement is not ////
|
15 |
|
|
//// removed from the file and that any derivative work contains ////
|
16 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
17 |
|
|
//// ////
|
18 |
|
|
//// This source file is free software; you can redistribute it ////
|
19 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
20 |
|
|
//// Public License as published by the Free Software Foundation.////
|
21 |
|
|
//// ////
|
22 |
|
|
//// This source is distributed in the hope that it will be ////
|
23 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
24 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
25 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more////
|
26 |
|
|
//// details. http://www.gnu.org/licenses/lgpl.html ////
|
27 |
|
|
//// ////
|
28 |
|
|
/////////////////////////////////////////////////////////////////////
|
29 |
2 |
eyalhoc |
//---------------------------------------------------------
|
30 |
|
|
//-- File generated by RobustVerilog parser
|
31 |
|
|
//-- Version: 1.0
|
32 |
|
|
//-- Invoked Fri Mar 25 23:36:53 2011
|
33 |
|
|
//--
|
34 |
|
|
//-- Source file: dma_reg.v
|
35 |
|
|
//---------------------------------------------------------
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
module dma_axi64_reg(clk,reset,pclken,psel,penable,paddr,pwrite,pwdata,prdata,pslverr,core0_idle,ch_int_all_proc0,int_all_proc,core0_clkdiv,core0_ch_start,joint_mode0,rd_prio_top0,rd_prio_high0,rd_prio_top_num0,rd_prio_high_num0,wr_prio_top0,wr_prio_high0,wr_prio_top_num0,wr_prio_high_num0,periph_rx_req_reg,periph_tx_req_reg,periph_rx_clr,periph_tx_clr);
|
40 |
|
|
|
41 |
|
|
input clk;
|
42 |
|
|
input reset;
|
43 |
|
|
|
44 |
|
|
input pclken;
|
45 |
|
|
input psel;
|
46 |
|
|
input penable;
|
47 |
|
|
input [7:0] paddr;
|
48 |
|
|
input pwrite;
|
49 |
|
|
input [31:0] pwdata;
|
50 |
|
|
output [31:0] prdata;
|
51 |
|
|
output pslverr;
|
52 |
|
|
|
53 |
|
|
input core0_idle;
|
54 |
|
|
input [8*1-1:0] ch_int_all_proc0;
|
55 |
|
|
output [1-1:0] int_all_proc;
|
56 |
|
|
output [3:0] core0_clkdiv;
|
57 |
|
|
output [7:0] core0_ch_start;
|
58 |
|
|
output joint_mode0;
|
59 |
|
|
output rd_prio_top0;
|
60 |
|
|
output rd_prio_high0;
|
61 |
|
|
output [2:0] rd_prio_top_num0;
|
62 |
|
|
output [2:0] rd_prio_high_num0;
|
63 |
|
|
output wr_prio_top0;
|
64 |
|
|
output wr_prio_high0;
|
65 |
|
|
output [2:0] wr_prio_top_num0;
|
66 |
|
|
output [2:0] wr_prio_high_num0;
|
67 |
|
|
output [31:1] periph_rx_req_reg;
|
68 |
|
|
output [31:1] periph_tx_req_reg;
|
69 |
|
|
input [31:1] periph_rx_clr;
|
70 |
|
|
input [31:1] periph_tx_clr;
|
71 |
|
|
|
72 |
|
|
`include "dma_axi64_reg_params.v"
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
wire [31:0] user_def_stat;
|
76 |
|
|
wire [31:0] user_def0_stat0;
|
77 |
|
|
wire [31:0] user_def0_stat1;
|
78 |
|
|
|
79 |
|
|
wire user_def_proj;
|
80 |
|
|
wire [3:0] user_def_proc_num;
|
81 |
|
|
wire user_def_dual_core;
|
82 |
|
|
wire user_def_ic;
|
83 |
|
|
wire user_def_ic_dual_port;
|
84 |
|
|
wire user_def_clkgate;
|
85 |
|
|
wire user_def_port0_mux;
|
86 |
|
|
wire user_def_port1_mux;
|
87 |
|
|
|
88 |
|
|
wire wr_joint0;
|
89 |
|
|
wire wr_clkdiv0;
|
90 |
|
|
wire wr_start0;
|
91 |
|
|
wire wr_prio0;
|
92 |
|
|
|
93 |
|
|
wire [7:0] proc0_int_stat0;
|
94 |
|
|
wire [15:0] proc0_int_stat;
|
95 |
|
|
wire proc0_int;
|
96 |
|
|
wire [1-1:0] int_all_proc_pre;
|
97 |
|
|
reg [1-1:0] int_all_proc;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
wire wr_periph_rx;
|
101 |
|
|
wire wr_periph_tx;
|
102 |
|
|
reg [31:1] periph_rx_req_reg;
|
103 |
|
|
reg [31:1] periph_tx_req_reg;
|
104 |
|
|
|
105 |
|
|
wire [7:0] gpaddr;
|
106 |
|
|
wire gpwrite;
|
107 |
|
|
wire gpread;
|
108 |
|
|
|
109 |
|
|
reg [31:0] prdata_pre;
|
110 |
|
|
reg pslverr_pre;
|
111 |
|
|
reg [31:0] prdata;
|
112 |
|
|
reg pslverr;
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
assign wr_joint0 = gpwrite & gpaddr == CORE0_JOINT;
|
116 |
|
|
assign wr_clkdiv0 = gpwrite & gpaddr == CORE0_CLKDIV;
|
117 |
|
|
assign wr_start0 = gpwrite & gpaddr == CORE0_START;
|
118 |
|
|
assign wr_prio0 = gpwrite & gpaddr == CORE0_PRIO;
|
119 |
|
|
|
120 |
|
|
dma_axi64_reg_core0 dma_axi64_reg_core0(
|
121 |
|
|
.clk(clk),
|
122 |
|
|
.reset(reset),
|
123 |
|
|
.wr_joint(wr_joint0),
|
124 |
|
|
.wr_clkdiv(wr_clkdiv0),
|
125 |
|
|
.wr_start(wr_start0),
|
126 |
|
|
.wr_prio(wr_prio0),
|
127 |
|
|
.pwdata(pwdata),
|
128 |
|
|
.clkdiv(core0_clkdiv),
|
129 |
|
|
.ch_start(core0_ch_start),
|
130 |
|
|
.joint_mode(joint_mode0),
|
131 |
|
|
.rd_prio_top(rd_prio_top0),
|
132 |
|
|
.rd_prio_high(rd_prio_high0),
|
133 |
|
|
.rd_prio_top_num(rd_prio_top_num0),
|
134 |
|
|
.rd_prio_high_num(rd_prio_high_num0),
|
135 |
|
|
.wr_prio_top(wr_prio_top0),
|
136 |
|
|
.wr_prio_high(wr_prio_high0),
|
137 |
|
|
.wr_prio_top_num(wr_prio_top_num0),
|
138 |
|
|
.wr_prio_high_num(wr_prio_high_num0),
|
139 |
|
|
.user_def_stat0(user_def0_stat0),
|
140 |
|
|
.user_def_stat1(user_def0_stat1),
|
141 |
|
|
.ch_int_all_proc(ch_int_all_proc0),
|
142 |
|
|
.proc0_int_stat(proc0_int_stat0)
|
143 |
|
|
);
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
assign user_def_proj = 0;
|
147 |
|
|
assign user_def_proc_num = 1;
|
148 |
|
|
assign user_def_dual_core = 0;
|
149 |
|
|
assign user_def_ic = 0;
|
150 |
|
|
assign user_def_ic_dual_port = 0;
|
151 |
|
|
assign user_def_clkgate = 0;
|
152 |
|
|
assign user_def_port0_mux = 0;
|
153 |
|
|
assign user_def_port1_mux = 0;
|
154 |
|
|
|
155 |
|
|
assign user_def_stat =
|
156 |
|
|
{user_def_proj, //[31]
|
157 |
|
|
{20{1'b0}}, //[30:11]
|
158 |
|
|
user_def_port1_mux, //[10]
|
159 |
|
|
user_def_port0_mux, //[9]
|
160 |
|
|
user_def_clkgate, //[8]
|
161 |
|
|
user_def_ic_dual_port, //[7]
|
162 |
|
|
user_def_ic, //[6]
|
163 |
|
|
user_def_dual_core, //[5]
|
164 |
|
|
1'b0, //[4]
|
165 |
|
|
user_def_proc_num //[3:0]
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
assign gpaddr = {8{psel}} & paddr;
|
173 |
|
|
assign gpwrite = psel & (~penable) & pwrite;
|
174 |
|
|
assign gpread = psel & (~penable) & (~pwrite);
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
assign wr_periph_rx = gpwrite & gpaddr == PERIPH_RX_CTRL;
|
179 |
|
|
assign wr_periph_tx = gpwrite & gpaddr == PERIPH_TX_CTRL;
|
180 |
|
|
|
181 |
|
|
always @(posedge clk or posedge reset)
|
182 |
|
|
if (reset)
|
183 |
|
|
periph_rx_req_reg <= #1 {31{1'b0}};
|
184 |
|
|
else if (wr_periph_rx | (|periph_rx_clr))
|
185 |
|
|
periph_rx_req_reg <= #1 ({31{wr_periph_rx}} & pwdata[31:1]) & (~periph_rx_clr);
|
186 |
|
|
|
187 |
|
|
always @(posedge clk or posedge reset)
|
188 |
|
|
if (reset)
|
189 |
|
|
periph_tx_req_reg <= #1 {31{1'b0}};
|
190 |
|
|
else if (wr_periph_tx | (|periph_tx_clr))
|
191 |
|
|
periph_tx_req_reg <= #1 ({31{wr_periph_tx}} & pwdata[31:1]) & (~periph_tx_clr);
|
192 |
|
|
|
193 |
|
|
assign proc0_int_stat = {proc0_int_stat0};
|
194 |
|
|
|
195 |
|
|
assign proc0_int = |proc0_int_stat;
|
196 |
|
|
|
197 |
|
|
assign int_all_proc_pre = {proc0_int};
|
198 |
|
|
|
199 |
|
|
always @(posedge clk or posedge reset)
|
200 |
|
|
if (reset)
|
201 |
|
|
int_all_proc <= #1 {1{1'b0}};
|
202 |
|
|
else
|
203 |
|
|
int_all_proc <= #1 int_all_proc_pre;
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
always @(*)
|
207 |
|
|
begin
|
208 |
|
|
prdata_pre = {32{1'b0}};
|
209 |
|
|
|
210 |
|
|
case (gpaddr)
|
211 |
|
|
PROC0_STATUS : prdata_pre = {{16{1'b0}}, proc0_int_stat0};
|
212 |
|
|
|
213 |
|
|
CORE0_JOINT : prdata_pre = {{31{1'b0}}, joint_mode0};
|
214 |
|
|
|
215 |
|
|
CORE0_PRIO : prdata_pre = {{16{1'b0}}, wr_prio_high0, wr_prio_high_num0, wr_prio_top0, wr_prio_top_num0, rd_prio_high0, rd_prio_high_num0, rd_prio_top0, rd_prio_top_num0};
|
216 |
|
|
|
217 |
|
|
CORE0_CLKDIV : prdata_pre = {{28{1'b0}}, core0_clkdiv};
|
218 |
|
|
|
219 |
|
|
CORE0_START : prdata_pre = {32{1'b0}};
|
220 |
|
|
|
221 |
|
|
PERIPH_RX_CTRL : prdata_pre = {periph_rx_req_reg, 1'b0};
|
222 |
|
|
PERIPH_TX_CTRL : prdata_pre = {periph_tx_req_reg, 1'b0};
|
223 |
|
|
|
224 |
|
|
IDLE : prdata_pre = {{30{1'b0}}, core0_idle};
|
225 |
|
|
|
226 |
|
|
USER_DEF_STAT : prdata_pre = user_def_stat;
|
227 |
|
|
USER_DEF0_STAT0 : prdata_pre = user_def0_stat0;
|
228 |
|
|
USER_DEF0_STAT1 : prdata_pre = user_def0_stat1;
|
229 |
|
|
|
230 |
|
|
default : prdata_pre = {32{1'b0}};
|
231 |
|
|
endcase
|
232 |
|
|
end
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
always @(/*AUTOSENSE*/gpaddr or gpread or gpwrite or psel)
|
236 |
|
|
begin
|
237 |
|
|
pslverr_pre = 1'b0;
|
238 |
|
|
|
239 |
|
|
case (gpaddr)
|
240 |
|
|
PROC0_STATUS : pslverr_pre = gpwrite; //read only
|
241 |
|
|
|
242 |
|
|
CORE0_JOINT : pslverr_pre = 1'b0; //read and write
|
243 |
|
|
|
244 |
|
|
CORE0_PRIO : pslverr_pre = 1'b0; //read and write
|
245 |
|
|
|
246 |
|
|
CORE0_CLKDIV : pslverr_pre = 1'b0; //read and write
|
247 |
|
|
|
248 |
|
|
CORE0_START : pslverr_pre = gpread; //write only
|
249 |
|
|
|
250 |
|
|
PERIPH_RX_CTRL : pslverr_pre = 1'b0; //read and write
|
251 |
|
|
PERIPH_TX_CTRL : pslverr_pre = 1'b0; //read and write
|
252 |
|
|
|
253 |
|
|
IDLE : pslverr_pre = gpwrite; //read only
|
254 |
|
|
|
255 |
|
|
USER_DEF_STAT : pslverr_pre = gpwrite; //read only
|
256 |
|
|
USER_DEF0_STAT0 : pslverr_pre = gpwrite; //read only
|
257 |
|
|
USER_DEF0_STAT1 : pslverr_pre = gpwrite; //read only
|
258 |
|
|
|
259 |
|
|
default : pslverr_pre = psel; //decode error
|
260 |
|
|
endcase
|
261 |
|
|
end
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
always @(posedge clk or posedge reset)
|
265 |
|
|
if (reset)
|
266 |
|
|
prdata <= #1 {32{1'b0}};
|
267 |
|
|
else if (gpread & pclken)
|
268 |
|
|
prdata <= #1 prdata_pre;
|
269 |
|
|
else if (pclken) //zero to allow or in apb_mux
|
270 |
|
|
prdata <= #1 {32{1'b0}};
|
271 |
|
|
|
272 |
|
|
always @(posedge clk or posedge reset)
|
273 |
|
|
if (reset)
|
274 |
|
|
pslverr <= #1 1'b0;
|
275 |
|
|
else if ((gpread | gpwrite) & pclken)
|
276 |
|
|
pslverr <= #1 pslverr_pre;
|
277 |
|
|
else if (pclken)
|
278 |
|
|
pslverr <= #1 1'b0;
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
endmodule
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|