微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > 微电子学习交流 > linux平台下SystemC程序

linux平台下SystemC程序

时间:12-12 整理:3721RD 点击:
各位大侠好,现请教一个SystemC程序移植到linux遇到的问题。
在代码里声明了一个数组 int rec[97][97],用下面循环对其赋值
for(int i=0;i<15;i++)        
    for(int j=0;j<15;j++)
    {                      
           rec[i][j] = 80 ;        
     }
当i=9,j=0时候出现了Program received signal SIGSEGV, Segmentation fault的error。
百思不得其解,此程序在window平台可以跑通的。
堆栈的设置都为100000000.
求问可能出现的问题在哪?

97*97*4  大概是40K的字节,在栈里面分配 不太合适吧。递归调用几次就废了。能不能改成 static 变量。

你的堆栈设置很可能是无效的,较大概率是堆栈溢出,这些代码本身没有问题。

我是用ulimit -s 100000000 来设置的,有什么其他方式来设置么。。。
不好意思,我是第一次做linux下程序编译调试的,所以gcc gdb什么的都不太会。
想快速的把这个搞定,然后在去学习下gdb调试

Systemc的堆栈大小不是这么设置的
有专门的命令
你可以看一下systemc的白皮书

恩,谢谢。
  在systemc里设置? 找了白皮书,user guaid都没找到堆栈设置的有关信息
  倒是在g++编译链接时候加了个命令选项 --mstack-size 1000000,但也依然出现上述问题。

void set_stack_size( size_t );
This subclause describes member function set_stack_size of class sc_module, which sets the stack size of an unspawned process instance during initialization. The stack size of a spawned process is set by the member function set_stack_size of class sc_spawn_options (see 5.5).
An application may call member function set_stack_size to request a change to the size of the execution stack for the thread or clocked thread process instance for which the function is called. The effect of this function is implementation-defined.
set_stack_size shall only be called in the body of the constructor, in the before_end_of_elaboration or end_of_elaboration callbacks of a module, or in a member function called from the constructor or callback, and only after having created an unspawned process instance within that same constructor or callback. It
shall be an error to call set_stack_size at other times or to call set_stack_size for a method process instance.
The order of execution of the statements within the body of the constructor or the before_end_of_elaboration or end_of_elaboration callbacks is used to associate the call to set_stack_size with a particular unspawned process instance; it is associated with the most recently created unspawned process instance.

如果有core dump用gdb看一下, list, bt之类的
上网搜gdb core debug.
.37

谢谢,有心了。
用了三种方式来改变堆栈
1) ulimit -s 10000000;
2)gcc编译链接时加了链接参数 LDFLAGS = mstack-size 10000000;
3)在sc_module里的thread函数里调用了set_stack_size(10000000)函数;
但都行不通

不是在thread里面设置的

写错了,是在SC_CTOR里面调用的

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top