sc_trace_file.hh revision 12877
112852Sgabeblack@google.com/*
212852Sgabeblack@google.com * Copyright 2018 Google, Inc.
312852Sgabeblack@google.com *
412852Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
512852Sgabeblack@google.com * modification, are permitted provided that the following conditions are
612852Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
712852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
812852Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
912852Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1012852Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1112852Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1212852Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1312852Sgabeblack@google.com * this software without specific prior written permission.
1412852Sgabeblack@google.com *
1512852Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612852Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712852Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812852Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912852Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012852Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112852Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212852Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312852Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412852Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512852Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612852Sgabeblack@google.com *
2712852Sgabeblack@google.com * Authors: Gabe Black
2812852Sgabeblack@google.com */
2912852Sgabeblack@google.com
3012852Sgabeblack@google.com#ifndef __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
3112852Sgabeblack@google.com#define __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
3212852Sgabeblack@google.com
3312852Sgabeblack@google.com#include <exception>
3412852Sgabeblack@google.com
3512852Sgabeblack@google.com#include "../core/sc_time.hh"
3612852Sgabeblack@google.com#include "warn_unimpl.hh"
3712852Sgabeblack@google.com
3812852Sgabeblack@google.comnamespace sc_dt
3912852Sgabeblack@google.com{
4012852Sgabeblack@google.com
4112852Sgabeblack@google.comclass sc_logic;
4212852Sgabeblack@google.comclass sc_int_base;
4312852Sgabeblack@google.comclass sc_uint_base;
4412852Sgabeblack@google.comclass sc_signed;
4512852Sgabeblack@google.comclass sc_unsigned;
4612852Sgabeblack@google.comclass sc_bv_base;
4712852Sgabeblack@google.comclass sc_lv_base;
4812852Sgabeblack@google.comclass sc_fxval;
4912852Sgabeblack@google.comclass sc_fxval_fast;
5012852Sgabeblack@google.comclass sc_fxnum;
5112852Sgabeblack@google.comclass sc_fxnum_fast;
5212852Sgabeblack@google.com
5312852Sgabeblack@google.com} // namespace sc_dt
5412852Sgabeblack@google.com
5512852Sgabeblack@google.comnamespace sc_core
5612852Sgabeblack@google.com{
5712852Sgabeblack@google.com
5812852Sgabeblack@google.comtemplate <class T>
5912852Sgabeblack@google.comclass sc_signal_in_if;
6012852Sgabeblack@google.com
6112852Sgabeblack@google.comclass sc_trace_file
6212852Sgabeblack@google.com{
6312852Sgabeblack@google.com  public:
6412852Sgabeblack@google.com    virtual void set_time_unit(double, sc_time_unit) = 0;
6512852Sgabeblack@google.com};
6612852Sgabeblack@google.com
6712852Sgabeblack@google.comsc_trace_file *sc_create_vcd_trace_file(const char *name);
6812852Sgabeblack@google.comvoid sc_close_vcd_trace_file(sc_trace_file *tf);
6912852Sgabeblack@google.comvoid sc_write_comment(sc_trace_file *tf, const std::string &comment);
7012852Sgabeblack@google.com
7112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool &, const std::string &);
7212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool *, const std::string &);
7312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float &, const std::string &);
7412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float *, const std::string &);
7512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double &, const std::string &);
7612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double *, const std::string &);
7712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &);
7812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &);
7912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base &,
8012852Sgabeblack@google.com              const std::string &);
8112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base *,
8212852Sgabeblack@google.com              const std::string &);
8312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &,
8412852Sgabeblack@google.com              const std::string &);
8512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *,
8612852Sgabeblack@google.com              const std::string &);
8712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &);
8812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &);
8912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &,
9012852Sgabeblack@google.com              const std::string &);
9112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *,
9212852Sgabeblack@google.com              const std::string &);
9312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &);
9412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &);
9512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &);
9612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &);
9712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &);
9812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &);
9912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &,
10012852Sgabeblack@google.com              const std::string &);
10112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *,
10212852Sgabeblack@google.com              const std::string &);
10312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &);
10412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &);
10512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &,
10612852Sgabeblack@google.com              const std::string &);
10712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *,
10812852Sgabeblack@google.com              const std::string &);
10912852Sgabeblack@google.com
11012877Sgabeblack@google.com
11112877Sgabeblack@google.com// Nonstandard - unsigned versions necessary to avoid ambiguous overload
11212877Sgabeblack@google.com// resolution.
11312877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char &,
11412877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
11512877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char *,
11612877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
11712877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short &,
11812877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
11912877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short *,
12012877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12112877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
12212877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12312877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int *,
12412877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12512877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long &,
12612877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12712877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long *,
12812877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12912877Sgabeblack@google.com
13012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char &,
13112852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char *,
13312852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short &,
13512852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short *,
13712852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int &,
13912852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int *,
14112852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long &,
14312852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long *,
14512852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 &,
14712852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 *,
14912852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 &,
15112852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 *,
15312852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15412852Sgabeblack@google.com
15512877Sgabeblack@google.com// Nonstandard function for enums
15612877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
15712877Sgabeblack@google.com              const std::string &, const char **enum_literals);
15812877Sgabeblack@google.com
15912852Sgabeblack@google.comtemplate <class T>
16012852Sgabeblack@google.comvoid
16112852Sgabeblack@google.comsc_trace(sc_trace_file *, const sc_signal_in_if<T> &, const std::string &)
16212852Sgabeblack@google.com{
16312852Sgabeblack@google.com    sc_utils_warn_unimpl(__PRETTY_FUNCTION__);
16412852Sgabeblack@google.com}
16512852Sgabeblack@google.com
16612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<char> &,
16712852Sgabeblack@google.com              const std::string &, int width);
16812852Sgabeblack@google.com
16912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<short> &,
17012852Sgabeblack@google.com              const std::string &, int width);
17112852Sgabeblack@google.com
17212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<int> &,
17312852Sgabeblack@google.com              const std::string &, int width);
17412852Sgabeblack@google.com
17512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<long> &,
17612852Sgabeblack@google.com              const std::string &, int width);
17712852Sgabeblack@google.com
17812852Sgabeblack@google.com} // namespace sc_core
17912852Sgabeblack@google.com
18012852Sgabeblack@google.com#endif  //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
181