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
3712852Sgabeblack@google.comnamespace sc_dt
3812852Sgabeblack@google.com{
3912852Sgabeblack@google.com
4012852Sgabeblack@google.comclass sc_logic;
4112852Sgabeblack@google.comclass sc_int_base;
4212852Sgabeblack@google.comclass sc_uint_base;
4312852Sgabeblack@google.comclass sc_signed;
4412852Sgabeblack@google.comclass sc_unsigned;
4512852Sgabeblack@google.comclass sc_bv_base;
4612852Sgabeblack@google.comclass sc_lv_base;
4712852Sgabeblack@google.comclass sc_fxval;
4812852Sgabeblack@google.comclass sc_fxval_fast;
4912852Sgabeblack@google.comclass sc_fxnum;
5012852Sgabeblack@google.comclass sc_fxnum_fast;
5112852Sgabeblack@google.com
5212852Sgabeblack@google.com} // namespace sc_dt
5312852Sgabeblack@google.com
5412852Sgabeblack@google.comnamespace sc_core
5512852Sgabeblack@google.com{
5612852Sgabeblack@google.com
5712852Sgabeblack@google.comtemplate <class T>
5812852Sgabeblack@google.comclass sc_signal_in_if;
5912852Sgabeblack@google.com
6012905Sgabeblack@google.comclass sc_event;
6112905Sgabeblack@google.comclass sc_time;
6212905Sgabeblack@google.com
6312852Sgabeblack@google.comclass sc_trace_file
6412852Sgabeblack@google.com{
6513245Sgabeblack@google.com  protected:
6613245Sgabeblack@google.com    sc_trace_file();
6713245Sgabeblack@google.com
6812852Sgabeblack@google.com  public:
6913245Sgabeblack@google.com    virtual ~sc_trace_file();
7013245Sgabeblack@google.com
7112852Sgabeblack@google.com    virtual void set_time_unit(double, sc_time_unit) = 0;
7212852Sgabeblack@google.com};
7312852Sgabeblack@google.com
7412852Sgabeblack@google.comsc_trace_file *sc_create_vcd_trace_file(const char *name);
7512852Sgabeblack@google.comvoid sc_close_vcd_trace_file(sc_trace_file *tf);
7612852Sgabeblack@google.comvoid sc_write_comment(sc_trace_file *tf, const std::string &comment);
7712852Sgabeblack@google.com
7812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool &, const std::string &);
7912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool *, const std::string &);
8012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float &, const std::string &);
8112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const float *, const std::string &);
8212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double &, const std::string &);
8312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const double *, const std::string &);
8412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &);
8512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &);
8612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base &,
8712852Sgabeblack@google.com              const std::string &);
8812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base *,
8912852Sgabeblack@google.com              const std::string &);
9012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &,
9112852Sgabeblack@google.com              const std::string &);
9212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *,
9312852Sgabeblack@google.com              const std::string &);
9412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &);
9512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &);
9612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &,
9712852Sgabeblack@google.com              const std::string &);
9812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *,
9912852Sgabeblack@google.com              const std::string &);
10012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &);
10112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &);
10212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &);
10312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &);
10412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &);
10512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &);
10612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &,
10712852Sgabeblack@google.com              const std::string &);
10812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *,
10912852Sgabeblack@google.com              const std::string &);
11012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &);
11112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &);
11212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &,
11312852Sgabeblack@google.com              const std::string &);
11412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *,
11512852Sgabeblack@google.com              const std::string &);
11612852Sgabeblack@google.com
11712877Sgabeblack@google.com
11812905Sgabeblack@google.com// Nonstandard
11912905Sgabeblack@google.com// sc_trace overloads for sc_event and sc_time.
12012905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event &, const std::string &);
12112905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event *, const std::string &);
12212905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time &, const std::string &);
12312905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time *, const std::string &);
12412905Sgabeblack@google.com
12512905Sgabeblack@google.com
12612877Sgabeblack@google.com// Nonstandard - unsigned versions necessary to avoid ambiguous overload
12712877Sgabeblack@google.com// resolution.
12812877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char &,
12913241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned char)));
13012877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char *,
13113241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned char)));
13212877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short &,
13313241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned short)));
13412877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short *,
13513241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned short)));
13612877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
13713241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned int)));
13812877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int *,
13913241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned int)));
14012877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long &,
14113241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned long)));
14212877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long *,
14313241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned long)));
14412877Sgabeblack@google.com
14512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char &,
14612852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char *,
14812852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short &,
15013241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(short)));
15112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short *,
15213241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(short)));
15312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int &,
15413241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(int)));
15512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int *,
15613241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(int)));
15712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long &,
15813241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(long)));
15912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long *,
16013241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(long)));
16112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 &,
16213241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::int64)));
16312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 *,
16413241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::int64)));
16512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 &,
16613241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::uint64)));
16712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 *,
16813241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::uint64)));
16912852Sgabeblack@google.com
17012877Sgabeblack@google.com// Nonstandard function for enums
17112877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
17212877Sgabeblack@google.com              const std::string &, const char **enum_literals);
17312877Sgabeblack@google.com
17412913Sgabeblack@google.com// Deprecated
17512913Sgabeblack@google.comvoid sc_trace_delta_cycles(sc_trace_file *, bool on=true);
17612913Sgabeblack@google.com
17712852Sgabeblack@google.comtemplate <class T>
17812852Sgabeblack@google.comvoid
17913241Sgabeblack@google.comsc_trace(sc_trace_file *tf, const sc_signal_in_if<T> &iface,
18013241Sgabeblack@google.com        const std::string &name)
18112852Sgabeblack@google.com{
18213241Sgabeblack@google.com    sc_trace(tf, iface.read(), name);
18312852Sgabeblack@google.com}
18412852Sgabeblack@google.com
18512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<char> &,
18612852Sgabeblack@google.com              const std::string &, int width);
18712852Sgabeblack@google.com
18812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<short> &,
18912852Sgabeblack@google.com              const std::string &, int width);
19012852Sgabeblack@google.com
19112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<int> &,
19212852Sgabeblack@google.com              const std::string &, int width);
19312852Sgabeblack@google.com
19412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<long> &,
19512852Sgabeblack@google.com              const std::string &, int width);
19612852Sgabeblack@google.com
19712852Sgabeblack@google.com} // namespace sc_core
19812852Sgabeblack@google.com
19912852Sgabeblack@google.com#endif  //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
200