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

Subversion Repositories spimaster

[/] [spimaster/] [trunk/] [RTL/] [sm_RxFifo.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// sm_RxFifo.v                                                  ////
4
////                                                              ////
5
//// This file is part of the spiMaster opencores effort.
6
//// <http://www.opencores.org/cores//>                           ////
7
////                                                              ////
8
//// Module Description:                                          ////
9
////  parameterized RxFifo wrapper. Min depth = 2, Max depth = 65536
10
////  fifo read access via bus interface, fifo write access is direct
11
//// 
12
////                                                              ////
13
//// To Do:                                                       ////
14
//// 
15
////                                                              ////
16
//// Author(s):                                                   ////
17
//// - Steve Fielding, sfielding@base2designs.com                 ////
18
////                                                              ////
19
//////////////////////////////////////////////////////////////////////
20
////                                                              ////
21
//// Copyright (C) 2008 Steve Fielding 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
//
46
`include "timescale.v"
47
 
48
module sm_RxFifo(
49
  busClk,
50
  spiSysClk,
51
  rstSyncToBusClk,
52
  rstSyncToSpiClk,
53
  fifoWEn,
54
  fifoFull,
55
  busAddress,
56
  busWriteEn,
57
  busStrobe_i,
58
  busFifoSelect,
59
  busDataIn,
60
  busDataOut,
61
  fifoDataIn  );
62
  //FIFO_DEPTH = 2^ADDR_WIDTH
63
  parameter FIFO_DEPTH = 64;
64
  parameter ADDR_WIDTH = 6;
65
 
66
input busClk;
67
input spiSysClk;
68
input rstSyncToBusClk;
69
input rstSyncToSpiClk;
70
input fifoWEn;
71
output fifoFull;
72
input [2:0] busAddress;
73
input busWriteEn;
74
input busStrobe_i;
75
input busFifoSelect;
76
input [7:0] busDataIn;
77
output [7:0] busDataOut;
78
input [7:0] fifoDataIn;
79
 
80
wire busClk;
81
wire spiSysClk;
82
wire rstSyncToBusClk;
83
wire rstSyncToSpiClk;
84
wire fifoWEn;
85
wire fifoFull;
86
wire [2:0] busAddress;
87
wire busWriteEn;
88
wire busStrobe_i;
89
wire busFifoSelect;
90
wire [7:0] busDataIn;
91
wire [7:0] busDataOut;
92
wire [7:0] fifoDataIn;
93
 
94
//internal wires and regs
95
wire [7:0] dataFromFifoToBus;
96
wire fifoREn;
97
wire forceEmptySyncToBusClk;
98
wire forceEmptySyncToSpiClk;
99
wire [15:0] numElementsInFifo;
100
wire fifoEmpty;   //not used
101
 
102
sm_fifoRTL #(8, FIFO_DEPTH, ADDR_WIDTH) u_sm_fifo(
103
  .wrClk(spiSysClk),
104
  .rdClk(busClk),
105
  .rstSyncToWrClk(rstSyncToSpiClk),
106
  .rstSyncToRdClk(rstSyncToBusClk),
107
  .dataIn(fifoDataIn),
108
  .dataOut(dataFromFifoToBus),
109
  .fifoWEn(fifoWEn),
110
  .fifoREn(fifoREn),
111
  .fifoFull(fifoFull),
112
  .fifoEmpty(fifoEmpty),
113
  .forceEmptySyncToWrClk(forceEmptySyncToSpiClk),
114
  .forceEmptySyncToRdClk(forceEmptySyncToBusClk),
115
  .numElementsInFifo(numElementsInFifo) );
116
 
117
sm_RxfifoBI u_sm_RxfifoBI(
118
  .address(busAddress),
119
  .writeEn(busWriteEn),
120
  .strobe_i(busStrobe_i),
121
  .busClk(busClk),
122
  .spiSysClk(spiSysClk),
123
  .rstSyncToBusClk(rstSyncToBusClk),
124
  .fifoSelect(busFifoSelect),
125
  .fifoDataIn(dataFromFifoToBus),
126
  .busDataIn(busDataIn),
127
  .busDataOut(busDataOut),
128
  .fifoREn(fifoREn),
129
  .forceEmptySyncToBusClk(forceEmptySyncToBusClk),
130
  .forceEmptySyncToSpiClk(forceEmptySyncToSpiClk),
131
  .numElementsInFifo(numElementsInFifo)
132
  );
133
 
134
endmodule

powered by: WebSVN 2.1.0

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