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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_01_01/] [RTL/] [buffers/] [TxFifoBI.v] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// TxfifoBI.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 5 sfielding
// $Id: TxFifoBI.v,v 1.2 2004-12-18 14:36:06 sfielding Exp $
45 2 sfielding
//
46
// CVS Revision History
47
//
48
// $Log: not supported by cvs2svn $
49 5 sfielding
// Revision 1.1.1.1  2004/10/11 04:00:51  sfielding
50
// Created
51 2 sfielding
//
52 5 sfielding
//
53 2 sfielding
 
54
`include "wishBoneBus_h.v"
55
 
56
module TxfifoBI (
57
  address, writeEn, strobe_i,
58
  clk, rst, fifoSelect,
59
  busDataIn,
60
  busDataOut,
61
  fifoWEn,
62
  fifoFull,
63
  forceEmpty,
64
  numElementsInFifo
65
  );
66
input [2:0] address;
67
input writeEn;
68
input strobe_i;
69
input clk;
70
input rst;
71
input [7:0] busDataIn;
72
output [7:0] busDataOut;
73
output fifoWEn;
74
input fifoFull;
75
output forceEmpty;
76
input [15:0] numElementsInFifo;
77
input fifoSelect;
78
 
79
 
80
wire [2:0] address;
81
wire writeEn;
82
wire strobe_i;
83
wire clk;
84
wire rst;
85
wire [7:0] busDataIn;
86
reg [7:0] busDataOut;
87
reg fifoWEn;
88
wire fifoFull;
89
reg forceEmpty;
90
wire [15:0] numElementsInFifo;
91
wire fifoSelect;
92
 
93
 
94
//sync write
95
always @(posedge clk)
96
begin
97 5 sfielding
  if (writeEn == 1'b1 && fifoSelect == 1'b1 &&
98 2 sfielding
  address == `FIFO_CONTROL_REG && strobe_i == 1'b1 && busDataIn[0] == 1'b1)
99
    forceEmpty <= 1'b1;
100
  else
101
    forceEmpty <= 1'b0;
102
end
103
 
104
 
105
// async read mux
106
always @(address or fifoFull or numElementsInFifo)
107
begin
108 5 sfielding
  case (address)
109 2 sfielding
      `FIFO_STATUS_REG : busDataOut <= {7'b0000000, fifoFull};
110
      `FIFO_DATA_COUNT_MSB : busDataOut <= numElementsInFifo[15:8];
111
      `FIFO_DATA_COUNT_LSB : busDataOut <= numElementsInFifo[7:0];
112
      default: busDataOut <= 8'h00;
113 5 sfielding
  endcase
114 2 sfielding
end
115
 
116
//generate fifo write strobe
117
always @(address or writeEn or strobe_i or fifoSelect or busDataIn) begin
118
  if (address == `FIFO_DATA_REG &&   writeEn == 1'b1 &&
119
  strobe_i == 1'b1 &&   fifoSelect == 1'b1)
120
    fifoWEn <= 1'b1;
121
  else
122
    fifoWEn <= 1'b0;
123
end
124
 
125
 
126
endmodule

powered by: WebSVN 2.1.0

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