小蜗牛1990 2015-02-12 17:49 采纳率: 50%
浏览 773

求各位大神解决systemc函数运行时间计算问题

#include "pe.h"

void PE_base::set_xy(int x, int y)
{
assert((x_ == -1) && (y_ == -1)); // set once only
assert((x != -1) && (y != -1)); // must use a legal location

x_ = x;
y_ = y;

}

void PE_base::read_input()
{
r+=1;
packet_in_ = data_in.read();
}

void PE_base::write_output()
{
if (out_queue_.empty())
{
data_out.write(packet());
}
else
{
data_out.write(out_queue_.front());
out_queue_.pop_front();
}
}

void PE_IO::execute()
{
// decide if we are going to fire PI
int r = rand()%100;
if (r < 80)
//a=clock();
fire_PI();
//b=clock();
totaltime=(double)(b-a)/CLOCKS_PER_SEC;
printf("TIME is %d\n",
totaltime);

// fire PO if the incoming packet is valid
if ((packet_in_.src_x != -1)
    && (packet_in_.src_y != -1))
    //a=clock();
    fire_PO();
    //b=clock();
    totaltime=(double)(b-a)/CLOCKS_PER_SEC;
    printf("TIME is %d\n",
    totaltime);

}

void PE_IO::fire_PI()
{

for(int i=1;i<=2;i++){
int P1_x = i, P1_y = 0;
packet p(x_, y_, P1_x, P1_y, rand()%100);
printf("PI: send %d to (%d,%d)\n",
    p.token, p.dest_x, p.dest_y);
out_queue_.push_back(p);
}

}

void PE_IO::fire_PO()
{
assert((packet_in_.src_x != -1)
&& (packet_in_.src_y != -1));

printf("PO: receive %d from (%d,%d)\n",
    packet_in_.token, packet_in_.src_x, packet_in_.src_y);

}

void PE_inc::execute()
{
// fire the actor if the incoming packet is valid
if ((packet_in_.src_x != -1)
&& (packet_in_.src_y != -1))
//a=clock();
fire();
//b=clock();
}

void PE_inc::fire()
{
assert((packet_in_.src_x != -1)
&& (packet_in_.src_y != -1));

int PO_x = 0, PO_y = 0;
packet p(x_, y_, PO_x, PO_y, packet_in_.token+1);

printf("inc(%d,%d): receive %d from (%d,%d), send %d to (%d,%d)\n",
    x_, y_,
    packet_in_.token, packet_in_.src_x, packet_in_.src_y,
    p.token, p.dest_x, p.dest_y);

out_queue_.push_back(p);

}

void PE_incs::execute()
{
// fire the actor if the incoming packet is valid
if ((packet_in_.src_x != -1)
&& (packet_in_.src_y != -1))
//a=clock();
fire();
//b=clock();
}

void PE_incs::fire()
{
assert((packet_in_.src_x != -1)
&& (packet_in_.src_y != -1));

int PO_x = 0, PO_y = 0;
packet p(x_, y_, PO_x, PO_y, packet_in_.token+1);

printf("inc(%d,%d): receive %d from (%d,%d), send %d to (%d,%d)\n",
    x_, y_,
    packet_in_.token, packet_in_.src_x, packet_in_.src_y,
    p.token, p.dest_x, p.dest_y);

out_queue_.push_back(p);

}

希望在execute()中计算fire函数的运行时间,但是报错
../ece587-src/pe.cpp:82: error: no match for call to ‘(sc_core::sc_in) ()’
../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:466: note: candidates are: void sc_core::sc_in::operator()(const sc_core::sc_signal_in_if&)
../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:475: note: void sc_core::sc_in::operator()(sc_core::sc_port, 1, SC_ONE_OR_MORE_BOUND>&)

../systemc-2.2.0/src/sysc/communication/sc_signal_ports.h:484: note: void sc_core::sc_in::operator()(sc_core::sc_port, 1, SC_ONE_OR_MORE_BOUND>&)

求大神解答,对systemc真心不懂

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么