sc_trace_file.hh revision 12905
1712SN/A/* 21762SN/A * Copyright 2018 Google, Inc. 3712SN/A * 4712SN/A * Redistribution and use in source and binary forms, with or without 5712SN/A * modification, are permitted provided that the following conditions are 6712SN/A * met: redistributions of source code must retain the above copyright 7712SN/A * notice, this list of conditions and the following disclaimer; 8712SN/A * redistributions in binary form must reproduce the above copyright 9712SN/A * notice, this list of conditions and the following disclaimer in the 10712SN/A * documentation and/or other materials provided with the distribution; 11712SN/A * neither the name of the copyright holders nor the names of its 12712SN/A * contributors may be used to endorse or promote products derived from 13712SN/A * this software without specific prior written permission. 14712SN/A * 15712SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16712SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17712SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18712SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19712SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20712SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21712SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22712SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23712SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24712SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25712SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26712SN/A * 272665Ssaidi@eecs.umich.edu * Authors: Gabe Black 282665Ssaidi@eecs.umich.edu */ 29712SN/A 30712SN/A#ifndef __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ 311354SN/A#define __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ 321354SN/A 33712SN/A#include <exception> 348706Sandreas.hansson@arm.com 35712SN/A#include "../core/sc_time.hh" 362680Sktlim@umich.edu#include "warn_unimpl.hh" 37712SN/A 38712SN/Anamespace sc_dt 39712SN/A{ 40712SN/A 41712SN/Aclass sc_logic; 42712SN/Aclass sc_int_base; 43712SN/Aclass sc_uint_base; 445191Ssaidi@eecs.umich.educlass sc_signed; 452680Sktlim@umich.educlass sc_unsigned; 46712SN/Aclass sc_bv_base; 475191Ssaidi@eecs.umich.educlass sc_lv_base; 48712SN/Aclass sc_fxval; 49712SN/Aclass sc_fxval_fast; 505191Ssaidi@eecs.umich.educlass sc_fxnum; 515191Ssaidi@eecs.umich.educlass sc_fxnum_fast; 525191Ssaidi@eecs.umich.edu 535191Ssaidi@eecs.umich.edu} // namespace sc_dt 545191Ssaidi@eecs.umich.edu 55712SN/Anamespace sc_core 56712SN/A{ 575191Ssaidi@eecs.umich.edu 585191Ssaidi@eecs.umich.edutemplate <class T> 595191Ssaidi@eecs.umich.educlass sc_signal_in_if; 605191Ssaidi@eecs.umich.edu 615191Ssaidi@eecs.umich.educlass sc_event; 62712SN/Aclass sc_time; 635191Ssaidi@eecs.umich.edu 645191Ssaidi@eecs.umich.educlass sc_trace_file 655191Ssaidi@eecs.umich.edu{ 665191Ssaidi@eecs.umich.edu public: 675191Ssaidi@eecs.umich.edu virtual void set_time_unit(double, sc_time_unit) = 0; 685191Ssaidi@eecs.umich.edu}; 695191Ssaidi@eecs.umich.edu 705191Ssaidi@eecs.umich.edusc_trace_file *sc_create_vcd_trace_file(const char *name); 715191Ssaidi@eecs.umich.eduvoid sc_close_vcd_trace_file(sc_trace_file *tf); 7214020Sgabeblack@google.comvoid sc_write_comment(sc_trace_file *tf, const std::string &comment); 738852Sandreas.hansson@arm.com 745191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const bool &, const std::string &); 755191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const bool *, const std::string &); 765191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const float &, const std::string &); 775191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const float *, const std::string &); 78712SN/Avoid sc_trace(sc_trace_file *, const double &, const std::string &); 79712SN/Avoid sc_trace(sc_trace_file *, const double *, const std::string &); 80712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &); 81712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &); 825191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base &, 835191Ssaidi@eecs.umich.edu const std::string &); 84712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_int_base *, 855191Ssaidi@eecs.umich.edu const std::string &); 86712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &, 87712SN/A const std::string &); 885191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *, 895191Ssaidi@eecs.umich.edu const std::string &); 90712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &); 91712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &); 925191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &, 93712SN/A const std::string &); 94712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *, 95712SN/A const std::string &); 96712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &); 975191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &); 985191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &); 99712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &); 100712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &); 1015191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &); 102712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &, 103712SN/A const std::string &); 104712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *, 105712SN/A const std::string &); 106712SN/Avoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &); 1075191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &); 1085191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &, 109712SN/A const std::string &); 1105191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *, 1115191Ssaidi@eecs.umich.edu const std::string &); 1125191Ssaidi@eecs.umich.edu 113712SN/A 114712SN/A// Nonstandard 115712SN/A// sc_trace overloads for sc_event and sc_time. 116712SN/Avoid sc_trace(sc_trace_file *, const sc_event &, const std::string &); 117712SN/Avoid sc_trace(sc_trace_file *, const sc_event *, const std::string &); 118712SN/Avoid sc_trace(sc_trace_file *, const sc_time &, const std::string &); 1195191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const sc_time *, const std::string &); 120712SN/A 121712SN/A 1225191Ssaidi@eecs.umich.edu// Nonstandard - unsigned versions necessary to avoid ambiguous overload 1235191Ssaidi@eecs.umich.edu// resolution. 124712SN/Avoid sc_trace(sc_trace_file *, const unsigned char &, 1255191Ssaidi@eecs.umich.edu const std::string &, int width=(8 * sizeof(char))); 126712SN/Avoid sc_trace(sc_trace_file *, const unsigned char *, 127712SN/A const std::string &, int width=(8 * sizeof(char))); 1285191Ssaidi@eecs.umich.eduvoid sc_trace(sc_trace_file *, const unsigned short &, 1295191Ssaidi@eecs.umich.edu const std::string &, int width=(8 * sizeof(char))); 130712SN/Avoid sc_trace(sc_trace_file *, const unsigned short *, 1315191Ssaidi@eecs.umich.edu const std::string &, int width=(8 * sizeof(char))); 132712SN/Avoid sc_trace(sc_trace_file *, const unsigned int &, 133712SN/A const std::string &, int width=(8 * sizeof(char))); 134712SN/Avoid sc_trace(sc_trace_file *, const unsigned int *, 1351354SN/A const std::string &, int width=(8 * sizeof(char))); 136void sc_trace(sc_trace_file *, const unsigned long &, 137 const std::string &, int width=(8 * sizeof(char))); 138void sc_trace(sc_trace_file *, const unsigned long *, 139 const std::string &, int width=(8 * sizeof(char))); 140 141void sc_trace(sc_trace_file *, const char &, 142 const std::string &, int width=(8 * sizeof(char))); 143void sc_trace(sc_trace_file *, const char *, 144 const std::string &, int width=(8 * sizeof(char))); 145void sc_trace(sc_trace_file *, const short &, 146 const std::string &, int width=(8 * sizeof(char))); 147void sc_trace(sc_trace_file *, const short *, 148 const std::string &, int width=(8 * sizeof(char))); 149void sc_trace(sc_trace_file *, const int &, 150 const std::string &, int width=(8 * sizeof(char))); 151void sc_trace(sc_trace_file *, const int *, 152 const std::string &, int width=(8 * sizeof(char))); 153void sc_trace(sc_trace_file *, const long &, 154 const std::string &, int width=(8 * sizeof(char))); 155void sc_trace(sc_trace_file *, const long *, 156 const std::string &, int width=(8 * sizeof(char))); 157void sc_trace(sc_trace_file *, const sc_dt::int64 &, 158 const std::string &, int width=(8 * sizeof(char))); 159void sc_trace(sc_trace_file *, const sc_dt::int64 *, 160 const std::string &, int width=(8 * sizeof(char))); 161void sc_trace(sc_trace_file *, const sc_dt::uint64 &, 162 const std::string &, int width=(8 * sizeof(char))); 163void sc_trace(sc_trace_file *, const sc_dt::uint64 *, 164 const std::string &, int width=(8 * sizeof(char))); 165 166// Nonstandard function for enums 167void sc_trace(sc_trace_file *, const unsigned int &, 168 const std::string &, const char **enum_literals); 169 170template <class T> 171void 172sc_trace(sc_trace_file *, const sc_signal_in_if<T> &, const std::string &) 173{ 174 sc_utils_warn_unimpl(__PRETTY_FUNCTION__); 175} 176 177void sc_trace(sc_trace_file *, const sc_signal_in_if<char> &, 178 const std::string &, int width); 179 180void sc_trace(sc_trace_file *, const sc_signal_in_if<short> &, 181 const std::string &, int width); 182 183void sc_trace(sc_trace_file *, const sc_signal_in_if<int> &, 184 const std::string &, int width); 185 186void sc_trace(sc_trace_file *, const sc_signal_in_if<long> &, 187 const std::string &, int width); 188 189} // namespace sc_core 190 191#endif //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ 192