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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_00_06_alpha/] [RTL/] [buffers/] [RxFifoBI.v] - Blame information for rev 43

Go to most recent revision | 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
`include "wishBoneBus_h.v"
45
 
46
module RxfifoBI (
47
  address,
48
  writeEn,
49
  strobe_i,
50
  clk,
51
  rst,
52
  fifoSelect,
53
  fifoDataIn,
54
  busDataIn,
55
  busDataOut,
56
  fifoREn,
57
  fifoEmpty,
58
  forceEmpty,
59
  numElementsInFifo
60
  );
61
input [2:0] address;
62
input writeEn;
63
input strobe_i;
64
input clk;
65
input rst;
66
input [7:0] fifoDataIn;
67
input [7:0] busDataIn;
68
output [7:0] busDataOut;
69
output fifoREn;
70
input fifoEmpty;
71
output forceEmpty;
72
input [15:0] numElementsInFifo;
73
input fifoSelect;
74
 
75
 
76
wire [2:0] address;
77
wire writeEn;
78
wire strobe_i;
79
wire clk;
80
wire rst;
81
wire [7:0] fifoDataIn;
82
wire [7:0] busDataIn;
83
reg [7:0] busDataOut;
84
reg fifoREn;
85
wire fifoEmpty;
86
reg forceEmpty;
87
wire [15:0] numElementsInFifo;
88
wire fifoSelect;
89
 
90
 
91
//sync write
92
always @(posedge clk)
93
begin
94 5 sfielding
  if (writeEn == 1'b1 && fifoSelect == 1'b1 &&
95 2 sfielding
  address == `FIFO_CONTROL_REG && strobe_i == 1'b1 && busDataIn[0] == 1'b1)
96
    forceEmpty <= 1'b1;
97
  else
98
    forceEmpty <= 1'b0;
99
end
100
 
101
 
102
// async read mux
103
always @(address or fifoDataIn or numElementsInFifo or fifoEmpty)
104
begin
105 5 sfielding
  case (address)
106 2 sfielding
      `FIFO_DATA_REG : busDataOut <= fifoDataIn;
107
      `FIFO_STATUS_REG : busDataOut <= {7'b0000000, fifoEmpty};
108
      `FIFO_DATA_COUNT_MSB : busDataOut <= numElementsInFifo[15:8];
109
      `FIFO_DATA_COUNT_LSB : busDataOut <= numElementsInFifo[7:0];
110
      default: busDataOut <= 8'h00;
111 5 sfielding
  endcase
112 2 sfielding
end
113
 
114
//generate fifo read strobe
115
always @(address or writeEn or strobe_i or fifoSelect) begin
116
  if (address == `FIFO_DATA_REG &&   writeEn == 1'b0 &&
117
  strobe_i == 1'b1 &&   fifoSelect == 1'b1)
118
    fifoREn <= 1'b1;
119
  else
120
    fifoREn <= 1'b0;
121
end
122
 
123
 
124
endmodule

powered by: WebSVN 2.1.0

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