Jump to content

beginner problems on fifo waveform

veeresh k

Recommended Posts

Hi ,

I am trying to trace out the wave for the input and the output.

I have tried for different ways,but not getting the desired results.

One of the way was,i created 2 same signals with diff. name in testbench file and tried to trace ,but i was not successful in doing so.

Any suggestions to do? 

Thank you. ?

Ps:- I have attached the code through which m trying to trace.Plz,help me out with this.I have modified the code according to the errors,So thats the reason for using namespace sc::core while declaring fifo tracing input.I am posting full code along with the errors.



testbench.cpp: In function 'int sc_main(int, char**)':
testbench.cpp:16:18: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_in<int>&)'
testbench.cpp:17:19: error: no match for call to '(sc_core::sc_fifo<sc_dt::sc_int<32> >) (sc_core::sc_fifo_out<int>&)'
testbench.cpp:21:29: error: no matching function for call to 'sc_trace(sc_core::sc_trace_file*&, sc_core::sc_fifo_in<int>&, const char [6])'





#ifndef EXAMPLE_H
  #define EXAMPLE_H
using namespace sc_dt;

typedef sc_int<32> sc_int32;

    sc_fifo<sc_int32> fifo;
    //producer thread
    void producer_thread();
    //consumer thread
    void consumer_thread();
    SC_CTOR(example) : fifo(2) {



#include <systemc.h>
#include "example.h"
using namespace sc_dt;

void example::producer_thread()
        int unsigned number_of_accesses = 4;

        for (int i = 0; i < number_of_accesses; i++) {

            sc_int32 value(i);

            cout << "[" << sc_time_stamp() << "] writing to FIFO value: " << value << ", free: " << fifo.num_free() << endl;


            cout << "[" << sc_time_stamp() << "] wrote to FIFO value: " << value << endl;


            wait(1, SC_NS);

    //consumer thread
    void example::consumer_thread()
        sc_int<32> value(0);

        for (;;) {
            wait(4, SC_NS);


            cout << "[" << sc_time_stamp() << "] read from FIFO value: " << value << endl;



#include "systemc.h"
#include "example.h"

using namespace sc_dt;

int sc_main(int, char* []) {
  sc_core::sc_fifo_out<int> output1; 
  sc_core::sc_fifo_in<int> input1; 
   //create the instance of the example
  example eg1("example_inst");
  if(not sc_end_of_simulation_invoked()) {
  return 0;


Link to comment
Share on other sites


you cannot bind interface to e.g. a class implementing those interface. What you can bind are sc_port and sc_export. So you would need to change your declaration to

 sc_core::sc_port< sc_core::sc_fifo_out<int> > output1; 
 sc_core::sc_port< sc_core::sc_fifo_in<int> >  input1; 

But this is not going to solve your problem as you cannot trace an sc_core::sc_fifo_out interface. Tracing is only possible for elements having a value semantic which are variables of various types (primitive ones like int or composed ones coming with the SystemC library like sc_int or sc_bv) and signals (since they have also a value semantic).

interfaces (like are sc_core::sc_fifo_in) are essentially description how to manipulate things and therefore not trace with a tracefile. Using SCV it would be possible to do so but requires implementing some glue code.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...