1 |
2 |
eyalhoc |
//---------------------------------------------------------
|
2 |
|
|
//-- File generated by RobustVerilog parser
|
3 |
|
|
//-- Version: 1.0
|
4 |
|
|
//-- Invoked Fri Mar 25 23:31:24 2011
|
5 |
|
|
//--
|
6 |
|
|
//-- Source file: dma_ch_reg.v
|
7 |
|
|
//---------------------------------------------------------
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
module dma_ahb32_core0_ch_reg(clk,clken,pclken,reset,psel,penable,paddr,pwrite,pwdata,prdata,pslverr,timeout_bus,wdt_timeout,ch_start,load_addr,load_in_prog,load_req_in_prog,load_wr,load_wr_cycle,load_wdata,load_cmd,rd_ch_end,wr_ch_end,wr_clr_last,rd_slverr,rd_decerr,wr_slverr,wr_decerr,int_all_proc,ch_rd_active,ch_wr_active,ch_in_prog,rd_x_offset,rd_y_offset,wr_x_offset,wr_y_offset,wr_fullness,rd_gap,fifo_overflow,fifo_underflow,ch_update,rd_start_addr,wr_start_addr,x_size,y_size,rd_burst_max_size,wr_burst_max_size,block,allow_line_cmd,frame_width,width_align,rd_periph_delay,rd_periph_block,wr_periph_delay,wr_periph_block,rd_tokens,wr_tokens,rd_port_num,wr_port_num,rd_outs_max,wr_outs_max,rd_outs,wr_outs,outs_empty,rd_wait_limit,wr_wait_limit,rd_incr,wr_incr,rd_periph_num,wr_periph_num,wr_outstanding,rd_outstanding,ch_retry_wait,joint_mode,joint_remote,joint_cross,page_cross,joint,joint_flush,end_swap);
|
13 |
|
|
|
14 |
|
|
parameter DATA_SHIFT = 1 ? 32 : 0;
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
input clk;
|
18 |
|
|
input clken;
|
19 |
|
|
input pclken;
|
20 |
|
|
input reset;
|
21 |
|
|
|
22 |
|
|
input psel;
|
23 |
|
|
input penable;
|
24 |
|
|
input [7:0] paddr;
|
25 |
|
|
input pwrite;
|
26 |
|
|
input [31:0] pwdata;
|
27 |
|
|
output [31:0] prdata;
|
28 |
|
|
output pslverr;
|
29 |
|
|
|
30 |
|
|
input [4:0] timeout_bus;
|
31 |
|
|
input wdt_timeout;
|
32 |
|
|
|
33 |
|
|
input ch_start;
|
34 |
|
|
|
35 |
|
|
output [32-1:0] load_addr;
|
36 |
|
|
output load_in_prog;
|
37 |
|
|
output load_req_in_prog;
|
38 |
|
|
input load_wr;
|
39 |
|
|
input [1:0] load_wr_cycle;
|
40 |
|
|
input [32-1:0] load_wdata;
|
41 |
|
|
input load_cmd;
|
42 |
|
|
|
43 |
|
|
input rd_ch_end;
|
44 |
|
|
input wr_ch_end;
|
45 |
|
|
input wr_clr_last;
|
46 |
|
|
input rd_slverr;
|
47 |
|
|
input rd_decerr;
|
48 |
|
|
input wr_slverr;
|
49 |
|
|
input wr_decerr;
|
50 |
|
|
output [1-1:0] int_all_proc;
|
51 |
|
|
|
52 |
|
|
output ch_rd_active;
|
53 |
|
|
output ch_wr_active;
|
54 |
|
|
output ch_in_prog;
|
55 |
|
|
|
56 |
|
|
input [10-1:0] rd_x_offset;
|
57 |
|
|
input [10-`X_BITS-1:0] rd_y_offset;
|
58 |
|
|
input [10-1:0] wr_x_offset;
|
59 |
|
|
input [10-`X_BITS-1:0] wr_y_offset;
|
60 |
|
|
input [5:0] wr_fullness;
|
61 |
|
|
input [5:0] rd_gap;
|
62 |
|
|
input fifo_overflow;
|
63 |
|
|
input fifo_underflow;
|
64 |
|
|
|
65 |
|
|
output ch_update;
|
66 |
|
|
output [32-1:0] rd_start_addr;
|
67 |
|
|
output [32-1:0] wr_start_addr;
|
68 |
|
|
output [10-1:0] x_size;
|
69 |
|
|
output [10-`X_BITS-1:0] y_size;
|
70 |
|
|
|
71 |
|
|
output [7-1:0] rd_burst_max_size;
|
72 |
|
|
output [7-1:0] wr_burst_max_size;
|
73 |
|
|
output block;
|
74 |
|
|
input allow_line_cmd;
|
75 |
|
|
output [`FRAME_BITS-1:0] frame_width;
|
76 |
|
|
output [2-1:0] width_align;
|
77 |
|
|
output [`DELAY_BITS-1:0] rd_periph_delay;
|
78 |
|
|
output rd_periph_block;
|
79 |
|
|
output [`DELAY_BITS-1:0] wr_periph_delay;
|
80 |
|
|
output wr_periph_block;
|
81 |
|
|
output [`TOKEN_BITS-1:0] rd_tokens;
|
82 |
|
|
output [`TOKEN_BITS-1:0] wr_tokens;
|
83 |
|
|
output rd_port_num;
|
84 |
|
|
output wr_port_num;
|
85 |
|
|
output [`OUT_BITS-1:0] rd_outs_max;
|
86 |
|
|
output [`OUT_BITS-1:0] wr_outs_max;
|
87 |
|
|
input [`OUT_BITS-1:0] rd_outs;
|
88 |
|
|
input [`OUT_BITS-1:0] wr_outs;
|
89 |
|
|
input outs_empty;
|
90 |
|
|
output [`WAIT_BITS-1:0] rd_wait_limit;
|
91 |
|
|
output [`WAIT_BITS-1:0] wr_wait_limit;
|
92 |
|
|
output rd_incr;
|
93 |
|
|
output wr_incr;
|
94 |
|
|
output [4:0] rd_periph_num;
|
95 |
|
|
output [4:0] wr_periph_num;
|
96 |
|
|
output wr_outstanding;
|
97 |
|
|
output rd_outstanding;
|
98 |
|
|
output ch_retry_wait;
|
99 |
|
|
input joint_mode;
|
100 |
|
|
input joint_remote;
|
101 |
|
|
input joint_cross;
|
102 |
|
|
input page_cross;
|
103 |
|
|
output joint;
|
104 |
|
|
input joint_flush;
|
105 |
|
|
output [1:0] end_swap;
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
`include "dma_ahb32_ch_reg_params.v"
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
parameter INT_NUM = 8;
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
wire [7:0] gpaddr;
|
115 |
|
|
wire gpwrite;
|
116 |
|
|
wire gpread;
|
117 |
|
|
reg [31:0] prdata_pre;
|
118 |
|
|
reg pslverr_pre;
|
119 |
|
|
reg [31:0] prdata;
|
120 |
|
|
reg pslverr;
|
121 |
|
|
|
122 |
|
|
reg ch_enable;
|
123 |
|
|
reg ch_in_prog;
|
124 |
|
|
reg rd_ch_in_prog;
|
125 |
|
|
reg wr_ch_in_prog;
|
126 |
|
|
reg load_in_prog_reg;
|
127 |
|
|
reg load_req_in_prog_reg;
|
128 |
|
|
|
129 |
|
|
//current cmd
|
130 |
|
|
reg [32-1:0] rd_start_addr;
|
131 |
|
|
reg [32-1:0] wr_start_addr;
|
132 |
|
|
reg [10-1:0] buff_size;
|
133 |
|
|
wire [10-1:0] x_size;
|
134 |
|
|
wire [10-`X_BITS-1:0] y_size;
|
135 |
|
|
|
136 |
|
|
reg [`FRAME_BITS-1:0] frame_width_reg;
|
137 |
|
|
reg block_reg;
|
138 |
|
|
reg joint_reg;
|
139 |
|
|
reg simple_mem;
|
140 |
|
|
wire joint;
|
141 |
|
|
wire joint_mux;
|
142 |
|
|
reg auto_retry_reg;
|
143 |
|
|
wire auto_retry;
|
144 |
|
|
reg [1:0] end_swap_reg;
|
145 |
|
|
|
146 |
|
|
//static
|
147 |
|
|
wire [7-1:0] rd_burst_max_size_rd;
|
148 |
|
|
wire [7-1:0] rd_burst_max_size_pre;
|
149 |
|
|
reg [7-1:0] rd_burst_max_size_reg;
|
150 |
|
|
reg [`DELAY_BITS-1:0] rd_periph_delay_reg;
|
151 |
|
|
reg rd_periph_block_reg;
|
152 |
|
|
reg [`TOKEN_BITS-1:0] rd_tokens_reg;
|
153 |
|
|
reg [`OUT_BITS-1:0] rd_outs_max_reg;
|
154 |
|
|
reg rd_port_num_reg;
|
155 |
|
|
reg cmd_port_num_reg;
|
156 |
|
|
wire rd_port_num_cfg;
|
157 |
|
|
wire cmd_port_num;
|
158 |
|
|
reg rd_outstanding_reg;
|
159 |
|
|
wire rd_outstanding_cfg;
|
160 |
|
|
reg rd_incr_reg;
|
161 |
|
|
reg [4:0] rd_periph_num_reg;
|
162 |
|
|
reg [`WAIT_BITS-1:4] rd_wait_limit_reg;
|
163 |
|
|
|
164 |
|
|
wire [7-1:0] wr_burst_max_size_rd;
|
165 |
|
|
wire [7-1:0] wr_burst_max_size_pre;
|
166 |
|
|
reg [7-1:0] wr_burst_max_size_reg;
|
167 |
|
|
reg [`DELAY_BITS-1:0] wr_periph_delay_reg;
|
168 |
|
|
reg wr_periph_block_reg;
|
169 |
|
|
reg [`TOKEN_BITS-1:0] wr_tokens_reg;
|
170 |
|
|
reg [`OUT_BITS-1:0] wr_outs_max_reg;
|
171 |
|
|
reg wr_port_num_reg;
|
172 |
|
|
reg wr_outstanding_reg;
|
173 |
|
|
wire wr_outstanding_cfg;
|
174 |
|
|
reg wr_incr_reg;
|
175 |
|
|
reg [4:0] wr_periph_num_reg;
|
176 |
|
|
reg [`WAIT_BITS-1:4] wr_wait_limit_reg;
|
177 |
|
|
|
178 |
|
|
wire rd_allow_full_fifo;
|
179 |
|
|
wire wr_allow_full_fifo;
|
180 |
|
|
wire allow_full_fifo;
|
181 |
|
|
wire allow_full_burst;
|
182 |
|
|
wire allow_joint_burst;
|
183 |
|
|
wire burst_max_size_update_pre;
|
184 |
|
|
wire burst_max_size_update;
|
185 |
|
|
|
186 |
|
|
reg cmd_set_int_reg;
|
187 |
|
|
reg cmd_last_reg;
|
188 |
|
|
reg [32-1:2] cmd_next_addr_reg;
|
189 |
|
|
reg [`CMD_CNT_BITS-1:0] cmd_counter_reg;
|
190 |
|
|
reg [`INT_CNT_BITS-1:0] int_counter_reg;
|
191 |
|
|
wire cmd_set_int;
|
192 |
|
|
wire cmd_last;
|
193 |
|
|
wire [32-1:2] cmd_next_addr;
|
194 |
|
|
wire [`CMD_CNT_BITS-1:0] cmd_counter;
|
195 |
|
|
wire [`INT_CNT_BITS-1:0] int_counter;
|
196 |
|
|
|
197 |
|
|
//interrupt
|
198 |
|
|
wire ch_end;
|
199 |
|
|
wire ch_end_set;
|
200 |
|
|
wire ch_end_clear;
|
201 |
|
|
wire ch_end_int;
|
202 |
|
|
wire [2:0] int_proc_num;
|
203 |
|
|
reg [2:0] int_proc_num_reg;
|
204 |
|
|
wire [INT_NUM-1:0] int_bus;
|
205 |
|
|
wire [INT_NUM-1:0] int_rawstat;
|
206 |
|
|
reg [INT_NUM-1:0] int_enable;
|
207 |
|
|
wire [INT_NUM-1:0] int_status;
|
208 |
|
|
wire [7:0] int_all_proc_bus;
|
209 |
|
|
|
210 |
|
|
wire wr_cmd_line0;
|
211 |
|
|
wire wr_cmd_line1;
|
212 |
|
|
wire wr_cmd_line2;
|
213 |
|
|
wire wr_cmd_line3;
|
214 |
|
|
wire wr_static_line0;
|
215 |
|
|
wire wr_static_line1;
|
216 |
|
|
wire wr_static_line2;
|
217 |
|
|
wire wr_static_line3;
|
218 |
|
|
wire wr_static_line4;
|
219 |
|
|
wire wr_ch_enable;
|
220 |
|
|
wire wr_ch_start;
|
221 |
|
|
wire wr_int_rawstat;
|
222 |
|
|
wire wr_int_clear;
|
223 |
|
|
wire wr_int_enable;
|
224 |
|
|
wire wr_frame_width;
|
225 |
|
|
|
226 |
|
|
reg [31:0] rd_cmd_line0;
|
227 |
|
|
reg [31:0] rd_cmd_line1;
|
228 |
|
|
reg [31:0] rd_cmd_line2;
|
229 |
|
|
reg [31:0] rd_cmd_line3;
|
230 |
|
|
reg [31:0] rd_static_line0;
|
231 |
|
|
reg [31:0] rd_static_line1;
|
232 |
|
|
reg [31:0] rd_static_line2;
|
233 |
|
|
reg [31:0] rd_static_line3;
|
234 |
|
|
reg [31:0] rd_static_line4;
|
235 |
|
|
reg [31:0] rd_restrict;
|
236 |
|
|
reg [31:0] rd_rd_offsets;
|
237 |
|
|
reg [31:0] rd_wr_offsets;
|
238 |
|
|
reg [31:0] rd_fifo_fullness;
|
239 |
|
|
reg [31:0] rd_cmd_outs;
|
240 |
|
|
reg [31:0] rd_ch_enable;
|
241 |
|
|
reg [31:0] rd_ch_active;
|
242 |
|
|
reg [31:0] rd_cmd_counter;
|
243 |
|
|
reg [31:0] rd_int_rawstat;
|
244 |
|
|
reg [31:0] rd_int_enable;
|
245 |
|
|
reg [31:0] rd_int_status;
|
246 |
|
|
|
247 |
|
|
wire load_wr_cycle0;
|
248 |
|
|
wire load_wr_cycle1;
|
249 |
|
|
wire load_wr_cycle2;
|
250 |
|
|
wire load_wr_cycle3;
|
251 |
|
|
wire load_wr0;
|
252 |
|
|
wire load_wr1;
|
253 |
|
|
wire load_wr2;
|
254 |
|
|
wire load_wr3;
|
255 |
|
|
wire load_wr_last;
|
256 |
|
|
wire load_req;
|
257 |
|
|
|
258 |
|
|
wire timeout_aw;
|
259 |
|
|
wire timeout_w;
|
260 |
|
|
wire timeout_b;
|
261 |
|
|
wire timeout_ar;
|
262 |
|
|
wire timeout_r;
|
263 |
|
|
|
264 |
|
|
wire ch_retry_wait_pre;
|
265 |
|
|
reg ch_retry_wait_reg;
|
266 |
|
|
wire ch_retry_wait;
|
267 |
|
|
wire ch_retry;
|
268 |
|
|
wire ch_update_pre;
|
269 |
|
|
reg ch_update;
|
270 |
|
|
wire ch_update_d;
|
271 |
|
|
|
272 |
|
|
wire ch_int;
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
//---------------------- gating -------------------------------------
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
//assign gpaddr = {8{psel}} & paddr;
|
279 |
|
|
assign gpaddr = paddr; //removed for timing
|
280 |
|
|
assign gpwrite = psel & (~penable) & pwrite;
|
281 |
|
|
assign gpread = psel & (~penable) & (~pwrite);
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
//---------------------- Write Operations ----------------------------------
|
285 |
|
|
assign wr_cmd_line0 = gpwrite & gpaddr == CMD_LINE0;
|
286 |
|
|
assign wr_cmd_line1 = gpwrite & gpaddr == CMD_LINE1;
|
287 |
|
|
assign wr_cmd_line2 = gpwrite & gpaddr == CMD_LINE2;
|
288 |
|
|
assign wr_cmd_line3 = gpwrite & gpaddr == CMD_LINE3;
|
289 |
|
|
assign wr_static_line0 = gpwrite & gpaddr == STATIC_LINE0;
|
290 |
|
|
assign wr_static_line1 = gpwrite & gpaddr == STATIC_LINE1;
|
291 |
|
|
assign wr_static_line2 = gpwrite & gpaddr == STATIC_LINE2;
|
292 |
|
|
assign wr_static_line3 = gpwrite & gpaddr == STATIC_LINE3;
|
293 |
|
|
assign wr_static_line4 = gpwrite & gpaddr == STATIC_LINE4;
|
294 |
|
|
assign wr_ch_enable = gpwrite & gpaddr == CH_ENABLE;
|
295 |
|
|
assign wr_ch_start = (gpwrite & gpaddr == CH_START) | ch_start;
|
296 |
|
|
assign wr_int_rawstat = gpwrite & gpaddr == INT_RAWSTAT;
|
297 |
|
|
assign wr_int_clear = gpwrite & gpaddr == INT_CLEAR;
|
298 |
|
|
assign wr_int_enable = gpwrite & gpaddr == INT_ENABLE;
|
299 |
|
|
|
300 |
|
|
assign load_wr_cycle0 = load_wr & load_wr_cycle == 2'd0;
|
301 |
|
|
assign load_wr_cycle1 = load_wr & load_wr_cycle == 2'd1;
|
302 |
|
|
assign load_wr_cycle2 = load_wr & load_wr_cycle == 2'd2;
|
303 |
|
|
assign load_wr_cycle3 = load_wr & load_wr_cycle == 2'd3;
|
304 |
|
|
|
305 |
|
|
assign load_wr0 = 1 ? load_wr_cycle0 : load_wr_cycle0;
|
306 |
|
|
assign load_wr1 = 1 ? load_wr_cycle1 : load_wr_cycle0;
|
307 |
|
|
assign load_wr2 = 1 ? load_wr_cycle2 : load_wr_cycle1;
|
308 |
|
|
assign load_wr3 = 1 ? load_wr_cycle3 : load_wr_cycle1;
|
309 |
|
|
|
310 |
|
|
assign load_wr_last = 1 ? load_wr3 : load_wr_cycle3; //AHB 64 uses 2 false cycles (INCR4)
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
always @(posedge clk or posedge reset)
|
316 |
|
|
if (reset)
|
317 |
|
|
begin
|
318 |
|
|
rd_start_addr <= #1 {32{1'b0}};
|
319 |
|
|
end
|
320 |
|
|
else if (wr_cmd_line0)
|
321 |
|
|
begin
|
322 |
|
|
rd_start_addr <= #1 pwdata[32-1:0];
|
323 |
|
|
end
|
324 |
|
|
else if (load_wr0)
|
325 |
|
|
begin
|
326 |
|
|
rd_start_addr <= #1 load_wdata[32-1:0];
|
327 |
|
|
end
|
328 |
|
|
|
329 |
|
|
always @(posedge clk or posedge reset)
|
330 |
|
|
if (reset)
|
331 |
|
|
begin
|
332 |
|
|
wr_start_addr <= #1 {32{1'b0}};
|
333 |
|
|
end
|
334 |
|
|
else if (wr_cmd_line1)
|
335 |
|
|
begin
|
336 |
|
|
wr_start_addr <= #1 pwdata[32-1:0];
|
337 |
|
|
end
|
338 |
|
|
else if (load_wr1)
|
339 |
|
|
begin
|
340 |
|
|
wr_start_addr <= #1 load_wdata[32+32-DATA_SHIFT-1:32-DATA_SHIFT];
|
341 |
|
|
end
|
342 |
|
|
|
343 |
|
|
always @(posedge clk or posedge reset)
|
344 |
|
|
if (reset)
|
345 |
|
|
begin
|
346 |
|
|
buff_size <= #1 {10{1'b0}};
|
347 |
|
|
end
|
348 |
|
|
else if (wr_cmd_line2)
|
349 |
|
|
begin
|
350 |
|
|
buff_size <= #1 pwdata[10-1:0];
|
351 |
|
|
end
|
352 |
|
|
else if (load_wr2)
|
353 |
|
|
begin
|
354 |
|
|
buff_size <= #1 load_wdata[10-1:0];
|
355 |
|
|
end
|
356 |
|
|
|
357 |
|
|
always @(posedge clk or posedge reset)
|
358 |
|
|
if (reset)
|
359 |
|
|
begin
|
360 |
|
|
cmd_set_int_reg <= #1 1'b0;
|
361 |
|
|
cmd_last_reg <= #1 1'b0;
|
362 |
|
|
cmd_next_addr_reg <= #1 {30{1'b0}};
|
363 |
|
|
end
|
364 |
|
|
else if (wr_cmd_line3)
|
365 |
|
|
begin
|
366 |
|
|
cmd_set_int_reg <= #1 pwdata[0];
|
367 |
|
|
cmd_last_reg <= #1 pwdata[1];
|
368 |
|
|
cmd_next_addr_reg <= #1 pwdata[32-1:2];
|
369 |
|
|
end
|
370 |
|
|
else if (load_wr3)
|
371 |
|
|
begin
|
372 |
|
|
cmd_set_int_reg <= #1 load_wdata[32-DATA_SHIFT];
|
373 |
|
|
cmd_last_reg <= #1 load_wdata[33-DATA_SHIFT];
|
374 |
|
|
cmd_next_addr_reg <= #1 load_wdata[32+32-DATA_SHIFT-1:34-DATA_SHIFT];
|
375 |
|
|
end
|
376 |
|
|
|
377 |
|
|
always @(posedge clk or posedge reset)
|
378 |
|
|
if (reset)
|
379 |
|
|
cmd_counter_reg <= #1 {`CMD_CNT_BITS{1'b0}};
|
380 |
|
|
else if (wr_ch_start)
|
381 |
|
|
cmd_counter_reg <= #1 {`CMD_CNT_BITS{1'b0}};
|
382 |
|
|
else if (ch_end & clken)
|
383 |
|
|
cmd_counter_reg <= #1 cmd_counter_reg + 1'b1;
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
always @(posedge clk or posedge reset)
|
387 |
|
|
if (reset)
|
388 |
|
|
int_counter_reg <= #1 {`INT_CNT_BITS{1'b0}};
|
389 |
|
|
else if (wr_ch_start)
|
390 |
|
|
int_counter_reg <= #1 {`INT_CNT_BITS{1'b0}};
|
391 |
|
|
else if ((ch_end_int & clken) | ch_end_clear)
|
392 |
|
|
int_counter_reg <= #1 int_counter_reg + (ch_end_int & clken) - ch_end_clear;
|
393 |
|
|
|
394 |
|
|
assign cmd_set_int = cmd_set_int_reg;
|
395 |
|
|
assign cmd_last = cmd_last_reg;
|
396 |
|
|
assign cmd_next_addr = cmd_next_addr_reg;
|
397 |
|
|
|
398 |
|
|
assign cmd_counter = cmd_counter_reg;
|
399 |
|
|
assign int_counter = int_counter_reg;
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
assign x_size = block ? {{10-`X_BITS{1'b0}}, buff_size[`X_BITS-1:0]} : buff_size;
|
403 |
|
|
assign y_size = block ? buff_size[10-1:`X_BITS] : 'd1;
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
always @(posedge clk or posedge reset)
|
407 |
|
|
if (reset)
|
408 |
|
|
begin
|
409 |
|
|
rd_burst_max_size_reg <= #1 'd0;
|
410 |
|
|
rd_tokens_reg <= #1 'd1;
|
411 |
|
|
rd_incr_reg <= #1 'd1;
|
412 |
|
|
end
|
413 |
|
|
else if (wr_static_line0)
|
414 |
|
|
begin
|
415 |
|
|
rd_burst_max_size_reg <= #1 pwdata[7-1:0];
|
416 |
|
|
rd_tokens_reg <= #1 pwdata[`TOKEN_BITS+16-1:16];
|
417 |
|
|
rd_incr_reg <= #1 pwdata[31];
|
418 |
|
|
end
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
always @(posedge clk or posedge reset)
|
422 |
|
|
if (reset)
|
423 |
|
|
begin
|
424 |
|
|
wr_burst_max_size_reg <= #1 'd0;
|
425 |
|
|
wr_tokens_reg <= #1 'd1;
|
426 |
|
|
wr_incr_reg <= #1 'd1;
|
427 |
|
|
end
|
428 |
|
|
else if (wr_static_line1)
|
429 |
|
|
begin
|
430 |
|
|
wr_burst_max_size_reg <= #1 pwdata[7-1:0];
|
431 |
|
|
wr_tokens_reg <= #1 pwdata[`TOKEN_BITS+16-1:16];
|
432 |
|
|
wr_incr_reg <= #1 pwdata[31];
|
433 |
|
|
end
|
434 |
|
|
|
435 |
|
|
assign rd_incr = rd_incr_reg;
|
436 |
|
|
assign wr_incr = wr_incr_reg;
|
437 |
|
|
|
438 |
|
|
assign rd_outstanding_cfg = 1'b0;
|
439 |
|
|
assign wr_outstanding_cfg = 1'b0;
|
440 |
|
|
assign rd_outstanding = 1'b0;
|
441 |
|
|
assign wr_outstanding = 1'b0;
|
442 |
|
|
|
443 |
|
|
assign rd_tokens = rd_tokens_reg;
|
444 |
|
|
assign wr_tokens = joint_mux ? rd_tokens_reg : wr_tokens_reg;
|
445 |
|
|
|
446 |
|
|
assign rd_outs_max = 'd0;
|
447 |
|
|
assign wr_outs_max = 'd0;
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
assign rd_allow_full_fifo = rd_start_addr[5-1:0] == 'd0;
|
451 |
|
|
assign wr_allow_full_fifo = wr_start_addr[5-1:0] == 'd0;
|
452 |
|
|
|
453 |
|
|
assign allow_full_fifo = rd_allow_full_fifo & wr_allow_full_fifo;
|
454 |
|
|
|
455 |
|
|
assign rd_burst_max_size = rd_burst_max_size_pre;
|
456 |
|
|
assign wr_burst_max_size = joint_mux ? rd_burst_max_size_pre : wr_burst_max_size_pre;
|
457 |
|
|
|
458 |
|
|
assign allow_joint_burst = joint & (~joint_flush) & (~page_cross) & (~joint_cross);
|
459 |
|
|
|
460 |
|
|
assign allow_full_burst = allow_joint_burst & allow_full_fifo;
|
461 |
|
|
|
462 |
|
|
assign burst_max_size_update_pre = ch_update | ch_update_d | joint;
|
463 |
|
|
|
464 |
|
|
prgen_delay #(1) delay_max_size_update (.clk(clk), .reset(reset), .din(burst_max_size_update_pre), .dout(burst_max_size_update));
|
465 |
|
|
|
466 |
|
|
dma_ahb32_core0_ch_reg_size
|
467 |
|
|
dma_ahb32_core0_ch_reg_size_rd (
|
468 |
|
|
.clk(clk),
|
469 |
|
|
.reset(reset),
|
470 |
|
|
.update(burst_max_size_update),
|
471 |
|
|
.start_addr(rd_start_addr),
|
472 |
|
|
.burst_max_size_reg(rd_burst_max_size_reg),
|
473 |
|
|
.burst_max_size_other(wr_burst_max_size_rd),
|
474 |
|
|
.allow_full_burst(allow_full_burst),
|
475 |
|
|
.allow_full_fifo(allow_full_fifo),
|
476 |
|
|
.joint_flush(joint_flush),
|
477 |
|
|
.burst_max_size(rd_burst_max_size_pre)
|
478 |
|
|
);
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
dma_ahb32_core0_ch_reg_size
|
482 |
|
|
dma_ahb32_core0_ch_reg_size_wr (
|
483 |
|
|
.clk(clk),
|
484 |
|
|
.reset(reset),
|
485 |
|
|
.update(burst_max_size_update),
|
486 |
|
|
.start_addr(wr_start_addr),
|
487 |
|
|
.burst_max_size_reg(wr_burst_max_size_reg),
|
488 |
|
|
.burst_max_size_other(rd_burst_max_size_reg),
|
489 |
|
|
.allow_full_burst(1'b0),
|
490 |
|
|
.allow_full_fifo(allow_full_fifo),
|
491 |
|
|
.joint_flush(joint_flush),
|
492 |
|
|
.burst_max_size(wr_burst_max_size_pre)
|
493 |
|
|
);
|
494 |
|
|
|
495 |
|
|
|
496 |
|
|
always @(posedge clk or posedge reset)
|
497 |
|
|
if (reset)
|
498 |
|
|
begin
|
499 |
|
|
joint_reg <= #1 1'b1;
|
500 |
|
|
end_swap_reg <= #1 2'b00;
|
501 |
|
|
end
|
502 |
|
|
else if (wr_static_line2)
|
503 |
|
|
begin
|
504 |
|
|
joint_reg <= #1 pwdata[16];
|
505 |
|
|
end_swap_reg <= #1 pwdata[29:28];
|
506 |
|
|
end
|
507 |
|
|
|
508 |
|
|
|
509 |
|
|
always @(posedge clk or posedge reset)
|
510 |
|
|
if (reset)
|
511 |
|
|
simple_mem <= #1 1'b0;
|
512 |
|
|
else if (ch_update)
|
513 |
|
|
simple_mem <= #1 (rd_periph_num == 'd0) & (wr_periph_num == 'd0) & (~allow_line_cmd);
|
514 |
|
|
|
515 |
|
|
assign joint = joint_mode & joint_reg & simple_mem & 1'b1;
|
516 |
|
|
|
517 |
|
|
assign joint_mux = joint;
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
assign cmd_port_num = 1'b0;
|
522 |
|
|
assign rd_port_num_cfg = 1'b0;
|
523 |
|
|
assign wr_port_num = 1'b0;
|
524 |
|
|
assign rd_port_num = 1'b0;
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
assign frame_width = {`FRAME_BITS{1'b0}};
|
528 |
|
|
assign block = 1'b0;
|
529 |
|
|
|
530 |
|
|
assign width_align = frame_width[2-1:0];
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
assign rd_wait_limit = {`WAIT_BITS-4{1'b0}};
|
534 |
|
|
assign wr_wait_limit = {`WAIT_BITS-4{1'b0}};
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
|
538 |
|
|
always @(posedge clk or posedge reset)
|
539 |
|
|
if (reset)
|
540 |
|
|
begin
|
541 |
|
|
rd_periph_num_reg <= #1 'd0; //0 is memory
|
542 |
|
|
rd_periph_delay_reg <= #1 'd0; //0 is memory
|
543 |
|
|
wr_periph_num_reg <= #1 'd0; //0 is memory
|
544 |
|
|
wr_periph_delay_reg <= #1 'd0; //0 is memory
|
545 |
|
|
end
|
546 |
|
|
else if (wr_static_line4)
|
547 |
|
|
begin
|
548 |
|
|
rd_periph_num_reg <= #1 pwdata[4:0];
|
549 |
|
|
rd_periph_delay_reg <= #1 pwdata[`DELAY_BITS+8-1:8];
|
550 |
|
|
wr_periph_num_reg <= #1 pwdata[20:16];
|
551 |
|
|
wr_periph_delay_reg <= #1 pwdata[`DELAY_BITS+24-1:24];
|
552 |
|
|
end
|
553 |
|
|
|
554 |
|
|
assign rd_periph_num = rd_periph_num_reg;
|
555 |
|
|
assign wr_periph_num = wr_periph_num_reg;
|
556 |
|
|
assign rd_periph_delay = rd_periph_delay_reg;
|
557 |
|
|
assign wr_periph_delay = wr_periph_delay_reg;
|
558 |
|
|
|
559 |
|
|
assign rd_periph_block = 1'b0;
|
560 |
|
|
assign wr_periph_block = 1'b0;
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
always @(posedge clk or posedge reset)
|
565 |
|
|
if (reset)
|
566 |
|
|
begin
|
567 |
|
|
ch_enable <= #1 1'b1;
|
568 |
|
|
end
|
569 |
|
|
else if (wr_ch_enable)
|
570 |
|
|
begin
|
571 |
|
|
ch_enable <= #1 pwdata[0];
|
572 |
|
|
end
|
573 |
|
|
|
574 |
|
|
always @(posedge clk or posedge reset)
|
575 |
|
|
if (reset)
|
576 |
|
|
ch_in_prog <= #1 1'b0;
|
577 |
|
|
else if (ch_update)
|
578 |
|
|
ch_in_prog <= #1 1'b1;
|
579 |
|
|
else if (ch_end & clken)
|
580 |
|
|
ch_in_prog <= #1 1'b0;
|
581 |
|
|
|
582 |
|
|
always @(posedge clk or posedge reset)
|
583 |
|
|
if (reset)
|
584 |
|
|
rd_ch_in_prog <= #1 1'b0;
|
585 |
|
|
else if (ch_update)
|
586 |
|
|
rd_ch_in_prog <= #1 1'b1;
|
587 |
|
|
else if (fifo_underflow | fifo_overflow)
|
588 |
|
|
rd_ch_in_prog <= #1 1'b0;
|
589 |
|
|
else if (rd_ch_end & clken)
|
590 |
|
|
rd_ch_in_prog <= #1 1'b0;
|
591 |
|
|
|
592 |
|
|
always @(posedge clk or posedge reset)
|
593 |
|
|
if (reset)
|
594 |
|
|
wr_ch_in_prog <= #1 1'b0;
|
595 |
|
|
else if (ch_update)
|
596 |
|
|
wr_ch_in_prog <= #1 1'b1;
|
597 |
|
|
else if (fifo_underflow | fifo_overflow)
|
598 |
|
|
wr_ch_in_prog <= #1 1'b0;
|
599 |
|
|
else if (wr_ch_end & clken)
|
600 |
|
|
wr_ch_in_prog <= #1 1'b0;
|
601 |
|
|
|
602 |
|
|
always @(posedge clk or posedge reset)
|
603 |
|
|
if (reset)
|
604 |
|
|
load_in_prog_reg <= #1 1'b0;
|
605 |
|
|
else if (load_req & clken)
|
606 |
|
|
load_in_prog_reg <= #1 1'b1;
|
607 |
|
|
else if (ch_update & clken)
|
608 |
|
|
load_in_prog_reg <= #1 1'b0;
|
609 |
|
|
|
610 |
|
|
always @(posedge clk or posedge reset)
|
611 |
|
|
if (reset)
|
612 |
|
|
load_req_in_prog_reg <= #1 1'b0;
|
613 |
|
|
else if (load_req & clken)
|
614 |
|
|
load_req_in_prog_reg <= #1 1'b1;
|
615 |
|
|
else if (load_cmd & clken)
|
616 |
|
|
load_req_in_prog_reg <= #1 1'b0;
|
617 |
|
|
|
618 |
|
|
assign load_in_prog = load_in_prog_reg;
|
619 |
|
|
assign load_req_in_prog = load_req_in_prog_reg;
|
620 |
|
|
|
621 |
|
|
assign auto_retry = 1'b0;
|
622 |
|
|
assign ch_retry_wait = 1'b0;
|
623 |
|
|
assign ch_retry = 1'b0;
|
624 |
|
|
|
625 |
|
|
assign ch_update_pre = wr_ch_start | load_wr_last | ch_retry;
|
626 |
|
|
|
627 |
|
|
always @(posedge clk or posedge reset)
|
628 |
|
|
if (reset)
|
629 |
|
|
ch_update <= #1 1'b0;
|
630 |
|
|
else if (ch_update_pre)
|
631 |
|
|
ch_update <= #1 1'b1;
|
632 |
|
|
else if (clken)
|
633 |
|
|
ch_update <= #1 1'b0;
|
634 |
|
|
|
635 |
|
|
prgen_delay #(1) delay_ch_update (.clk(clk), .reset(reset), .din(ch_update), .dout(ch_update_d));
|
636 |
|
|
|
637 |
|
|
assign load_req = (ch_enable & ch_end & (~cmd_last)) | (ch_update & (x_size == 'd0));
|
638 |
|
|
assign load_addr = {cmd_next_addr[32-1:2], 2'b00};
|
639 |
|
|
|
640 |
|
|
assign ch_end = rd_ch_end & wr_ch_end & wr_clr_last & (~ch_retry_wait);
|
641 |
|
|
|
642 |
|
|
assign ch_end_int = ch_enable & ch_end & cmd_set_int;
|
643 |
|
|
assign ch_rd_active = ch_enable & (rd_ch_in_prog | load_req_in_prog);
|
644 |
|
|
assign ch_wr_active = ch_enable & wr_ch_in_prog;
|
645 |
|
|
|
646 |
|
|
assign ch_end_set = |int_counter;
|
647 |
|
|
assign ch_end_clear = wr_int_clear & pwdata[0];
|
648 |
|
|
|
649 |
|
|
assign {timeout_aw,
|
650 |
|
|
timeout_w,
|
651 |
|
|
timeout_b,
|
652 |
|
|
timeout_ar,
|
653 |
|
|
timeout_r} = timeout_bus[4:0];
|
654 |
|
|
|
655 |
|
|
|
656 |
|
|
assign int_bus = {INT_NUM{clken}} & {
|
657 |
|
|
wdt_timeout,
|
658 |
|
|
timeout_aw,
|
659 |
|
|
timeout_ar,
|
660 |
|
|
fifo_underflow,
|
661 |
|
|
fifo_overflow,
|
662 |
|
|
wr_slverr,
|
663 |
|
|
rd_slverr,
|
664 |
|
|
ch_end_set
|
665 |
|
|
};
|
666 |
|
|
|
667 |
|
|
prgen_rawstat #(INT_NUM) rawstat(
|
668 |
|
|
.clk(clk),
|
669 |
|
|
.reset(reset),
|
670 |
|
|
.clear(wr_int_clear),
|
671 |
|
|
.write(wr_int_rawstat),
|
672 |
|
|
.pwdata(pwdata[INT_NUM-1:0]),
|
673 |
|
|
.int_bus(int_bus),
|
674 |
|
|
.rawstat(int_rawstat)
|
675 |
|
|
);
|
676 |
|
|
|
677 |
|
|
|
678 |
|
|
always @(posedge clk or posedge reset)
|
679 |
|
|
if (reset)
|
680 |
|
|
int_enable <= #1 {INT_NUM{1'b1}};
|
681 |
|
|
else if (wr_int_enable)
|
682 |
|
|
int_enable <= #1 pwdata[INT_NUM-1:0];
|
683 |
|
|
|
684 |
|
|
assign int_status = int_rawstat & int_enable;
|
685 |
|
|
|
686 |
|
|
assign ch_int = |int_status;
|
687 |
|
|
|
688 |
|
|
assign int_proc_num = 3'd0;
|
689 |
|
|
assign int_all_proc = ch_int;
|
690 |
|
|
|
691 |
|
|
assign end_swap = end_swap_reg;
|
692 |
|
|
|
693 |
|
|
//---------------------- Read Operations -----------------------------------
|
694 |
|
|
assign rd_burst_max_size_rd = rd_burst_max_size_reg;
|
695 |
|
|
assign wr_burst_max_size_rd = wr_burst_max_size_reg;
|
696 |
|
|
|
697 |
|
|
|
698 |
|
|
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
|
699 |
|
|
always @(allow_full_burst or allow_full_fifo
|
700 |
|
|
or allow_joint_burst or allow_line_cmd or auto_retry
|
701 |
|
|
or block or buff_size or ch_enable or ch_rd_active
|
702 |
|
|
or ch_wr_active or cmd_counter or cmd_last
|
703 |
|
|
or cmd_next_addr or cmd_port_num or cmd_set_int
|
704 |
|
|
or end_swap or frame_width or int_counter or int_enable
|
705 |
|
|
or int_proc_num or int_rawstat or int_status or joint_reg
|
706 |
|
|
or rd_allow_full_fifo or rd_burst_max_size_rd or rd_gap
|
707 |
|
|
or rd_incr or rd_outs or rd_outs_max or rd_outstanding
|
708 |
|
|
or rd_outstanding_cfg or rd_periph_block_reg
|
709 |
|
|
or rd_periph_delay or rd_periph_num or rd_port_num_cfg
|
710 |
|
|
or rd_start_addr or rd_tokens or rd_wait_limit
|
711 |
|
|
or rd_x_offset or rd_y_offset or simple_mem
|
712 |
|
|
or wr_allow_full_fifo or wr_burst_max_size_rd
|
713 |
|
|
or wr_fullness or wr_incr or wr_outs or wr_outs_max
|
714 |
|
|
or wr_outstanding or wr_outstanding_cfg
|
715 |
|
|
or wr_periph_block_reg or wr_periph_delay or wr_periph_num
|
716 |
|
|
or wr_port_num or wr_start_addr or wr_tokens
|
717 |
|
|
or wr_wait_limit or wr_x_offset or wr_y_offset)
|
718 |
|
|
begin
|
719 |
|
|
rd_cmd_line0 = {32{1'b0}};
|
720 |
|
|
rd_cmd_line1 = {32{1'b0}};
|
721 |
|
|
rd_cmd_line2 = {32{1'b0}};
|
722 |
|
|
rd_cmd_line3 = {32{1'b0}};
|
723 |
|
|
rd_static_line0 = {32{1'b0}};
|
724 |
|
|
rd_static_line1 = {32{1'b0}};
|
725 |
|
|
rd_static_line2 = {32{1'b0}};
|
726 |
|
|
rd_static_line3 = {32{1'b0}};
|
727 |
|
|
rd_static_line4 = {32{1'b0}};
|
728 |
|
|
rd_restrict = {32{1'b0}};
|
729 |
|
|
rd_rd_offsets = {32{1'b0}};
|
730 |
|
|
rd_wr_offsets = {32{1'b0}};
|
731 |
|
|
rd_fifo_fullness = {32{1'b0}};
|
732 |
|
|
rd_cmd_outs = {32{1'b0}};
|
733 |
|
|
rd_ch_enable = {32{1'b0}};
|
734 |
|
|
rd_ch_active = {32{1'b0}};
|
735 |
|
|
rd_cmd_counter = {32{1'b0}};
|
736 |
|
|
rd_int_rawstat = {32{1'b0}};
|
737 |
|
|
rd_int_enable = {32{1'b0}};
|
738 |
|
|
rd_int_status = {32{1'b0}};
|
739 |
|
|
|
740 |
|
|
|
741 |
|
|
rd_cmd_line0[32-1:0] = rd_start_addr;
|
742 |
|
|
|
743 |
|
|
rd_cmd_line1[32-1:0] = wr_start_addr;
|
744 |
|
|
|
745 |
|
|
rd_cmd_line2[10-1:0] = buff_size;
|
746 |
|
|
|
747 |
|
|
rd_cmd_line3[0] = cmd_set_int;
|
748 |
|
|
rd_cmd_line3[1] = cmd_last;
|
749 |
|
|
rd_cmd_line3[32-1:2] = cmd_next_addr;
|
750 |
|
|
|
751 |
|
|
rd_static_line0[7-1:0] = rd_burst_max_size_rd;
|
752 |
|
|
rd_static_line0[`TOKEN_BITS+16-1:16] = rd_tokens;
|
753 |
|
|
rd_static_line0[`OUT_BITS+24-1:24] = rd_outs_max;
|
754 |
|
|
rd_static_line0[30] = rd_outstanding_cfg;
|
755 |
|
|
rd_static_line0[31] = rd_incr;
|
756 |
|
|
|
757 |
|
|
rd_static_line1[7-1:0] = wr_burst_max_size_rd;
|
758 |
|
|
rd_static_line1[`TOKEN_BITS+16-1:16] = wr_tokens;
|
759 |
|
|
rd_static_line1[`OUT_BITS+24-1:24] = wr_outs_max;
|
760 |
|
|
rd_static_line1[30] = wr_outstanding_cfg;
|
761 |
|
|
rd_static_line1[31] = wr_incr;
|
762 |
|
|
|
763 |
|
|
rd_static_line2[`FRAME_BITS-1:0] = frame_width;
|
764 |
|
|
rd_static_line2[15] = block;
|
765 |
|
|
rd_static_line2[16] = joint_reg;
|
766 |
|
|
rd_static_line2[17] = auto_retry;
|
767 |
|
|
rd_static_line2[20] = cmd_port_num;
|
768 |
|
|
rd_static_line2[21] = rd_port_num_cfg;
|
769 |
|
|
rd_static_line2[22] = wr_port_num;
|
770 |
|
|
rd_static_line2[26:24] = int_proc_num;
|
771 |
|
|
rd_static_line2[29:28] = end_swap;
|
772 |
|
|
|
773 |
|
|
|
774 |
|
|
rd_static_line4[4:0] = rd_periph_num;
|
775 |
|
|
rd_static_line4[`DELAY_BITS+8-1:8] = rd_periph_delay;
|
776 |
|
|
rd_static_line4[20:16] = wr_periph_num;
|
777 |
|
|
rd_static_line4[`DELAY_BITS+24-1:24] = wr_periph_delay;
|
778 |
|
|
|
779 |
|
|
rd_restrict[0] = rd_allow_full_fifo;
|
780 |
|
|
rd_restrict[1] = wr_allow_full_fifo;
|
781 |
|
|
rd_restrict[2] = allow_full_fifo;
|
782 |
|
|
rd_restrict[3] = allow_full_burst;
|
783 |
|
|
rd_restrict[4] = allow_joint_burst;
|
784 |
|
|
rd_restrict[5] = rd_outstanding;
|
785 |
|
|
rd_restrict[6] = wr_outstanding;
|
786 |
|
|
rd_restrict[7] = allow_line_cmd;
|
787 |
|
|
rd_restrict[8] = simple_mem;
|
788 |
|
|
|
789 |
|
|
rd_rd_offsets[10-1:0] = rd_x_offset;
|
790 |
|
|
rd_rd_offsets[10-`X_BITS+16-1:16] = rd_y_offset;
|
791 |
|
|
|
792 |
|
|
rd_wr_offsets[10-1:0] = wr_x_offset;
|
793 |
|
|
rd_wr_offsets[10-`X_BITS+16-1:16] = wr_y_offset;
|
794 |
|
|
|
795 |
|
|
rd_fifo_fullness[5:0] = rd_gap;
|
796 |
|
|
rd_fifo_fullness[5+16:16] = wr_fullness;
|
797 |
|
|
|
798 |
|
|
rd_cmd_outs[`OUT_BITS-1:0] = rd_outs;
|
799 |
|
|
rd_cmd_outs[`OUT_BITS-1+8:8] = wr_outs;
|
800 |
|
|
|
801 |
|
|
rd_ch_enable[0] = ch_enable;
|
802 |
|
|
|
803 |
|
|
rd_ch_active[0] = ch_rd_active;
|
804 |
|
|
rd_ch_active[1] = ch_wr_active;
|
805 |
|
|
|
806 |
|
|
rd_cmd_counter[`CMD_CNT_BITS-1:0] = cmd_counter;
|
807 |
|
|
rd_cmd_counter[`INT_CNT_BITS-1+16:16] = int_counter;
|
808 |
|
|
|
809 |
|
|
rd_int_rawstat[INT_NUM-1:0] = int_rawstat;
|
810 |
|
|
|
811 |
|
|
rd_int_enable[INT_NUM-1:0] = int_enable;
|
812 |
|
|
|
813 |
|
|
rd_int_status[INT_NUM-1:0] = int_status;
|
814 |
|
|
end
|
815 |
|
|
|
816 |
|
|
|
817 |
|
|
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
|
818 |
|
|
always @(gpaddr or rd_ch_active or rd_ch_enable
|
819 |
|
|
or rd_cmd_counter or rd_cmd_line0 or rd_cmd_line1
|
820 |
|
|
or rd_cmd_line2 or rd_cmd_line3 or rd_cmd_outs
|
821 |
|
|
or rd_fifo_fullness or rd_int_enable or rd_int_rawstat
|
822 |
|
|
or rd_int_status or rd_rd_offsets or rd_restrict
|
823 |
|
|
or rd_static_line0 or rd_static_line1 or rd_static_line2
|
824 |
|
|
or rd_static_line3 or rd_static_line4 or rd_wr_offsets)
|
825 |
|
|
begin
|
826 |
|
|
prdata_pre = {32{1'b0}};
|
827 |
|
|
|
828 |
|
|
case (gpaddr)
|
829 |
|
|
CMD_LINE0 : prdata_pre = rd_cmd_line0;
|
830 |
|
|
CMD_LINE1 : prdata_pre = rd_cmd_line1;
|
831 |
|
|
CMD_LINE2 : prdata_pre = rd_cmd_line2;
|
832 |
|
|
CMD_LINE3 : prdata_pre = rd_cmd_line3;
|
833 |
|
|
|
834 |
|
|
STATIC_LINE0 : prdata_pre = rd_static_line0;
|
835 |
|
|
STATIC_LINE1 : prdata_pre = rd_static_line1;
|
836 |
|
|
STATIC_LINE2 : prdata_pre = rd_static_line2;
|
837 |
|
|
STATIC_LINE3 : prdata_pre = rd_static_line3;
|
838 |
|
|
STATIC_LINE4 : prdata_pre = rd_static_line4;
|
839 |
|
|
|
840 |
|
|
RESTRICT : prdata_pre = rd_restrict;
|
841 |
|
|
RD_OFFSETS : prdata_pre = rd_rd_offsets;
|
842 |
|
|
WR_OFFSETS : prdata_pre = rd_wr_offsets;
|
843 |
|
|
FIFO_FULLNESS : prdata_pre = rd_fifo_fullness;
|
844 |
|
|
CMD_OUTS : prdata_pre = rd_cmd_outs;
|
845 |
|
|
|
846 |
|
|
CH_ENABLE : prdata_pre = rd_ch_enable;
|
847 |
|
|
CH_START : prdata_pre = {32{1'b0}};
|
848 |
|
|
CH_ACTIVE : prdata_pre = rd_ch_active;
|
849 |
|
|
CH_CMD_COUNTER : prdata_pre = rd_cmd_counter;
|
850 |
|
|
|
851 |
|
|
INT_RAWSTAT : prdata_pre = rd_int_rawstat;
|
852 |
|
|
INT_CLEAR : prdata_pre = {32{1'b0}};
|
853 |
|
|
INT_ENABLE : prdata_pre = rd_int_enable;
|
854 |
|
|
INT_STATUS : prdata_pre = rd_int_status;
|
855 |
|
|
|
856 |
|
|
default : prdata_pre = {32{1'b0}};
|
857 |
|
|
endcase
|
858 |
|
|
end
|
859 |
|
|
|
860 |
|
|
|
861 |
|
|
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
|
862 |
|
|
always @(gpaddr or gpread or gpwrite or psel)
|
863 |
|
|
begin
|
864 |
|
|
pslverr_pre = 1'b0;
|
865 |
|
|
|
866 |
|
|
case (gpaddr)
|
867 |
|
|
CMD_LINE0 : pslverr_pre = 1'b0; //read and write
|
868 |
|
|
CMD_LINE1 : pslverr_pre = 1'b0; //read and write
|
869 |
|
|
CMD_LINE2 : pslverr_pre = 1'b0; //read and write
|
870 |
|
|
CMD_LINE3 : pslverr_pre = 1'b0; //read and write
|
871 |
|
|
|
872 |
|
|
STATIC_LINE0 : pslverr_pre = 1'b0; //read and write
|
873 |
|
|
STATIC_LINE1 : pslverr_pre = 1'b0; //read and write
|
874 |
|
|
STATIC_LINE2 : pslverr_pre = 1'b0; //read and write
|
875 |
|
|
STATIC_LINE3 : pslverr_pre = 1'b0; //read and write
|
876 |
|
|
STATIC_LINE4 : pslverr_pre = 1'b0; //read and write
|
877 |
|
|
|
878 |
|
|
RESTRICT : pslverr_pre = gpwrite; //read only
|
879 |
|
|
RD_OFFSETS : pslverr_pre = gpwrite; //read only
|
880 |
|
|
WR_OFFSETS : pslverr_pre = gpwrite; //read only
|
881 |
|
|
FIFO_FULLNESS : pslverr_pre = gpwrite; //read only
|
882 |
|
|
CMD_OUTS : pslverr_pre = gpwrite; //read only
|
883 |
|
|
|
884 |
|
|
CH_ENABLE : pslverr_pre = 1'b0; //read and write
|
885 |
|
|
CH_START : pslverr_pre = gpread; //write only
|
886 |
|
|
CH_ACTIVE : pslverr_pre = gpwrite; //read only
|
887 |
|
|
CH_CMD_COUNTER : pslverr_pre = gpwrite; //read only
|
888 |
|
|
|
889 |
|
|
INT_RAWSTAT : pslverr_pre = 1'b0; //read and write
|
890 |
|
|
INT_CLEAR : pslverr_pre = gpread; //write only
|
891 |
|
|
INT_ENABLE : pslverr_pre = 1'b0; //read and write
|
892 |
|
|
INT_STATUS : pslverr_pre = gpwrite; //read only
|
893 |
|
|
|
894 |
|
|
default : pslverr_pre = psel; //decode error
|
895 |
|
|
endcase
|
896 |
|
|
end
|
897 |
|
|
|
898 |
|
|
always @(posedge clk or posedge reset)
|
899 |
|
|
if (reset)
|
900 |
|
|
prdata <= #1 {32{1'b0}};
|
901 |
|
|
else if (gpread & pclken)
|
902 |
|
|
prdata <= #1 prdata_pre;
|
903 |
|
|
else if (pclken)
|
904 |
|
|
prdata <= #1 {32{1'b0}};
|
905 |
|
|
|
906 |
|
|
always @(posedge clk or posedge reset)
|
907 |
|
|
if (reset)
|
908 |
|
|
pslverr <= #1 1'b0;
|
909 |
|
|
else if ((gpread | gpwrite) & pclken)
|
910 |
|
|
pslverr <= #1 pslverr_pre;
|
911 |
|
|
else if (pclken)
|
912 |
|
|
pslverr <= #1 1'b0;
|
913 |
|
|
|
914 |
|
|
|
915 |
|
|
|
916 |
|
|
endmodule
|
917 |
|
|
|
918 |
|
|
|