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

Subversion Repositories robust_axi2apb

[/] [robust_axi2apb/] [trunk/] [src/] [base/] [axi2apb_mux.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 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 4 eyalhoc
 
30 2 eyalhoc
INCLUDE def_axi2apb.txt
31 8 eyalhoc
OUTFILE PREFIX_mux.v
32 2 eyalhoc
 
33
ITER SX
34 8 eyalhoc
module  PREFIX_mux (PORTS);
35 2 eyalhoc
 
36
 
37
   input                      clk;
38
   input                      reset;
39
 
40
   input [ADDR_BITS-1:0]      cmd_addr;
41
 
42
   input                      psel;
43
   output [31:0]              prdata;
44
   output                     pready;
45
   output                     pslverr;
46
 
47
   output                     pselSX;
48
 
49
   input                      preadySX;
50
 
51
   input                      pslverrSX;
52
 
53
   input [31:0]               prdataSX;
54
 
55
 
56
 
57
   parameter                  ADDR_MSB = EXPR(ADDR_BITS-1);
58
   parameter                  ADDR_LSB = EXPR(ADDR_BITS-DEC_BITS);
59
 
60
   reg                        pready;
61
   reg                        pslverr_pre;
62
   reg                        pslverr;
63
   reg [31:0]                 prdata_pre;
64
   reg [31:0]                 prdata;
65
 
66
   reg [SLV_BITS-1:0]         slave_num;
67
 
68
   always @(*)
69
     begin
70
        casex (cmd_addr[ADDR_MSB:ADDR_LSB])
71 8 eyalhoc
          DEC_BITSDEC_ADDRSX : slave_num = SLV_BITS'dSX;
72 2 eyalhoc
 
73
          default : slave_num = SLV_BITS'dSLAVE_NUM; //decode error
74
        endcase
75
     end
76
 
77
   assign                     pselSX = psel & (slave_num == SLV_BITS'dSX);
78
 
79
   always @(*)
80
     begin
81
           case (slave_num)
82
             SLV_BITS'dSX: pready = preadySX;
83
                 default : pready = 1'b1; //decode error
84
           endcase
85
         end
86
 
87
   always @(*)
88
     begin
89
           case (slave_num)
90
             SLV_BITS'dSX: pslverr_pre = pslverrSX;
91
                 default : pslverr_pre = 1'b1; //decode error
92
           endcase
93
         end
94
 
95
   always @(*)
96
     begin
97
           case (slave_num)
98
             SLV_BITS'dSX: prdata_pre = prdataSX;
99
                 default : prdata_pre = {32{1'b0}};
100
           endcase
101
         end
102
 
103
 
104
   always @(posedge clk or posedge reset)
105
     if (reset)
106
           begin
107
         prdata  <= #FFD {32{1'b0}};
108
         pslverr <= #FFD 1'b0;
109
           end
110
         else if (psel & pready)
111
           begin
112
         prdata  <= #FFD prdata_pre;
113
         pslverr <= #FFD pslverr_pre;
114
           end
115
         else if (~psel)
116
           begin
117
         prdata  <= #FFD {32{1'b0}};
118
         pslverr <= #FFD 1'b0;
119
           end
120
 
121
endmodule
122
 
123
 

powered by: WebSVN 2.1.0

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