Forums

Downloads

Calendar

Everything posted by Alaba

Hello there,
I'm building a system that includes a large number of resistors. I used sc_vector of elements and nodes, as I increase the number of resistors I get segmentation error.
The below example is a simpler form of my code that also gives the same error
In the code below if I use small value of N:
( N=10000): I get the right result
but for N=1048576: //(large N)
I get: Segmentation fault (core dumped)
------------------------------------------------------resistors in series module----------------
// p- r0-r1-r2-r3...rN -n
static const int N=1048576;
sca_eln::sca_terminal n;
sca_eln::sca_terminal p;
sc_vector< sca_eln::sca_node > c_vec{"c_vec", N }; //nodes beteen resistors
sc_vector<sca_eln::sca_r> rs_vec{"rs_vec", N };
SC_CTOR(rmatnn):
p("p"),n("n") //
{
rs_vec[0].p(p); //connect p port of first resistor to main p port
rs_vec[0].n(c_vec[0]); //connect n port of first resistor to nod 0
rs_vec[0 ].value=10;
for (int i = 1; i < N-1; i++) {
rs_vec[i ].p(c_vec[i-1]);
rs_vec[i ].n(c_vec[i]);
rs_vec[i ].value=10;
}
rs_vec[N-1 ].p(c_vec[N-2]);
rs_vec[N-1 ].n(n);
rs_vec[N-1 ].value=10;
}
};
Is there any limitations on the number of modules we use for the simulation??
Thanks in advance