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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_00_01_alpha/] [RTL/] [buffers/] [RxFifoBI.v] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// RxfifoBI.v                                                   ////
4
////                                                              ////
5
//// This file is part of the usbhostslave opencores effort.
6
//// <http://www.opencores.org/cores//>                           ////
7
////                                                              ////
8
//// Module Description:                                          ////
9
//// 
10
////                                                              ////
11
//// To Do:                                                       ////
12
//// 
13
////                                                              ////
14
//// Author(s):                                                   ////
15
//// - Steve Fielding, sfielding@base2designs.com                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE. See the GNU Lesser General Public License for more  ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from <http://www.opencores.org/lgpl.shtml>                   ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// $Id: RxFifoBI.v,v 1.1.1.1 2004-10-11 04:00:51 sfielding Exp $
45
//
46
// CVS Revision History
47
//
48
// $Log: not supported by cvs2svn $
49
//
50
 
51
`include "wishBoneBus_h.v"
52
 
53
module RxfifoBI (
54
  address,
55
  writeEn,
56
  strobe_i,
57
  clk,
58
  rst,
59
  fifoSelect,
60
  fifoDataIn,
61
  busDataIn,
62
  busDataOut,
63
  fifoREn,
64
  fifoEmpty,
65
  forceEmpty,
66
  numElementsInFifo
67
  );
68
input [2:0] address;
69
input writeEn;
70
input strobe_i;
71
input clk;
72
input rst;
73
input [7:0] fifoDataIn;
74
input [7:0] busDataIn;
75
output [7:0] busDataOut;
76
output fifoREn;
77
input fifoEmpty;
78
output forceEmpty;
79
input [15:0] numElementsInFifo;
80
input fifoSelect;
81
 
82
 
83
wire [2:0] address;
84
wire writeEn;
85
wire strobe_i;
86
wire clk;
87
wire rst;
88
wire [7:0] fifoDataIn;
89
wire [7:0] busDataIn;
90
reg [7:0] busDataOut;
91
reg fifoREn;
92
wire fifoEmpty;
93
reg forceEmpty;
94
wire [15:0] numElementsInFifo;
95
wire fifoSelect;
96
 
97
 
98
//sync write
99
always @(posedge clk)
100
begin
101
        if (writeEn == 1'b1 && fifoSelect == 1'b1 &&
102
  address == `FIFO_CONTROL_REG && strobe_i == 1'b1 && busDataIn[0] == 1'b1)
103
    forceEmpty <= 1'b1;
104
  else
105
    forceEmpty <= 1'b0;
106
end
107
 
108
 
109
// async read mux
110
always @(address or fifoDataIn or numElementsInFifo or fifoEmpty)
111
begin
112
        case (address)
113
      `FIFO_DATA_REG : busDataOut <= fifoDataIn;
114
      `FIFO_STATUS_REG : busDataOut <= {7'b0000000, fifoEmpty};
115
      `FIFO_DATA_COUNT_MSB : busDataOut <= numElementsInFifo[15:8];
116
      `FIFO_DATA_COUNT_LSB : busDataOut <= numElementsInFifo[7:0];
117
      default: busDataOut <= 8'h00;
118
        endcase
119
end
120
 
121
//generate fifo read strobe
122
always @(address or writeEn or strobe_i or fifoSelect) begin
123
  if (address == `FIFO_DATA_REG &&   writeEn == 1'b0 &&
124
  strobe_i == 1'b1 &&   fifoSelect == 1'b1)
125
    fifoREn <= 1'b1;
126
  else
127
    fifoREn <= 1'b0;
128
end
129
 
130
 
131
endmodule

powered by: WebSVN 2.1.0

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