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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [rtl/] [verilog/] [aeMB2_xslif.v] - Blame information for rev 125

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

Line No. Rev Author Line
1 125 sybreon
/* $Id: aeMB2_xslif.v,v 1.3 2008-04-21 12:11:38 sybreon Exp $
2 118 sybreon
**
3
** AEMB2 EDK 6.2 COMPATIBLE CORE
4
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU Lesser General Public License as
10
** published by the Free Software Foundation, either version 3 of the
11
** License, or (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
16
** Public License for more details.
17
**
18
** You should have received a copy of the GNU Lesser General Public
19
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
20
*/
21
 
22
/**
23
 * Accelerator Interface
24
 * @file aeMB2_xslif.v
25
 
26
 * This sets up the Wishbone control signals for the XSEL bus
27
   interfaces. Bus transactions are independent of the pipeline.
28
 
29
 */
30
 
31
module aeMB2_xslif (/*AUTOARG*/
32
   // Outputs
33
   xwb_adr_o, xwb_dat_o, xwb_sel_o, xwb_tag_o, xwb_stb_o, xwb_cyc_o,
34
   xwb_wre_o, xwb_fb, xwb_mx,
35
   // Inputs
36
   xwb_dat_i, xwb_ack_i, imm_of, opc_of, opa_of, gclk, grst, dena,
37
   gpha
38
   );
39
   parameter AEMB_XSL = 1; ///< implement XSEL bus   
40
   parameter AEMB_XWB = 3; ///< XSEL bus width
41
 
42
   // XWB control signals   
43
   output [AEMB_XWB+1:2] xwb_adr_o;
44
   output [31:0]          xwb_dat_o;
45
   output [3:0]   xwb_sel_o;
46
   output                xwb_tag_o;
47
   output                xwb_stb_o,
48
                         xwb_cyc_o,
49
                         xwb_wre_o;
50
   input [31:0]   xwb_dat_i;
51
   input                 xwb_ack_i;
52
 
53
   // INTERNAL
54
   output                xwb_fb;
55
   output [31:0]          xwb_mx;
56
   input [15:0]   imm_of;
57
   input [5:0]            opc_of;
58
   input [31:0]   opa_of;
59
 
60
   // SYS signals
61
   input                 gclk,
62
                         grst,
63
                         dena,
64
                         gpha;
65
 
66
   /*AUTOREG*/
67
   // Beginning of automatic regs (for this module's undeclared outputs)
68 120 sybreon
   reg [AEMB_XWB+1:2]   xwb_adr_o;
69 118 sybreon
   reg [31:0]            xwb_dat_o;
70
   reg [31:0]            xwb_mx;
71 120 sybreon
   reg                  xwb_tag_o;
72
   reg                  xwb_wre_o;
73 118 sybreon
   // End of automatics
74 120 sybreon
 
75 118 sybreon
   // ENABLE FEEDBACK
76 120 sybreon
   assign               xwb_fb = (AEMB_XSL[0]) ?
77
                                 (xwb_stb_o ~^ xwb_ack_i) :
78
                                 1'b1;
79
   // FIXME: perform NGET/NPUT checks
80
 
81 118 sybreon
   // XSEL bus
82
   always @(posedge gclk)
83
     if (grst) begin
84
        /*AUTORESET*/
85
        // Beginning of autoreset for uninitialized flops
86 120 sybreon
        xwb_adr_o <= {(1+(AEMB_XWB+1)-(2)){1'b0}};
87 118 sybreon
        xwb_dat_o <= 32'h0;
88 120 sybreon
        xwb_tag_o <= 1'h0;
89
        xwb_wre_o <= 1'h0;
90 118 sybreon
        // End of automatics
91
     end else if (dena) begin // if (grst)      
92
 
93 120 sybreon
        xwb_adr_o <= #1 (AEMB_XSL[0]) ? imm_of[11:0] : {(AEMB_XWB-2){1'bX}}; // FSLx      
94
        xwb_wre_o <= #1 (AEMB_XSL[0]) ? imm_of[15] : 1'bX; // PUT
95
        xwb_tag_o <= #1 (AEMB_XSL[0]) ? imm_of[13] : 1'bX; // cGET/cPUT  
96 118 sybreon
 
97
        case (opc_of[1:0])
98
          2'o3: xwb_dat_o <= #1 opa_of;
99
          default: xwb_dat_o <= #1 32'hX;
100
        endcase // case (opc_of[1:0])
101
 
102
     end // if (dena)
103
 
104 120 sybreon
   assign xwb_sel_o = (AEMB_XSL[0]) ? 4'hF : 4'hX;
105
 
106
   // Independent on pipeline
107
   reg                  xBLK;
108
   reg                  xSTB;
109
 
110 118 sybreon
   always @(posedge gclk)
111
     if (grst) begin
112
        /*AUTORESET*/
113
        // Beginning of autoreset for uninitialized flops
114 120 sybreon
        xwb_mx <= 32'h0;
115
        // End of automatics
116 125 sybreon
     end else if (xwb_stb_o & (xwb_ack_i | xBLK)) begin
117 120 sybreon
        xwb_mx <= #1 xwb_dat_i;
118
     end
119
 
120
   always @(posedge gclk)
121
     if (grst) begin
122
        /*AUTORESET*/
123
        // Beginning of autoreset for uninitialized flops
124
        xBLK <= 1'h0;
125 118 sybreon
        xSTB <= 1'h0;
126
        // End of automatics
127 120 sybreon
     end else if (xwb_fb) begin
128
        xBLK <= #1 (AEMB_XSL[0]) ? imm_of[14] : 1'b0; // nGET/nPUT       
129 118 sybreon
        xSTB <= #1 (dena) ? &{!opc_of[5],opc_of[4:3]} : // GET/PUT
130 120 sybreon
                     (xwb_stb_o & !xwb_ack_i);
131 118 sybreon
     end
132 120 sybreon
 
133
   assign xwb_cyc_o = xwb_stb_o;
134
   assign xwb_stb_o = (AEMB_XSL[0]) ? xSTB : 1'bX;
135 118 sybreon
 
136 120 sybreon
 
137 118 sybreon
endmodule // aeMB2_memif
138
 
139
// $Log: not supported by cvs2svn $
140 125 sybreon
// Revision 1.2  2008/04/20 16:34:32  sybreon
141
// Basic version with some features left out.
142
//
143 120 sybreon
// Revision 1.1  2008/04/18 00:21:52  sybreon
144
// Initial import.
145
//

powered by: WebSVN 2.1.0

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