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

Subversion Repositories noc

[/] [noc/] [trunk/] [core.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 imori
#ifndef CORE_H
2
#define CORE_H
3
 
4
#include <systemc>
5
#include "power_model.h"
6
#include "define.h"
7
#include "packet_header.h"
8
using namespace sc_core;
9
using namespace sc_dt;
10
using namespace std;
11
 
12
extern double ei_energy;
13
extern double oi_energy;
14
 
15
class core : public sc_module{
16
public:
17
        sc_in<bool>             clk;                            //input clock signal.
18
        sc_in<bool>             reset_n;                                //reset signal.
19
 
20
        sc_out<bool>        data_out;           //core input data port.
21
        sc_in<bool>         data_in;            //core output data port.
22
 
23
        //signal associated with FIFO signal.
24
        sc_out<sc_uint<2> > fifo_to_core_sel;   //fifo select signal when receive data.
25
        sc_out<sc_uint<2> > core_to_fifo_sel;   //fifo select signal when transfer data. 
26
        sc_out<bool>        write_n;                    //core output data control pin.
27
        sc_out<bool>        read_n;                             //core input data control pin.
28
        sc_in<sc_uint<3> >  empty;                              //State of FIFO is full.
29
        sc_in<sc_uint<3> >  full;                               //State of FIFO is empty.
30
 
31
        SC_HAS_PROCESS(core);
32
 
33
        core(sc_module_name nm, int id, int column_num, int row_num):sc_module(nm){
34
                core_id = id;
35
                x_num = column_num;
36
                y_num = row_num;
37
 
38
                SC_THREAD(transfer_data);
39
                sensitive << clk.pos() << clk.neg() << reset_n.neg();
40
 
41
                SC_THREAD(receive_data);
42
                sensitive << clk.pos() << clk.neg() << reset_n.neg();
43
 
44
                SC_THREAD(core_handle);
45
                sensitive << clk.pos() << reset_n.neg();
46
        }
47
protected:
48
        sc_uint<8>                      ac;                             //address counter.
49
        sc_uint<6>                      core_id;
50
        sc_uint<6>                      x_num;
51
        sc_uint<6>                      y_num;
52
 
53
        //sc_uint<FIFO_DEEP>    memory[100];
54
        unsigned short          wmemory[100];
55
        unsigned short          rmemory[100];
56
        sc_uint<8>                      raddress;
57
        sc_uint<8>                      waddress;
58
        sc_uint<3>                      sel_fifo;
59
        sc_event                        write_en;
60
        sc_event                        read_en;
61
 
62
        sc_uint<8>                      write_state;
63
        sc_uint<8>                      read_state;
64
        sc_uint<8>                      write_address[3];
65
        sc_uint<8>                      read_address[3];
66
 
67
#ifdef CORE_DEBUG
68
        sc_event                        sc_debug;
69
#endif
70
 
71
        void transfer_data();
72
        void receive_data();
73
        char write_data(sc_uint<3> sel, sc_uint<8> addr);
74
        char read_data(sc_uint<3> sel, sc_uint<8> addr);
75
        void core_handle();
76
};
77
 
78
#endif

powered by: WebSVN 2.1.0

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