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

Subversion Repositories xspi

[/] [xspi/] [trunk/] [rtl/] [xspi/] [xspi_core.v] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3 6 dinesha
////   xSPI Interface Module                                      ////
4 5 dinesha
////                                                              ////
5 6 dinesha
////  This file is part of the xspi project                       ////
6
////  https://opencores.org/projects/xspi                         ////
7 5 dinesha
////                                                              ////
8
////  Description                                                 ////
9 6 dinesha
////  xspi definitions.                                           ////
10 5 dinesha
////                                                              ////
11
////  To Do:                                                      ////
12
////    nothing                                                   ////
13
////                                                              ////
14 6 dinesha
////  Version:                                                    ////
15
////    1.0 - 26th Oct 2019, Initial version                      ////
16 5 dinesha
////  Author(s):                                                  ////
17
////      - Dinesh Annayya, dinesha@opencores.org                 ////
18
////                                                              ////
19
//////////////////////////////////////////////////////////////////////
20
////                                                              ////
21
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
22
////                                                              ////
23
//// This source file may be used and distributed without         ////
24
//// restriction provided that this copyright statement is not    ////
25
//// removed from the file and that any derivative work contains  ////
26
//// the original copyright notice and the associated disclaimer. ////
27
////                                                              ////
28
//// This source file is free software; you can redistribute it   ////
29
//// and/or modify it under the terms of the GNU Lesser General   ////
30
//// Public License as published by the Free Software Foundation; ////
31
//// either version 2.1 of the License, or (at your option) any   ////
32
//// later version.                                               ////
33
////                                                              ////
34
//// This source is distributed in the hope that it will be       ////
35
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
36
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
37
//// PURPOSE.  See the GNU Lesser General Public License for more ////
38
//// details.                                                     ////
39
////                                                              ////
40
//// You should have received a copy of the GNU Lesser General    ////
41
//// Public License along with this source; if not, download it   ////
42
//// from http://www.opencores.org/lgpl.shtml                     ////
43
////                                                              ////
44
//////////////////////////////////////////////////////////////////////
45 6 dinesha
module xspi_core (
46 5 dinesha
 
47 6 dinesha
             clk,
48
             reset_n,
49 5 dinesha
 
50
        // Reg Bus Interface Signal
51
             reg_cs,
52
             reg_wr,
53
             reg_addr,
54
             reg_wdata,
55
             reg_be,
56
 
57
            // Outputs
58
            reg_rdata,
59
            reg_ack,
60
 
61
          // line interface
62 6 dinesha
            sck                ,
63
            so                 ,
64
            si                 ,
65
            cs_n
66 5 dinesha
 
67
           );
68
 
69
input               clk                           ;
70
input               reset_n                       ;
71
 
72
 
73
//---------------------------------
74
// Reg Bus Interface Signal
75
//---------------------------------
76
input               reg_cs                        ;
77
input               reg_wr                        ;
78
input [3:0]         reg_addr                      ;
79
input [31:0]        reg_wdata                     ;
80
input [3:0]         reg_be                        ;
81
 
82
// Outputs
83
output [31:0]       reg_rdata                     ;
84
output              reg_ack                       ;
85
 
86
//-------------------------------------------
87
// Line Interface
88
//-------------------------------------------
89
 
90
output              sck                           ; // clock out
91
output              so                            ; // serial data out
92
input               si                            ; // serial data in
93
output [3:0]        cs_n                          ; // cs_n
94
 
95
//------------------------------------
96
// Wires
97
//------------------------------------
98
 
99
wire [7:0]          byte_in                       ;
100
wire [7:0]          byte_out                      ;
101
 
102
 
103
wire  [1:0]         cfg_tgt_sel                   ;
104
 
105
wire                cfg_op_req                    ; // SPI operation request
106
wire  [1:0]         cfg_op_type                   ; // SPI operation type
107
wire  [1:0]         cfg_transfer_size             ; // SPI transfer size
108
wire  [5:0]         cfg_sck_period                ; // sck clock period
109
wire  [4:0]         cfg_sck_cs_period             ; // cs setup/hold period
110
wire  [7:0]         cfg_cs_byte                   ; // cs bit information
111
wire  [31:0]        cfg_datain                    ; // data for transfer
112
wire  [31:0]        cfg_dataout                   ; // data for received
113
wire                hware_op_done                 ; // operation done
114
 
115
spi_if  u_spi_if
116
          (
117
          . clk                         (clk                          ),
118
          . reset_n                     (reset_n                      ),
119
 
120
           // towards ctrl i/f
121
          . sck_pe                      (sck_pe                       ),
122
          . sck_int                     (sck_int                      ),
123
          . cs_int_n                    (cs_int_n                     ),
124
          . byte_in                     (byte_in                      ),
125
          . load_byte                   (load_byte                    ),
126
          . byte_out                    (byte_out                     ),
127
          . shift_out                   (shift_out                    ),
128
          . shift_in                    (shift_in                     ),
129
 
130
          . cfg_tgt_sel                 (cfg_tgt_sel                  ),
131
 
132
          . sck                         (sck                          ),
133
          . so                          (so                           ),
134
          . si                          (si                           ),
135
          . cs_n                        (cs_n                         )
136
           );
137
 
138
 
139
spi_ctl  u_spi_ctrl
140
       (
141
          . clk                         (clk                          ),
142
          . reset_n                     (reset_n                      ),
143
 
144
          . cfg_op_req                  (cfg_op_req                   ),
145
          . cfg_op_type                 (cfg_op_type                  ),
146
          . cfg_transfer_size           (cfg_transfer_size            ),
147
          . cfg_sck_period              (cfg_sck_period               ),
148
          . cfg_sck_cs_period           (cfg_sck_cs_period            ),
149
          . cfg_cs_byte                 (cfg_cs_byte                  ),
150
          . cfg_datain                  (cfg_datain                   ),
151
          . cfg_dataout                 (cfg_dataout                  ),
152
          . op_done                     (hware_op_done                ),
153
 
154
          . sck_int                     (sck_int                      ),
155
          . cs_int_n                    (cs_int_n                     ),
156
          . sck_pe                      (sck_pe                       ),
157
          . sck_ne                      (sck_ne                       ),
158
          . shift_out                   (shift_out                    ),
159
          . shift_in                    (shift_in                     ),
160
          . load_byte                   (load_byte                    ),
161
          . byte_out                    (byte_out                     ),
162
          . byte_in                     (byte_in                      )
163
 
164
         );
165
 
166
 
167
 
168
 
169
spi_cfg u_cfg (
170
 
171
          . mclk                        (clk                          ),
172
          . reset_n                     (reset_n                      ),
173
 
174
        // Reg Bus Interface Signal
175
          . reg_cs                      (reg_cs                       ),
176
          . reg_wr                      (reg_wr                       ),
177
          . reg_addr                    (reg_addr                     ),
178
          . reg_wdata                   (reg_wdata                    ),
179
          . reg_be                      (reg_be                       ),
180
 
181
            // Outputs
182
          . reg_rdata                   (reg_rdata                    ),
183
          . reg_ack                     (reg_ack                      ),
184
 
185
 
186
           // configuration signal
187
          . cfg_tgt_sel                 (cfg_tgt_sel                  ),
188
          . cfg_op_req                  (cfg_op_req                   ), // SPI operation request
189
          . cfg_op_type                 (cfg_op_type                  ), // SPI operation type
190
          . cfg_transfer_size           (cfg_transfer_size            ), // SPI transfer size
191
          . cfg_sck_period              (cfg_sck_period               ), // sck clock period
192
          . cfg_sck_cs_period           (cfg_sck_cs_period            ), // cs setup/hold period
193
          . cfg_cs_byte                 (cfg_cs_byte                  ), // cs bit information
194
          . cfg_datain                  (cfg_datain                   ), // data for transfer
195
          . cfg_dataout                 (cfg_dataout                  ), // data for received
196
          . hware_op_done               (hware_op_done                )  // operation done
197
 
198
        );
199
 
200
endmodule

powered by: WebSVN 2.1.0

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