Jump to content

Aaron Yang

Members
  • Posts

    7
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Aaron Yang reacted to Roman Popov in How to connect array of ports?   
    Usually you should use sc_vector instead of array. The problem with array is that names of signals and ports in array will be initialized to meaningless values (port_0 ... port_1 ).
    If you still want to use arrays, then bind with a loop.
    Here is example, both for array and sc_vector.
     
    #include <systemc.h> static const int N_PORTS = 4; struct dut : sc_module { sc_in<int> in_array[N_PORTS]; sc_vector<sc_in<int>> in_vector{"in_vector", N_PORTS}; SC_CTOR(dut) {} }; struct test : sc_module { dut d0{"d0"}; sc_signal<int> sig_array[N_PORTS]; sc_vector<sc_signal<int>> sig_vector{"sig_vector", N_PORTS}; SC_CTOR(test) { for (size_t i = 0; i < N_PORTS; ++i) { d0.in_array[i](sig_array[i]); } d0.in_vector(sig_vector); } };  
×
×
  • Create New...