sc_trace_file.hh revision 12913
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
6112905Sgabeblack@google.comclass sc_event;
6212905Sgabeblack@google.comclass sc_time;
6312905Sgabeblack@google.com
6412852Sgabeblack@google.comclass sc_trace_file
6512852Sgabeblack@google.com{
6612852Sgabeblack@google.com  public:
6712852Sgabeblack@google.com    virtual void set_time_unit(double, sc_time_unit) = 0;
6812852Sgabeblack@google.com};
6912852Sgabeblack@google.com
7012852Sgabeblack@google.comsc_trace_file *sc_create_vcd_trace_file(const char *name);
7112852Sgabeblack@google.comvoid sc_close_vcd_trace_file(sc_trace_file *tf);
7212852Sgabeblack@google.comvoid sc_write_comment(sc_trace_file *tf, const std::string &comment);
7312852Sgabeblack@google.com
7412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool &, const std::string &);
7512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool *, const std::string &);
7612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float &, const std::string &);
7712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float *, const std::string &);
7812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double &, const std::string &);
7912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double *, const std::string &);
8012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &);
8112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &);
8212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base &,
8312852Sgabeblack@google.com              const std::string &);
8412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base *,
8512852Sgabeblack@google.com              const std::string &);
8612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &,
8712852Sgabeblack@google.com              const std::string &);
8812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *,
8912852Sgabeblack@google.com              const std::string &);
9012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &);
9112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &);
9212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &,
9312852Sgabeblack@google.com              const std::string &);
9412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *,
9512852Sgabeblack@google.com              const std::string &);
9612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &);
9712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &);
9812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &);
9912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &);
10012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &);
10112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &);
10212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &,
10312852Sgabeblack@google.com              const std::string &);
10412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *,
10512852Sgabeblack@google.com              const std::string &);
10612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &);
10712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &);
10812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &,
10912852Sgabeblack@google.com              const std::string &);
11012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *,
11112852Sgabeblack@google.com              const std::string &);
11212852Sgabeblack@google.com
11312877Sgabeblack@google.com
11412905Sgabeblack@google.com// Nonstandard
11512905Sgabeblack@google.com// sc_trace overloads for sc_event and sc_time.
11612905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event &, const std::string &);
11712905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event *, const std::string &);
11812905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time &, const std::string &);
11912905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time *, const std::string &);
12012905Sgabeblack@google.com
12112905Sgabeblack@google.com
12212877Sgabeblack@google.com// Nonstandard - unsigned versions necessary to avoid ambiguous overload
12312877Sgabeblack@google.com// resolution.
12412877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char &,
12512877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12612877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char *,
12712877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
12812877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short &,
12912877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13012877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short *,
13112877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13212877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
13312877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13412877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int *,
13512877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13612877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long &,
13712877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
13812877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long *,
13912877Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14012877Sgabeblack@google.com
14112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char &,
14212852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char *,
14412852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short &,
14612852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short *,
14812852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int &,
15012852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int *,
15212852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long &,
15412852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long *,
15612852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 &,
15812852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 *,
16012852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
16112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 &,
16212852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
16312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 *,
16412852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
16512852Sgabeblack@google.com
16612877Sgabeblack@google.com// Nonstandard function for enums
16712877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
16812877Sgabeblack@google.com              const std::string &, const char **enum_literals);
16912877Sgabeblack@google.com
17012913Sgabeblack@google.com// Deprecated
17112913Sgabeblack@google.comvoid sc_trace_delta_cycles(sc_trace_file *, bool on=true);
17212913Sgabeblack@google.com
17312852Sgabeblack@google.comtemplate <class T>
17412852Sgabeblack@google.comvoid
17512852Sgabeblack@google.comsc_trace(sc_trace_file *, const sc_signal_in_if<T> &, const std::string &)
17612852Sgabeblack@google.com{
17712852Sgabeblack@google.com    sc_utils_warn_unimpl(__PRETTY_FUNCTION__);
17812852Sgabeblack@google.com}
17912852Sgabeblack@google.com
18012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<char> &,
18112852Sgabeblack@google.com              const std::string &, int width);
18212852Sgabeblack@google.com
18312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<short> &,
18412852Sgabeblack@google.com              const std::string &, int width);
18512852Sgabeblack@google.com
18612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<int> &,
18712852Sgabeblack@google.com              const std::string &, int width);
18812852Sgabeblack@google.com
18912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<long> &,
19012852Sgabeblack@google.com              const std::string &, int width);
19112852Sgabeblack@google.com
19212852Sgabeblack@google.com} // namespace sc_core
19312852Sgabeblack@google.com
19412852Sgabeblack@google.com#endif  //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
195