小蜗牛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 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制