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

Subversion Repositories robust_ahb_matrix

[/] [robust_ahb_matrix/] [trunk/] [src/] [gen/] [prgen_arbiter.v] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 eyalhoc
<##//////////////////////////////////////////////////////////////////
2 2 eyalhoc
////                                                             ////
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 10 eyalhoc
//////////////////////////////////////////////////////////////////##>
29 2 eyalhoc
 
30
OUTFILE prgen_arbiter_MSTR_SLV_MSTRNUM_SLVNUM.v
31
 
32
ITER MX MSTRNUM
33
ITER SX SLVNUM
34
 
35
CHECK CONST(#FFD)       ##flip-flop delay
36
CHECK CONST(PREFIX)     ##flip-flop delay
37
CHECK CONST(MSTR_SLV)   ##arbiter type: mstr or slv
38
CHECK CONST(MSTRNUM)    ##master num
39
CHECK CONST(SLVNUM)     ##slave num
40
 
41
module prgen_arbiter_MSTR_SLV_MSTRNUM_SLVNUM(PORTS);
42
 
43
   input                              clk;
44
   input                              reset;
45
 
46
   input [MSTRNUM-1:0]         M_last;
47
   input [MSTRNUM-1:0]         M_req;
48
   input [MSTRNUM-1:0]         M_grant;
49
 
50
   input [LOG2(SLVNUM)-1:0]            MMX_slave;
51
 
52
   output [MSTRNUM-1:0]        SSX_master;
53
 
54
 
55
 
56
   reg [MSTRNUM:0]                     SSX_master_prio_reg;
57
   wire [MSTRNUM-1:0]                  SSX_master_prio;
58
   reg [MSTRNUM-1:0]                   SSX_master_d;
59
 
60
   wire [MSTRNUM-1:0]                  M_SSX;
61
   wire [MSTRNUM-1:0]                  M_SSX_valid;
62
   wire [MSTRNUM-1:0]                  M_SSX_prio;
63
   reg [MSTRNUM-1:0]                   M_SSX_burst;
64
 
65
 
66
 
67
 
68
   parameter                          MASTER_NONE = BIN(0 MSTRNUM);
69
   parameter                          MASTERMX    = BIN(EXPR(2^MX) MSTRNUM);
70
 
71
 
72
 
73
 
74
IFDEF DEF_PRIO
75
   always @(posedge clk or posedge reset)
76
     if (reset)
77
       begin
78
          SSX_master_prio_reg[MSTRNUM:1] <= #FFD {MSTRNUM{1'b0}};
79
          SSX_master_prio_reg[0]          <= #FFD 1'b1;
80
       end
81
     else if (|(M_req & M_grant & M_last))
82
       begin
83
          SSX_master_prio_reg[MSTRNUM:1] <= #FFD SSX_master_prio_reg[MSTRNUM-1:0];
84
          SSX_master_prio_reg[0]          <= #FFD SSX_master_prio_reg[MSTRNUM-1];
85
       end
86
 
87
   assign SSX_master_prio = SSX_master_prio_reg[MSTRNUM-1:0];
88
 
89
   assign M_SSX_prio      = M_SSX_valid & SSX_master_prio;
90
ENDIF DEF_PRIO
91
 
92
 
93
 
94
   always @(posedge clk or posedge reset)
95
     if (reset)
96
       begin
97
          SSX_master_d <= #FFD {MSTRNUM{1'b0}};
98
       end
99
     else
100
       begin
101
          SSX_master_d <= #FFD SSX_master;
102
       end
103
 
104
   LOOP MX MSTRNUM
105
     always @(posedge clk or posedge reset)
106
       if (reset)
107
         begin
108
            M_SSX_burst[MX] <= #FFD 1'b0;
109
         end
110
       else if (M_req[MX])
111
         begin
112
            M_SSX_burst[MX] <= #FFD SSX_master[MX] & (M_grant[MX] ? (~M_last[MX]) : 1'b1);
113
         end
114
 
115
   ENDLOOP MX
116
 
117
     assign                              M_SSX = {CONCAT(MMX_slave == 'dSX ,)};
118
 
119
   assign                                M_SSX_valid = M_SSX & M_req;
120
 
121
 
122
   LOOP SX SLVNUM
123
     assign                            SSX_master =
124
                                                    |M_SSX_burst ? SSX_master_d :
125
                                       IF DEF_PRIO          M_SSX_prio[MX]  ? MASTERMX :
126
                                                    M_SSX_valid[MX] ? MASTERMX :
127
                                                    MASTER_NONE;
128
 
129
   ENDLOOP SX
130
 
131
     endmodule
132
 

powered by: WebSVN 2.1.0

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