Jump to content

Roman Popov

  • Content count

  • Joined

  • Last visited

  • Days Won


Roman Popov last won the day on June 15

Roman Popov had the most liked content!


About Roman Popov

  • Rank
    Advanced Member

Recent Profile Visitors

841 profile views
  1. Roman Popov

    Graph Generation

    In some cases yes, you can do it by playing with dynamic casts. For example: #include <systemc.h> SC_MODULE(test) { sc_signal <int> xsig{"xsig"}; sc_signal <unsigned> xsig2{"xsig2"}; sc_in <int> xin{"xin"}; sc_out <unsigned> xout{"xout"}; SC_CTOR(test) { xin(xsig); xout(xsig2); } }; int sc_main(int argc, char **argv) { test t0{"t0"}; sc_start(SC_ZERO_TIME); cout << hex; for (auto * obj : t0.get_child_objects()) { cout << obj->kind() << " " << obj->name() << " @ " << obj; if(sc_port_base* port = dynamic_cast<sc_port_base*>(obj)) if (sc_prim_channel * chan = dynamic_cast<sc_prim_channel*>(port->get_interface())) std::cout << " ( binded to " << chan->name() << " @ " << chan << ")"; cout << endl; } return 0; } Possible output: sc_signal t0.xsig @ 0x111f878 sc_signal t0.xsig2 @ 0x111f938 sc_in t0.xin @ 0x111f9e8 ( binded to t0.xsig @ 0x111f878) sc_out t0.xout @ 0x111fa90 ( binded to t0.xsig2 @ 0x111f938) SystemC however does not store information about hierarchical bindings.
  2. Roman Popov

    sc_spawn and anthoer process

    sc_spawn allows to create process during simulation runtime. SC_* macro can be used only at elaboration time. Please read more details in IEEE SystemC standard. Here is small usage example: #define SC_INCLUDE_DYNAMIC_PROCESSES #include <systemc.h> SC_MODULE(spawn_demo) { SC_CTOR(spawn_demo) { SC_THREAD(static_thread); } void static_thread() { sc_spawn_options opts; sc_spawn([&]() { wait(1, SC_NS); cout << "spawned @ " << sc_time_stamp() << "\n"; }, "spawned_thread", &opts); wait(1, SC_NS); cout << "static @ " << sc_time_stamp() << "\n"; } }; int sc_main(int argc, char **argv) { spawn_demo demo0{"demo0"}; sc_start(); return 0; }
  3. Roman Popov

    Implement sc_trace for std::string

    Unfortunately current implementation was not designed to be extensible by user. So you will have to hack SystemC kernel itself. Tracing part is relatively small so it's should not be very hard. Just follow the implementation for existing types. In general however it should be better to redesign tracing API so it will be extensible for user-supplied types. In addition to accepting fixed set of datatypes, it should also accept abstract interfaces that can be implemented by end user. For example: // currently does not exist struct BitVecConvertible { virtual sc_dt::sc_bv_base to_bv() = 0; } sc_trace(sc_trace_file* tf, BitVecConvertible &obj, onst std::string& name); In that case user can trace any type as a bit vector, by implementing an interface or providing a proxy-class.
  4. Roman Popov

    Possible Bug in VCD tracing

    Thanks for reporting! Here is a small reproducer for this bug: #include <systemc> int sc_main(int argc, char ** argv ) { sc_core::sc_trace_file *tf = sc_core::sc_create_vcd_trace_file("vcdtrace"); sc_core::sc_close_vcd_trace_file(tf); return 0; } Probably the easiest way to fix is to do zero check before printing last time stamp.
  5. The problem is that both sockets are binded to same target interface implementation. So: In[0].get_interface() == In[1].get_interface(); When you bind same interface twice to a single port, SystemC considers this a design error. Solution depends on your modeling needs. Usually TLM sockets are connected point-to-point and to model interconnect a separate module that forwards transactions from initiator to targets is created.
  6. You can use sc_vector: sc_vector<tlm_utils::multi_passthrough_initiator_socket<Router, 32, tlm::tlm_base_protocol_types,1,sc_core::SC_ZERO_OR_MORE_BOUND >> Out{"Out", 10};
  7. No, this is not allowed by SystemC LRM "5.3.3 Constraints on usage":
  8. What do you want exactly? Can you use sc_vector<My> that automatically initializes names? Can you concatenate name and ID before module construction? SystemC elaboration relies on the fact that sc_module_name will be constructed before module. This way it can create correct hierarchical names for module fields. Modern way to declare module is like this: struct my_module : sc_module { my_module(sc_module_name) { } }; More compact way is to use SystemC macros: SC_MODULE(my_module) { SC_CTOR(my_module) { } };
  9. Roman Popov

    SC_METHOD Eception

    I mean a small complete code sample I can run on my computer to reproduce the your error.
  10. Roman Popov

    SC_METHOD Eception

    No, I don't see problems in your code. It can be a problem with your visual studio settings, since expection you get comes from vs runtime. Can't help without reproducer.
  11. Roman Popov

    SC_METHOD Eception

    I don't see a problem in a given code sample. Can you provide a small complete reproducer for problem?
  12. Roman Popov

    Passing collected events to sensitive

    You can write function that will add collection of events to sensitivity. You can even overload operator << if that's what you want.
  13. Roman Popov

    Use of callback before_end_of_elaboration

    In a current implementation sc_start() finishes elaboration and starts simulation. You can look into source code for details. But at very high level you can think of sc_start like this: void sc_start() { finish_elaboration(); // complete binding, call before_end_of_elaboration start_simulation(); // start scheduler } I recommend to run sc_start() in debugger step-by-step to understand what happens inside.
  14. Roman Popov

    Use of callback before_end_of_elaboration

    No, changing the structure of design is not possible after elaboration. You can't create signals, ports and modules during simulation. But you can spawn new processes, this is commonly used in verification environments, to model different streams of test stimulus.
  15. Roman Popov

    Using Debug mode.

    I don't know how autotools flow works. But in case you can use CMake, it is very easy to complie in debug mode, just add -DCMAKE_BUILD_TYPE=Debug when generating Makefile. $ mkdir build_debug $ cd build_debug $ cmake ../ -DCMAKE_BUILD_TYPE=Debug $ make -j8 simple_fifo $ gdb ./examples/sysc/simple_fifo/simple_fifo