source: trunk/modules/vci_profiler/caba/source/include/vci_profiler.h @ 258

Last change on this file since 258 was 258, checked in by almaless, 12 years ago

Introduce a vci profiler for TSAR direct network

File size: 3.7 KB
Line 
1/* -*- c++ -*-
2 *
3 * SOCLIB_LGPL_HEADER_BEGIN
4 *
5 * This file is part of SoCLib, GNU LGPLv2.1.
6 *
7 * SoCLib is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; version 2.1 of the License.
10 *
11 * SoCLib is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with SoCLib; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 * SOCLIB_LGPL_HEADER_END
22 *
23 * Copyright (c) UPMC, Lip6
24 *         Ghassan Almaless <ghassan.almaless@lip6.fr>, 2011
25 *
26 * Maintainers: Ghassan
27 */
28#ifndef SOCLIB_CABA_VCI_PROFILER_H
29#define SOCLIB_CABA_VCI_PROFILER_H
30
31#include <systemc>
32#include <iostream>
33#include <fstream>
34#include "vci_monitor.h"
35#include "vci_buffers.h"
36#include "caba_base_module.h"
37#include "mapping_table.h"
38//#include "config.h"
39#include "vci_cc_vcache_wrapper2_v1.h"
40
41namespace soclib {
42namespace caba {
43
44template<typename vci_param, typename iss_t>
45class VciProfiler
46        : public soclib::caba::BaseModule
47{
48
49protected:
50        SC_HAS_PROCESS(VciProfiler);
51
52public:
53    sc_core::sc_in<bool> p_resetn;
54    sc_core::sc_in<bool> p_clk;
55    soclib::caba::VciMonitor<vci_param> p_vci;
56
57    VciProfiler(
58              sc_core::sc_module_name insname,
59              size_t index, 
60              size_t x_id,
61              size_t y_id,
62              size_t x_width,
63              size_t y_width,
64              size_t addr_width);
65
66    void print_stats(void);
67    void clear_stats(void);
68    void set_limits(unsigned long limit1, unsigned long limit2);
69    void set_L1_cache(VciCcVCacheWrapper2V1<vci_param, iss_t> *l1);
70    ~VciProfiler();
71
72private:
73
74#define VCI_CMD_NR              4+7      // TODO: define vci_param::CMD_NR
75
76
77    struct cmd_info_s
78    {
79        unsigned long trans;
80        unsigned long cost;
81        unsigned long remote;
82        unsigned long rcost;
83        unsigned long limit1;
84        unsigned long limit2;
85        unsigned long rmax_time;
86        unsigned long rmax_cost;
87        unsigned long raddr;
88        unsigned long lmax_time;
89        unsigned long lmax_cost;
90        unsigned long flits;
91        unsigned long rflits;
92        unsigned long distance;
93        unsigned long max_dist;
94        unsigned long d1_limit;
95        unsigned long d2_limit;
96    } m_cmd_tbl[VCI_CMD_NR]; 
97   
98    unsigned long m_index;
99    unsigned long m_xWidth;
100    unsigned long m_yWidth;
101    unsigned long m_width;
102    long m_x;
103    long m_y;
104    unsigned long m_bits;
105
106    unsigned long m_tm_now;
107    unsigned long m_tm_start;
108    unsigned long m_last_cmd;
109    unsigned long m_last_addr;
110    unsigned long m_limit1;
111    unsigned long m_limit2;
112    unsigned long m_d1_limit;
113    unsigned long m_d2_limit;
114    unsigned long m_period;
115    unsigned long m_threshold;
116    unsigned long m_debug_cntr;
117    bool m_isPending;
118    bool m_isCMDPending;
119    bool m_isPeriod;
120    bool m_isRemote;
121    bool m_isInstruction;
122    bool m_isDebug;
123
124    VciCcVCacheWrapper2V1<vci_param, iss_t> *m_l1;
125
126    unsigned long m_exchange_cntr;
127    unsigned long m_access_cntr;
128    unsigned long m_remote_cntr;
129    unsigned long m_cycles_cntr;
130   
131    //std::ofstream m_log;
132
133    void transition();
134};
135
136}}
137
138#endif /* SOCLIB_CABA_VCI_PROFILER_H */
139
140// Local Variables:
141// tab-width: 4
142// c-basic-offset: 4
143// c-file-offsets:((innamespace . 0)(inline-open . 0))
144// indent-tabs-mode: nil
145// End:
146
147// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
148
Note: See TracBrowser for help on using the repository browser.