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

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [usb_fifo128x8.h] - Blame information for rev 15

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

Line No. Rev Author Line
1 2 alfoltran
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  USB FIFO                                                   ////
4
////                                                             ////
5
////  SystemC Version: usb_fifo128x8.h                           ////
6
////  Author: Alfredo Luiz Foltran Fialho                        ////
7
////          alfoltran@ig.com.br                                ////
8
////                                                             ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Verilog Version: generic_fifo_sc_a.v                        ////
13
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
14
////                         www.asics.ws                        ////
15
////                         rudi@asics.ws                       ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
#ifndef USB_FIFO128X8_H
39
#define USB_FIFO128X8_H
40
 
41
#include "usb_ram128x8.h"
42
 
43
#define FIFO_ASYNC_RESET
44
//#define FIFO_ASYNC_RESET << rst.neg()
45
 
46
SC_MODULE(usb_fifo128x8) {
47
 
48
  private:
49
 
50
        sc_signal<bool> vcc;
51
 
52
  public:
53
 
54
        sc_in<bool>                     clk;
55
        sc_in<bool>                     rst;
56
        sc_in<bool>                     clr;
57
        sc_in<bool>                     we;
58
        sc_in<sc_uint<8> >      din;
59
        sc_in<bool>                     re;
60
        sc_out<sc_uint<8> >     dout;
61
        sc_out<bool>            empty;
62
        sc_out<bool>            full;
63
 
64
        sc_signal<sc_uint<7> >  wp, wp_pl1, wp_pl2;
65
        sc_signal<sc_uint<7> >  rp, rp_pl1;
66
        sc_signal<bool>                 gb, n_rst;
67
 
68
        usb_ram128x8    *i_ram;
69
 
70
        void write_pointer_update(void);
71
        void read_pointer_update(void);
72
        void future_pointers_update(void);
73
        void fe_gb_update(void);
74
        void fe_full_update(void);
75
        void fe_empty_update(void);
76
        void reset_update(void);
77
//      ~usb_fifo128x8(void);
78
 
79
        SC_CTOR(usb_fifo128x8) {
80
                vcc.write(true);
81
 
82
                SC_METHOD(write_pointer_update);
83
                sensitive << clk.pos() FIFO_ASYNC_RESET;
84
                SC_METHOD(read_pointer_update);
85
                sensitive << clk.pos() FIFO_ASYNC_RESET;
86
                SC_METHOD(future_pointers_update);
87
                sensitive << wp << rp;
88
                SC_METHOD(fe_gb_update);
89
                sensitive << clk.pos() FIFO_ASYNC_RESET;
90
                SC_METHOD(fe_full_update);
91
                sensitive << clk.pos() FIFO_ASYNC_RESET;
92
                SC_METHOD(fe_empty_update);
93
                sensitive << clk.pos() FIFO_ASYNC_RESET;
94
                SC_METHOD(reset_update);
95
                sensitive << rst;
96
 
97
                i_ram = new usb_ram128x8("RAM128X8");
98
                i_ram->rclk(clk);
99
                i_ram->rrst(n_rst);
100
                i_ram->rce(vcc);
101
                i_ram->oe(vcc);
102
                i_ram->raddr(rp);
103
                i_ram->dout(dout);
104
                i_ram->wclk(clk);
105
                i_ram->wrst(n_rst);
106
                i_ram->wce(vcc);
107
                i_ram->we(we);
108
                i_ram->waddr(wp);
109
                i_ram->din(din);
110
        }
111
 
112
};
113
 
114
#endif
115
 

powered by: WebSVN 2.1.0

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