sc_trace_file.hh revision 13245
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{
6613245Sgabeblack@google.com  protected:
6713245Sgabeblack@google.com    sc_trace_file();
6813245Sgabeblack@google.com
6912852Sgabeblack@google.com  public:
7013245Sgabeblack@google.com    virtual ~sc_trace_file();
7113245Sgabeblack@google.com
7212852Sgabeblack@google.com    virtual void set_time_unit(double, sc_time_unit) = 0;
7312852Sgabeblack@google.com};
7412852Sgabeblack@google.com
7512852Sgabeblack@google.comsc_trace_file *sc_create_vcd_trace_file(const char *name);
7612852Sgabeblack@google.comvoid sc_close_vcd_trace_file(sc_trace_file *tf);
7712852Sgabeblack@google.comvoid sc_write_comment(sc_trace_file *tf, const std::string &comment);
7812852Sgabeblack@google.com
7912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool &, const std::string &);
8012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const bool *, 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 float *, 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 double *, 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_logic *, const std::string &);
8712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base &,
8812852Sgabeblack@google.com              const std::string &);
8912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base *,
9012852Sgabeblack@google.com              const std::string &);
9112852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &,
9212852Sgabeblack@google.com              const std::string &);
9312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *,
9412852Sgabeblack@google.com              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_signed *, const std::string &);
9712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &,
9812852Sgabeblack@google.com              const std::string &);
9912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *,
10012852Sgabeblack@google.com              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_bv_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_lv_base *, 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 *, const std::string &);
10712852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &,
10812852Sgabeblack@google.com              const std::string &);
10912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *,
11012852Sgabeblack@google.com              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 *, const std::string &);
11312852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &,
11412852Sgabeblack@google.com              const std::string &);
11512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *,
11612852Sgabeblack@google.com              const std::string &);
11712852Sgabeblack@google.com
11812877Sgabeblack@google.com
11912905Sgabeblack@google.com// Nonstandard
12012905Sgabeblack@google.com// sc_trace overloads for sc_event and sc_time.
12112905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event &, const std::string &);
12212905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_event *, const std::string &);
12312905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time &, const std::string &);
12412905Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_time *, const std::string &);
12512905Sgabeblack@google.com
12612905Sgabeblack@google.com
12712877Sgabeblack@google.com// Nonstandard - unsigned versions necessary to avoid ambiguous overload
12812877Sgabeblack@google.com// resolution.
12912877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char &,
13013241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned char)));
13112877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned char *,
13213241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned char)));
13312877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short &,
13413241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned short)));
13512877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned short *,
13613241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned short)));
13712877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
13813241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned int)));
13912877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int *,
14013241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned int)));
14112877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long &,
14213241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned long)));
14312877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned long *,
14413241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(unsigned long)));
14512877Sgabeblack@google.com
14612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char &,
14712852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
14812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const char *,
14912852Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(char)));
15012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short &,
15113241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(short)));
15212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const short *,
15313241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(short)));
15412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int &,
15513241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(int)));
15612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const int *,
15713241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(int)));
15812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long &,
15913241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(long)));
16012852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const long *,
16113241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(long)));
16212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 &,
16313241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::int64)));
16412852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::int64 *,
16513241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::int64)));
16612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 &,
16713241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::uint64)));
16812852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_dt::uint64 *,
16913241Sgabeblack@google.com              const std::string &, int width=(8 * sizeof(sc_dt::uint64)));
17012852Sgabeblack@google.com
17112877Sgabeblack@google.com// Nonstandard function for enums
17212877Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const unsigned int &,
17312877Sgabeblack@google.com              const std::string &, const char **enum_literals);
17412877Sgabeblack@google.com
17512913Sgabeblack@google.com// Deprecated
17612913Sgabeblack@google.comvoid sc_trace_delta_cycles(sc_trace_file *, bool on=true);
17712913Sgabeblack@google.com
17812852Sgabeblack@google.comtemplate <class T>
17912852Sgabeblack@google.comvoid
18013241Sgabeblack@google.comsc_trace(sc_trace_file *tf, const sc_signal_in_if<T> &iface,
18113241Sgabeblack@google.com        const std::string &name)
18212852Sgabeblack@google.com{
18313241Sgabeblack@google.com    sc_trace(tf, iface.read(), name);
18412852Sgabeblack@google.com}
18512852Sgabeblack@google.com
18612852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<char> &,
18712852Sgabeblack@google.com              const std::string &, int width);
18812852Sgabeblack@google.com
18912852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<short> &,
19012852Sgabeblack@google.com              const std::string &, int width);
19112852Sgabeblack@google.com
19212852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<int> &,
19312852Sgabeblack@google.com              const std::string &, int width);
19412852Sgabeblack@google.com
19512852Sgabeblack@google.comvoid sc_trace(sc_trace_file *, const sc_signal_in_if<long> &,
19612852Sgabeblack@google.com              const std::string &, int width);
19712852Sgabeblack@google.com
19812852Sgabeblack@google.com} // namespace sc_core
19912852Sgabeblack@google.com
20012852Sgabeblack@google.com#endif  //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__
201