OpenCores
URL https://opencores.org/ocsvn/dma_axi/dma_axi/trunk

Subversion Repositories dma_axi

[/] [dma_axi/] [trunk/] [src/] [dma_axi32/] [dma_axi32_core0_ch_calc_joint.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
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:34:54 2011
33
//--
34
//-- Source file: dma_ch_calc_joint.v
35
//---------------------------------------------------------
36
 
37
 
38
 
39
module dma_axi32_core0_ch_calc_joint(clk,reset,joint_update,ch_end,ch_end_flush,joint_line_req_clr,wr_cmd_pending,burst_size_pre2,burst_max_size,fifo_not_ready,outs_empty,x_remain,fifo_wr_ready,fifo_remain,joint,page_cross,joint_cross,joint_ready_in,joint_ready_out,joint_line_req,joint_burst_req,joint_wait,joint_flush,joint_flush_in,joint_buffer_small);
40
 
41
 
42
   parameter               READ          = 0;
43
   parameter            WRITE         = !READ;
44
 
45
   input                   clk;
46
   input            reset;
47
 
48
   input            joint_update;
49
   input            ch_end;
50
   input            ch_end_flush;
51
 
52
   input            joint_line_req_clr;
53
   input            wr_cmd_pending;
54
   input [7-1:0]  burst_size_pre2;
55
   input [7-1:0]  burst_max_size;
56
   input            fifo_not_ready;
57
   input            outs_empty;
58
   input [10-1:0]   x_remain;
59
   input            fifo_wr_ready;
60
   input [5:0]        fifo_remain;
61
 
62
   input            joint;
63
   input            page_cross;
64
   input            joint_cross;
65
   input            joint_ready_in;
66
   output            joint_ready_out;
67
   output            joint_line_req;
68
   output            joint_burst_req;
69
   output            joint_wait;
70
   output            joint_flush;
71
   input            joint_flush_in;
72
   output            joint_buffer_small;
73
 
74
 
75
 
76
 
77
   parameter            IDLE        = 3'd0;
78
   parameter            REQ_LINE    = 3'd1;
79
   parameter            READY_OUT   = 3'd2;
80
   parameter            READY       = 3'd3;
81
   parameter            CROSS       = 3'd4;
82
   parameter            BURST_REQ   = 3'd5;
83
   parameter            RECHK       = 3'd6;
84
   parameter            FLUSH       = 3'd7;
85
 
86
 
87
 
88
   reg [2:0]            ps;
89
   reg [2:0]            ns;
90
 
91
   wire            joint_ready_out_pre;
92
   reg                joint_ready_out;
93
   reg                joint_line_req;
94
   reg                joint_burst_req;
95
   reg                joint_flush;
96
   reg                joint_wait;
97
   wire            joint_buffer_small;
98
 
99
 
100
 
101
 
102
   assign            joint_ready_out_pre = joint & (burst_size_pre2 == burst_max_size) & (|burst_max_size) &
103
                                                 (~joint_line_req) & (~joint_burst_req);
104
 
105
   assign            joint_buffer_small = (burst_max_size > x_remain) | (x_remain < 'd8);
106
 
107
 
108
   always @(posedge clk or posedge reset)
109
     if (reset)
110
       joint_ready_out <= #1 1'b0;
111
     else if ((page_cross | ch_end_flush | joint_flush | joint_wait) & (~ch_end))
112
       joint_ready_out <= #1 1'b0;
113
     else if ((~ch_end) & (~wr_cmd_pending))
114
       joint_ready_out <= #1 joint_ready_out_pre;
115
 
116
 
117
   always @(/*AUTOSENSE*/ch_end_flush or fifo_not_ready or fifo_remain
118
        or fifo_wr_ready or joint_buffer_small or joint_cross
119
        or joint_flush_in or joint_line_req_clr or joint_ready_in
120
        or joint_ready_out or outs_empty or page_cross or ps)
121
     begin
122
    ns              = IDLE;
123
    joint_line_req  = 1'b0;
124
    joint_burst_req = 1'b0;
125
    joint_flush     = 1'b0;
126
    joint_wait      = 1'b0;
127
 
128
    case (ps)
129
 
130
      IDLE :
131
        begin
132
           if (joint_flush_in | joint_buffer_small)
133
         ns = FLUSH;
134
           else if (joint_ready_out & joint_ready_in & outs_empty)
135
         ns = READY;
136
           else if (joint_ready_out)
137
         begin
138
            joint_wait = 1'b1;
139
            ns = READY_OUT;
140
         end
141
           else if (fifo_not_ready & joint_ready_in & outs_empty)
142
         if (WRITE)
143
           begin
144
              joint_line_req = 1'b1; //from write to read - fill fifo at begining
145
              ns = REQ_LINE;
146
           end
147
         else
148
           begin
149
              joint_burst_req = 1'b1; //from read to write - empty fifo after cross
150
              ns = REQ_LINE; //1 cycle pulse
151
           end
152
           else
153
         ns = IDLE;
154
        end
155
 
156
      REQ_LINE :
157
        begin
158
           if (joint_flush_in)
159
         ns = FLUSH;
160
           else if (joint_line_req_clr)
161
         begin
162
            ns = IDLE;
163
            joint_wait = 1'b0;
164
         end
165
           else
166
         begin
167
            ns = REQ_LINE;
168
            joint_wait = 1'b1;
169
         end
170
        end
171
 
172
      READY_OUT :
173
        begin
174
           joint_wait = 1'b1;
175
 
176
           if (joint_cross | page_cross)
177
         ns = CROSS;
178
           else if ((~joint_ready_out) | joint_flush_in | joint_buffer_small)
179
         ns = FLUSH;
180
           else if (joint_ready_in & outs_empty)
181
         begin
182
            joint_wait = 1'b0;
183
            ns = RECHK;
184
         end
185
           else
186
         ns = READY_OUT;
187
        end
188
 
189
      RECHK :
190
        begin
191
           if (joint_flush_in | joint_buffer_small)
192
         ns = FLUSH;
193
           else if (joint_ready_in & joint_ready_out)
194
         ns = READY;
195
           else if (WRITE)
196
         begin
197
            joint_line_req = 1'b1; //from write to read - read more data when AHB gets out of align address
198
            ns = REQ_LINE;
199
         end
200
           else if (READ)
201
         ns = RECHK;
202
        end
203
 
204
      READY :
205
        begin
206
           if (joint_cross)
207
         begin
208
            joint_wait = 1'b1;
209
            ns = READY_OUT;
210
         end
211
           else if ((~joint_ready_out) | (~joint_ready_in) | ch_end_flush)
212
           ns = FLUSH;
213
           else
214
         ns = READY;
215
        end
216
 
217
      CROSS :
218
        begin
219
           if (joint_buffer_small)
220
         ns = FLUSH;
221
           else if (joint_ready_out & (~joint_cross) & outs_empty)
222
         begin
223
            if (fifo_wr_ready & (fifo_remain <= 'd16)) //rd_gap
224
              begin
225
             joint_burst_req = 1'b1; //from read to write - empty fifo after cross
226
 
227
             if (fifo_remain == 'd0)
228
               ns = BURST_REQ; //2 cycles pulse
229
             else
230
               ns = REQ_LINE; //1 cycle pulse
231
              end
232
            else
233
              ns = IDLE;
234
         end
235
           else
236
         ns = CROSS;
237
        end
238
 
239
      BURST_REQ :
240
        begin
241
           joint_burst_req = 1'b1; //from read to write - empty fifo after cross
242
           ns = REQ_LINE;
243
        end
244
 
245
      FLUSH :
246
        begin
247
           joint_flush = 1'b1;
248
           ns = FLUSH;
249
        end
250
 
251
      default :
252
        ns = IDLE;
253
 
254
    endcase
255
     end
256
 
257
 
258
 
259
   always @(posedge clk or posedge reset)
260
     if (reset)
261
       ps <= #1 IDLE;
262
     else if (joint_update)
263
       ps <= #1 IDLE;
264
     else
265
       ps <= #1 ns;
266
 
267
 
268
endmodule
269
 
270
 
271
 
272
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.