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

Subversion Repositories noc

[/] [noc/] [src/] [fifo.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 imori
#ifndef FIFO_H
2
#define FIFO_H
3
 
4
#include <systemc>
5
#include "define.h"
6
 
7
using namespace sc_core;
8
using namespace sc_dt;
9
 
10
class virtual_fifo : public sc_module{
11
public :
12
        sc_in<bool>             data_in;                                //Input data port.
13
        sc_out<bool>    data_out;                               //Output data port.
14
 
15
        sc_in<bool>                     write_n;                        //Output data control pin a.
16
        sc_in<bool>                     read_n;                         //Input data control pin.
17
        sc_in<sc_uint<2> >      x_to_fifo_sel;          //Fifo select signal when receive data.
18
        sc_in<sc_uint<2> >      fifo_to_x_sel;          //Fifo select signal when transfer data.
19
 
20
        sc_out<sc_uint<3> >     empty;                          //State of FIFO is full.
21
        sc_out<sc_uint<3> >     full;                           //State of FIFO is empty.
22
 
23
        sc_fifo<bool>   fifo, fifo1, fifo2;
24
 
25
        SC_CTOR(virtual_fifo):fifo(FIFO_DEEP), fifo1(FIFO_DEEP), fifo2(FIFO_DEEP){
26
                SC_THREAD(receive_fifo);
27
                sensitive << write_n.neg();
28
 
29
                SC_THREAD(transfer_fifo);
30
                sensitive << read_n.neg();
31
 
32
                SC_THREAD(full_signal);
33
 
34
                SC_THREAD(empty_signal);
35
        }
36
protected:
37
        sc_event full_alram;
38
        sc_event empty_alram;
39
        void receive_fifo();
40
        void transfer_fifo();
41
        void empty_signal();
42
        void full_signal();
43
};
44
 
45
#endif

powered by: WebSVN 2.1.0

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