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

Subversion Repositories aemb

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

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

Line No. Rev Author Line
1 118 sybreon
/* $Id: aeMB2_xslif.v,v 1.1 2008-04-18 00:21:52 sybreon Exp $
2
**
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
   reg [31:0]            xwb_dat_o;
69
   reg [31:0]            xwb_mx;
70
   // End of automatics
71
 
72
   reg [3:0]             xSEL;
73
   reg                  xSTB, xTAG, xWRE, xACK;
74
   reg [AEMB_XWB+1:2]   xADR;
75
 
76
   assign               xwb_sel_o = (AEMB_XSL[0]) ? xSEL : 4'hX;
77
   assign               xwb_stb_o = (AEMB_XSL[0]) ? xSTB : 1'b0;
78
   assign               xwb_cyc_o = xwb_stb_o;
79
   assign               xwb_wre_o = (AEMB_XSL[0]) ? xWRE : 1'bX;
80
   assign               xwb_tag_o = (AEMB_XSL[0]) ? xTAG : 1'bX;
81
   assign               xwb_adr_o = (AEMB_XSL[0]) ? xADR :
82
                                    {(AEMB_XWB){1'bX}};
83
 
84
   // ENABLE FEEDBACK
85
   assign               xwb_fb = (!xwb_stb_o | xwb_ack_i | xACK);
86
 
87
   // Independent on pipeline
88
   reg [31:0]            xwb_lat;
89
   always @(posedge gclk)
90
     if (grst) begin
91
        /*AUTORESET*/
92
        // Beginning of autoreset for uninitialized flops
93
        xwb_lat <= 32'h0;
94
        // End of automatics
95
     end else if (xwb_stb_o & (xwb_ack_i | xACK)) begin
96
        // LATCH READS  
97
        xwb_lat <= #1 xwb_dat_i;
98
     end
99
 
100
   // XSEL bus
101
   always @(posedge gclk)
102
     if (grst) begin
103
        /*AUTORESET*/
104
        // Beginning of autoreset for uninitialized flops
105
        xACK <= 1'h0;
106
        xADR <= {(1+(AEMB_XWB+1)-(2)){1'b0}};
107
        xSEL <= 4'h0;
108
        xTAG <= 1'h0;
109
        xWRE <= 1'h0;
110
        xwb_dat_o <= 32'h0;
111
        xwb_mx <= 32'h0;
112
        // End of automatics
113
     end else if (dena) begin // if (grst)      
114
 
115
        xwb_mx <= #1 (xwb_stb_o & (xwb_ack_i | xACK)) ?
116
                  xwb_dat_i : xwb_lat;
117
 
118
        xADR <= #1 imm_of[11:0]; // FSLx 
119
        xWRE <= #1 imm_of[15]; // PUT
120
        xACK <= #1 imm_of[14]; // nGET/nPUT     
121
        xTAG <= #1 imm_of[13]; // cGET/cPUT
122
        xSEL <= #1 4'hF; // 32-bit transfers only
123
 
124
        case (opc_of[1:0])
125
          2'o3: xwb_dat_o <= #1 opa_of;
126
          default: xwb_dat_o <= #1 32'hX;
127
        endcase // case (opc_of[1:0])
128
 
129
     end // if (dena)
130
 
131
   // dislocate from pipeline
132
   always @(posedge gclk)
133
     if (grst) begin
134
        /*AUTORESET*/
135
        // Beginning of autoreset for uninitialized flops
136
        xSTB <= 1'h0;
137
        // End of automatics
138
     end else begin
139
        xSTB <= #1 (dena) ? &{!opc_of[5],opc_of[4:3]} : // GET/PUT
140
                (xSTB & !xwb_ack_i);
141
     end
142
 
143
endmodule // aeMB2_memif
144
 
145
// $Log: not supported by cvs2svn $

powered by: WebSVN 2.1.0

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