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

Subversion Repositories axi_master

[/] [axi_master/] [trunk/] [src/] [base/] [ic_registry_wr.v] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 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
OUTFILE PREFIX_ic_registry_wr.v
31
 
32
ITER MX
33
ITER SX
34
 
35
module PREFIX_ic_registry_wr(PORTS);
36
 
37
 
38
 
39
   input                            clk;
40
   input                            reset;
41
 
42
   port                             MMX_AWGROUP_IC_AXI_CMD;
43
 
44 14 eyalhoc
   input [ID_BITS-1:0]              MMX_WID;
45 2 eyalhoc
   input                            MMX_WVALID;
46
   input                            MMX_WREADY;
47
   input                            MMX_WLAST;
48 14 eyalhoc
   output [SLV_BITS-1:0]            MMX_WSLV;
49 2 eyalhoc
   output                           MMX_WOK;
50
 
51
   input                            SSX_AWVALID;
52
   input                            SSX_AWREADY;
53 14 eyalhoc
   input [MSTR_BITS-1:0]            SSX_AWMSTR;
54 2 eyalhoc
   input                            SSX_WVALID;
55
   input                            SSX_WREADY;
56
   input                            SSX_WLAST;
57
 
58
 
59 14 eyalhoc
   wire                             AWmatch_MMX_IDGROUP_MMX_ID.IDX;
60
   wire                             Wmatch_MMX_IDGROUP_MMX_ID.IDX;
61 2 eyalhoc
 
62
   wire                             cmd_push_MMX;
63 14 eyalhoc
   wire                             cmd_push_MMX_IDGROUP_MMX_ID.IDX;
64 2 eyalhoc
 
65
   wire                             cmd_pop_MMX;
66 14 eyalhoc
   wire                             cmd_pop_MMX_IDGROUP_MMX_ID.IDX;
67 2 eyalhoc
 
68 18 eyalhoc
   wire                             slave_empty_MMX;
69 14 eyalhoc
   wire [SLV_BITS-1:0]              slave_in_MMX_IDGROUP_MMX_ID.IDX;
70
   wire [SLV_BITS-1:0]              slave_out_MMX_IDGROUP_MMX_ID.IDX;
71
   wire                             slave_empty_MMX_IDGROUP_MMX_ID.IDX;
72
   wire                             slave_full_MMX_IDGROUP_MMX_ID.IDX;
73 2 eyalhoc
 
74
   wire                             cmd_push_SSX;
75
   wire                             cmd_pop_SSX;
76 14 eyalhoc
   wire [MSTR_BITS-1:0]             master_in_SSX;
77
   wire [MSTR_BITS-1:0]             master_out_SSX;
78 2 eyalhoc
   wire                             master_empty_SSX;
79
   wire                             master_full_SSX;
80
 
81 14 eyalhoc
   reg [SLV_BITS-1:0]               MMX_WSLV;
82 2 eyalhoc
   reg                              MMX_WOK;
83
 
84 18 eyalhoc
   reg                              MMX_pending;
85
   reg                              MMX_pending_d;
86
   wire                             MMX_pending_rise;
87 19 eyalhoc
   reg                              SSX_pending;
88
   reg                              SSX_pending_d;
89
   wire                             SSX_pending_rise;
90 2 eyalhoc
 
91
 
92
 
93 17 eyalhoc
   assign                           AWmatch_MMX_IDGROUP_MMX_ID.IDX  = MMX_AWID == ID_BITS'bADD_IDGROUP_MMX_ID;
94 2 eyalhoc
 
95 17 eyalhoc
   assign                           Wmatch_MMX_IDGROUP_MMX_ID.IDX   = MMX_WID == ID_BITS'bADD_IDGROUP_MMX_ID;
96 2 eyalhoc
 
97
 
98 18 eyalhoc
   assign                           cmd_push_MMX           = MMX_AWVALID & (MMX_pending ? MMX_pending_rise : MMX_AWREADY);
99 14 eyalhoc
   assign                           cmd_push_MMX_IDGROUP_MMX_ID.IDX = cmd_push_MMX & AWmatch_MMX_IDGROUP_MMX_ID.IDX;
100 2 eyalhoc
   assign                           cmd_pop_MMX            = MMX_WVALID & MMX_WREADY & MMX_WLAST;
101 14 eyalhoc
   assign                           cmd_pop_MMX_IDGROUP_MMX_ID.IDX  = cmd_pop_MMX & Wmatch_MMX_IDGROUP_MMX_ID.IDX;
102 2 eyalhoc
 
103 19 eyalhoc
   assign                           cmd_push_SSX           = SSX_AWVALID & (SSX_pending ? SSX_pending_rise : SSX_AWREADY);
104 2 eyalhoc
   assign                           cmd_pop_SSX            = SSX_WVALID & SSX_WREADY & SSX_WLAST;
105
   assign                           master_in_SSX          = SSX_AWMSTR;
106
 
107 14 eyalhoc
   assign                           slave_in_MMX_IDGROUP_MMX_ID.IDX = MMX_AWSLV;
108 2 eyalhoc
 
109 18 eyalhoc
 
110
   assign                           MMX_pending_rise = MMX_pending & (~MMX_pending_d);
111 19 eyalhoc
   assign                           SSX_pending_rise = SSX_pending & (~SSX_pending_d);
112 2 eyalhoc
 
113 18 eyalhoc
   always @(posedge clk or posedge reset)
114
     if (reset)
115
       begin
116
          MMX_pending   <= #FFD 1'b0;
117
          MMX_pending_d <= #FFD 1'b0;
118 19 eyalhoc
          SSX_pending   <= #FFD 1'b0;
119
          SSX_pending_d <= #FFD 1'b0;
120 18 eyalhoc
       end
121
     else
122
       begin
123
          MMX_pending   <= #FFD MMX_AWVALID & (~MMX_AWREADY);
124
          MMX_pending_d <= #FFD MMX_pending;
125 19 eyalhoc
          SSX_pending   <= #FFD SSX_AWVALID & (~SSX_AWREADY);
126
          SSX_pending_d <= #FFD SSX_pending;
127 18 eyalhoc
       end
128
 
129
 
130 19 eyalhoc
 
131 2 eyalhoc
   LOOP MX
132 14 eyalhoc
   always @(*)
133 2 eyalhoc
     begin
134 17 eyalhoc
        case (MMX_WID)
135
          ID_BITS'bADD_IDGROUP_MMX_ID : MMX_WSLV = slave_out_MMX_IDGROUP_MMX_ID.IDX;
136 2 eyalhoc
          default : MMX_WSLV = SERR;
137
        endcase
138
     end
139
 
140 14 eyalhoc
   always @(*)
141 2 eyalhoc
     begin
142
        case (MMX_WSLV)
143 18 eyalhoc
          SLV_BITS'dSX : MMX_WOK = (master_out_SSX == MSTR_BITS'dMX) & (~slave_empty_MMX);
144 2 eyalhoc
          default : MMX_WOK = 1'b0;
145
        endcase
146
     end
147
 
148
   ENDLOOP MX
149
 
150
LOOP MX
151 18 eyalhoc
  assign slave_empty_MMX = GONCAT(slave_empty_MMX_IDGROUP_MMX_ID.IDX &);
152 14 eyalhoc
 LOOP IX GROUP_MMX_ID.NUM
153 18 eyalhoc
 
154 2 eyalhoc
   prgen_fifo #(SLV_BITS, CMD_DEPTH)
155 14 eyalhoc
   slave_fifo_MMX_IDIX(
156
                       .clk(clk),
157
                       .reset(reset),
158
                       .push(cmd_push_MMX_IDIX),
159
                       .pop(cmd_pop_MMX_IDIX),
160
                       .din(slave_in_MMX_IDIX),
161
                       .dout(slave_out_MMX_IDIX),
162
                       .empty(slave_empty_MMX_IDIX),
163
                       .full(slave_full_MMX_IDIX)
164
                       );
165 2 eyalhoc
 
166 14 eyalhoc
 ENDLOOP IX
167
ENDLOOP MX
168 2 eyalhoc
 
169
 
170
 
171 14 eyalhoc
LOOP SX
172 18 eyalhoc
   prgen_fifo #(MSTR_BITS, SLV_DEPTH)
173 2 eyalhoc
   master_fifo_SSX(
174
                   .clk(clk),
175
                   .reset(reset),
176
                   .push(cmd_push_SSX),
177
                   .pop(cmd_pop_SSX),
178
                   .din(master_in_SSX),
179
                   .dout(master_out_SSX),
180
                   .empty(master_empty_SSX),
181
                   .full(master_full_SSX)
182
                   );
183
 
184 14 eyalhoc
ENDLOOP SX
185 2 eyalhoc
 
186
endmodule
187
 
188
 

powered by: WebSVN 2.1.0

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