Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Guedes's Achievements


Member (1/2)



  1. I think a clear API should be fine, considering that IEEE 1666-2011, 8.1.2 explicitly defines it as a power of 10. Maybe an assert checking if (v % 10 == 0) would be interesting here, with a more direct message about the wrong parameterization. About my specific issue, I will change the code here properly. Thanks.
  2. I think I just found a bug at the file sc_trace_file_base.cpp on version 2.3.2. It was recommended to me to report it here.The problem is at the function set_time_unit, line 193, where you can read that the parameters of the function are v and tu: void sc_trace_file_base::set_time_unit( double v, sc_time_unit tu ) As you can see, there are no restriction for the use of value v. On the code I was working at, the value was 0.5, and that is ok for SystemC 2.3.1a. However, at 2.3.2, any value of v that it is not a multiple of 10 will make the function fail in an internal assertion because trace_unit_fs = v * unit_to_fs(tu): trace_unit_fs = static_cast<unit_type>(v * unit_to_fs(tu)); Then, at the line 213, fs_unit_to_str is called: ss << fs_unit_to_str(trace_unit_fs) And in fs_unit_to_str: it:std::string sc_trace_file_base::fs_unit_to_str(sc_trace_file_base::unit_type tu) { switch (tu) { case UINT64_C(1): return "1 fs"; case UINT64_C(10): return "10 fs"; case UINT64_C(100): return "100 fs"; case UINT64_C(1000): return "1 ps"; case UINT64_C(10000): return "10 ps"; case UINT64_C(100000): return "100 ps"; case UINT64_C(1000000): return "1 ns"; case UINT64_C(10000000): return "10 ns"; case UINT64_C(100000000): return "100 ns"; case UINT64_C(1000000000): return "1 us"; case UINT64_C(10000000000): return "10 us"; case UINT64_C(100000000000): return "100 us"; case UINT64_C(1000000000000): return "1 ms"; case UINT64_C(10000000000000): return "10 ms"; case UINT64_C(100000000000000): return "100 ms"; case UINT64_C(1000000000000000): return "1 sec"; case UINT64_C(10000000000000000): return "10 sec"; case UINT64_C(100000000000000000): return "100 sec"; default: sc_assert(0); return ""; } } If the variable v is different of a multiple of 10, the function fs_unit_to_str will necessarily fail. For v = 0.5, it will always get to the default and sc_assert(0) will be activated. This function should receive the value of unit_to_fs(tu) as a parameter, or change the way this block of code works altogether. Could someone confirm if this is a bug indeed, and propose a fix for that? Thank you very much.
  • Create New...