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

Subversion Repositories robust_axi_fabric

[/] [robust_axi_fabric/] [trunk/] [src/] [base/] [ic_arbiter.v] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eyalhoc
OUTFILE PREFIX_ic_MSTR_SLV_arbiter.v
2
 
3
ITER MX MSTRNUM
4
ITER SX SLVNUM
5
 
6
module PREFIX_ic_MSTR_SLV_arbiter(PORTS);
7
 
8
   input                              clk;
9
   input                              reset;
10
 
11
   input [MSTRNUM-1:0]         M_last;
12
   input [MSTRNUM-1:0]         M_req;
13
   input [MSTRNUM-1:0]         M_grant;
14
 
15
   input [LOG2(SLVNUM)-1:0]            MMX_slave;
16
 
17
   output [MSTRNUM-1:0]        SSX_master;
18
 
19
 
20
 
21
   reg [MSTRNUM:0]                     SSX_master_prio_reg;
22
   wire [MSTRNUM-1:0]                  SSX_master_prio;
23
   reg [MSTRNUM-1:0]                   SSX_master_d;
24
 
25
   wire [MSTRNUM-1:0]                  M_SSX;
26
   wire [MSTRNUM-1:0]                  M_SSX_valid;
27
   wire [MSTRNUM-1:0]                  M_SSX_prio;
28
   reg [MSTRNUM-1:0]                   M_SSX_burst;
29
 
30
 
31
 
32
 
33
   parameter                          MASTER_NONE = BIN(0 MSTRNUM);
34
   parameter                          MASTERMX    = BIN(EXPR(2^MX) MSTRNUM);
35
 
36
 
37
 
38
 
39
IFDEF DEF_PRIO
40
   always @(posedge clk or posedge reset)
41
     if (reset)
42
       begin
43
          SSX_master_prio_reg[MSTRNUM:1] <= #FFD {MSTRNUM{1'b0}};
44
          SSX_master_prio_reg[0]          <= #FFD 1'b1;
45
       end
46
     else if (|(M_req & M_grant & M_last))
47
       begin
48
          SSX_master_prio_reg[MSTRNUM:1] <= #FFD SSX_master_prio_reg[MSTRNUM-1:0];
49
          SSX_master_prio_reg[0]          <= #FFD SSX_master_prio_reg[MSTRNUM-1];
50
       end
51
 
52
   assign SSX_master_prio = SSX_master_prio_reg[MSTRNUM-1:0];
53
 
54
   assign M_SSX_prio      = M_SSX_valid & SSX_master_prio;
55
ENDIF DEF_PRIO
56
 
57
 
58
 
59
   always @(posedge clk or posedge reset)
60
     if (reset)
61
       begin
62
          SSX_master_d <= #FFD {MSTRNUM{1'b0}};
63
       end
64
     else
65
       begin
66
          SSX_master_d <= #FFD SSX_master;
67
       end
68
 
69
   LOOP MX MSTRNUM
70
     always @(posedge clk or posedge reset)
71
       if (reset)
72
         begin
73
            M_SSX_burst[MX] <= #FFD 1'b0;
74
         end
75
       else if (M_req[MX])
76
         begin
77
            M_SSX_burst[MX] <= #FFD SSX_master[MX] & (M_grant[MX] ? (~M_last[MX]) : 1'b1);
78
         end
79
 
80
   ENDLOOP MX
81
 
82
     assign                              M_SSX = {CONCAT(MMX_slave == 'dSX ,)};
83
 
84
   assign                                M_SSX_valid = M_SSX & M_req;
85
 
86
 
87
   LOOP SX SLVNUM
88
     assign                            SSX_master =
89
                                                    M_SSX_burst[MX] ? SSX_master_d :
90
                                       IF DEF_PRIO          M_SSX_prio[MX]  ? MASTERMX :
91
                                                    M_SSX_valid[MX] ? MASTERMX :
92
                                                    MASTER_NONE;
93
 
94
   ENDLOOP SX
95
 
96
     endmodule
97
 

powered by: WebSVN 2.1.0

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