Jump to content
VanTeo

Help me about "error C2064: term does not evaluate to a function taking 1 arguments"

Recommended Posts

I don't know how to fix this error, help me please

#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "systemc"
using namespace sc_core;
using namespace sc_dt;
using namespace std;

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"
#include "Initiator.h"
#include "Router.h"
#include "Memory.h"

int sc_main(int argc, char* argv[])
{
  Initiator* initiator;
  Router<4>* router;
  Memory*    memory[4];

  initiator = new Initiator("initiator");
  router    = new Router<4>("router");
    for (int i = 0; i < 4; i++)
    {
      char txt[20];
      sprintf(txt, "memory_%d", i);
      memory[i]   = new Memory(txt);
    }

    // Bind sockets
    initiator->socket.bind( router->target_socket );
    for (int i = 0; i < 4; i++) 
		router->initiator_socket[i]->bind( memory[i]->socket );

	sc_time t(100, SC_PS);

  sc_signal<bool> a,b,c;
  sc_signal<int> d;

  initiator->a(a);
  initiator->b(;
  initiator->c(c);

  memory[0]->d(d);

  sc_trace_file *wf= sc_create_vcd_trace_file("and2");
  sc_trace(wf, initiator->a, "a");
  sc_trace(wf, initiator->b, "b");
  sc_trace(wf, initiator->c, "c");
  sc_trace(wf, memory[0]->d, "d");

  a.write(0);
  b.write(0);

  sc_start(t);
  a.write(0);
  b.write(1);

  sc_start(t);
  a.write(1);
  b.write(0);

  sc_start(t);
  a.write(1);
  b.write(1);

  sc_start(t);
  a.write(0);
  b.write(0);

  sc_start(t);
  sc_stop();

  sc_close_vcd_trace_file(wf);
  return 0;
}

it's error in this lines

memory[0]->d(d);
sc_trace(wf, memory[0]->d, "d");

Share this post


Link to post
Share on other sites

Hi Kartik Gurlhosur

thanks your replay but it's not right

c:\users\giahuy\onedrive\tlm\example\routing - copy - copy\routing\routing\main.cpp(44): error C2676: binary '[' : 'sc_core::sc_signal<T>' does not define this operator or a conversion to a type acceptable to the predefined operator
1>          with
1>          [
1>              T=int
1>          ]
1>c:\users\giahuy\onedrive\tlm\example\routing - copy - copy\routing\routing\main.cpp(44): error C2064: term does not evaluate to a function taking 1 arguments
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:06.73
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

help me please

Share this post


Link to post
Share on other sites

Hi Alan,

I have declared 

int d;

i want to show the result of tranfering transaction from initiator to target through "d" variable.

Kartik Gurlhosur helped me add sc_out<int> dummy_port within Memory and connect memory[0]->dummy_port(d[0]) (Similar to memory[1,2,3]), it ran ok

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×