Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all 595 articles
Browse latest View live

sc_port get_interface() method

$
0
0

Hello

 

1. In IEEE doc @112, I see the following

Because the time at which deferred port binding is completed is implementation defined, it is implementation defined whether get_interface returns a pointer to a channel or a null pointer.

 

So where I shoudl check whether the port is bounded or not and accordingly take action so that my code works fine with all implementations.

 

2. For a multiport how to get all interfaces connected to that port. The get_interface returns only the pointer to first channel instance

 

Thanks

RJ


quickthreads vs fibers (linux vs windows) performace

$
0
0

I've noticed that SystemC uses different thread libraries depending on OS: quickthreads on linux and fibers on Windows. Which one is faster? Did someone benchmarked wait-heavy SystemC simulations on Windows and Linux?

 

Compiling SystemC 2.3.1 on Fedora 23

$
0
0

Hello!

 

I'm currently trying to compile SystemC 2.3.1 on Fedora 23. My basic procedure is: First, invoke ./configure, then make. Unfortunately, I run into an error there, for which I cannot find any useful help online:

Making all in docs
make[1]: Entering directory '/home/joe/Documents/systemc-2.3.1/objdir/docs'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/joe/Documents/systemc-2.3.1/objdir/docs'
Making all in src
make[1]: Entering directory '/home/joe/Documents/systemc-2.3.1/objdir/src'
Making all in sysc
make[2]: Entering directory '/home/joe/Documents/systemc-2.3.1/objdir/src/sysc'
Making all in kernel
make[3]: Entering directory '/home/joe/Documents/systemc-2.3.1/objdir/src/sysc/kernel'
  CXX    sc_attribute.lo
libtool: compile: Failed to create `.libs'
Makefile:548: recipe for target 'sc_attribute.lo' failed
make[3]: *** [sc_attribute.lo] Error 1
make[3]: Leaving directory '/home/joe/Documents/systemc-2.3.1/objdir/src/sysc/kernel'
Makefile:572: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/joe/Documents/systemc-2.3.1/objdir/src/sysc'
Makefile:422: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/joe/Documents/systemc-2.3.1/objdir/src'
Makefile:434: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

My initial guess is that it's a compiler issue. I'm using gcc 5.3.1. Are there any known issues related to that version?

 

I would be very glad for some help! Thank you very much for your assistance in advance!

Problem with the case statement

$
0
0

Hello there, 

Am trying to implement binary to gray converter using simple case statements. When I try to execute, only the first statement of the switch case is being executed. 

 

Here's my gtb.cpp and driver module

 

// driver.cpp
 
#include "driver.h"
 
void driver::proc_driver() 
{
 
 
 
 
while(1)
{
 
d_bin = 0;
wait(5, SC_NS); 
 
 
d_bin = 4;
wait(5, SC_NS);
 
 
 
 
 
}
}
 
#include"gtb.h"
 
void gtb::proc_graytobinary() {
 
 
 
 
switch(bin.read())
{
case 0 : grayout = 0; break; 
case 1 : grayout = 1; break;
default: grayout = 2; break;
 
 
 
}
 
 
}
 
Please help me solve this issue. 
 
Thanks in advance :)
 
 

Dynamic communication path in SystemC/TLM

$
0
0

Hi,

 

To create a dynamic process we have to use sc_spawn function, I want to know if it is possible to create a dynamic port ? else, how we can create a dynamic communication path between two components ?

 

Thanks

Ted

-D_GLIBCXX_DEBUG makes systemc-2.3.0 crash

$
0
0

Hi,

 

Sorry for posting that here as I guess this is not the usual bug report tool, and also sorry if this is a duplicate. I have tried to look for this issue on the forum, but could not find.

 

Environment:

I am using systemc proof of concept downloaded from accelera, version 2.3.0. The bug appears on cygwin/g++5.3.0 and also on linux centOS/g++4.7.3.

 

Issue :

When compiling with flag -D_GLIBCXX_DEBUG, the program will crash with a core dump when systemc is not compiled in debug mode. When compiled in debug mode, the program will crash with an error message "Error: (E513) an sc_module_name parameter for your constructor is required". When the program is compiled WITHOUT the -D_GLIBCXX_DEBUG flag, everything goes fine.

 

Testcase :

This can be seen with the example coming with the proof of concept. I tested it on on simple_fifo.

 

Note :

- I also tried to compile the systemc sources with the option -D_GLIBCXX_DEBUG, but it led to a segmentation fault when running the example.

- I did not check the issue against v2.3.1, but could not find the release notes (and thus I don't know if it's a known issue).

 

Can someone tell me if this is a real bug ?

 

sc_signal & Operator

$
0
0

Hi,

 

I want to pass a sc_signal (the reference of one) of any type to a class as a CTOR-argument. Since i found out, that the &-Operator of the class sc_signal<T> is overloaded, so i don't get the reference of an sc_signal<T> object but instead i get a reference to an Object of type T.

How am i supposed to pass an sc_signal<T> to a function or a class?

 

Example-Code:

#include <systemc.h>

template<typename T>
class TInput{
public:
	typedef sc_signal<T> &TMember;
	TInput(TMember member):member(member){}
	// some functions which use member
private:
	TMember 	member;
};

int sc_main(int argc, char** argv){
	sc_signal<sc_uint<12> >    signal1("signal1");
	TInput<sc_uint<12> >       input(signal1);       // here is the problem, because &signal1 does not return 
	return 0;                                        // its own reference but a const reference to its member
                                                         // so the compiler is telling me, that i want to call a function which does not exist
}

here is a link to sc_signal class of systemc lysium documentation http://www.iro.umontreal.ca/~lablasso/docs/SystemC2.0.1/html/classsc__signal.html

especially this function            operator const T & () const

 

its implementation (of sc_logic) can be found under following link: http://www.lysium.de/docs/systemc-2.2/docs/html/sc__signal_8h-source.html

00132     operator const T& () const
00133     { return read(); } 
00113     // read the current value
00114     virtual const T& read() const
00115     { return m_cur_val; }
00648     sc_dt::sc_logic   m_cur_val;         // current value of object.

I hope there is any solution to my problem and thanks in advance.

sc_fxnum_observer

$
0
0

Hi,

 

Can someone show me how to use sc_fxnum_observer class to watch for saturation, roll over etc in objects like sc_fixed?

 

Thanks,

Sam


How can I derive a SystemC class from another SystemC class?

$
0
0

Is it possible to define a SC class as a derivative of another SC class?

For example, a simple D-Flipflop (latch) implementation will have d and clk inputs and a q output. I want to define an Enabled-Latch on top of that class adding the en input and changing the sampling method accordingly. Is this possible?

 

(For reference, question also posted in http://stackoverflow.com/q/37127066/274579but no replies yet)

Where are code examples from "System Design with SystemC" book?

$
0
0

Can someone please point to where I could find the example code from the book "System Design with SystemC"  by Thorsten Grötker , Stan Liao et al

Kluwer, 2002? 

 

This book mentions the example code is available for download on www.systemc.org.  But this link routes to accellera.org and I was not able to find it. 

 

 

Process doesn't get triggered

$
0
0

Hello,
I simply don't get why the process axi_run() doesn't get triggered a second time. Here are all relevant(hopefully) code snippets:

template<class T, unsigned int BUSWIDTH>
tlm::tlm_sync_enum adc_slave<T, BUSWIDTH>::nb_trans(tlm::tlm_generic_payload& gp, tlm::tlm_phase& ph, sc_time& t) {

        assert(ph==tlm::BEGIN_REQ || ph==amba::BEGIN_DATA || ph==amba::BEGIN_DATA);

        if(ph==tlm::BEGIN_REQ) {
                sl_ph = tlm::END_REQ;
                sl_ev1.notify(SC_ZERO_TIME);
                wait(sl_ev2);
                sl_ph = tlm::BEGIN_RESP;
                sl_gp = &gp;

                if(gp.is_read()) {
                        cout<<"notifying sl_ev1"<<endl;
                        sl_ev1.notify(SC_ZERO_TIME);
                        wait(sl_ev2);
                        cout<<"waited for sl_ev2"<<endl;

                        return tlm::TLM_ACCEPTED;
                }
                else
                ....

     }
}

...

template<class T, unsigned int BUSWIDTH>
void adc_slave<T, BUSWIDTH>::axi_run() {

        cout<<"entering..."<<endl;
        if(sl_ph==tlm::END_REQ) {
                cout<<"entering...end_req"<<endl;
                sl_gp->set_response_status(tlm::TLM_OK_RESPONSE);
                retVal = slave_sock->nb_transport_bw(*sl_gp, sl_ph, sl_t);
                assert(retVal==tlm::TLM_UPDATED);
                        sl_ev2.notify(SC_ZERO_TIME);
                cout<<"leaving...end_req"<<endl;
        }
        else if(sl_ph==tlm::BEGIN_RESP) {
                cout<<"entering...end_resp"<<endl;
        ...
        }
....
}

 

template<class T, unsigned int BUSWIDTH>
adc_slave<T, BUSWIDTH>::adc_slave(...)

...

        SC_THREAD(axi_run);
                dont_initialize();
                sensitive<<sl_ev1;
}

...

template<class T, unsigned int BUSWIDTH>
class adc_slave: public sc_module {
...
        public:
               ...
                sc_event sl_ev1, sl_ev2;
               ....

}


If I run my simulation (in which i call nb_transport with a read command), I get as an output:

entering...
entering...end_req
leaving...end_req
notifying sl_ev1

which means the process axi_run() doesn't get triggered a second time. So far there is no logical explanation for me, why this isn't happening. Does anyone have an idea?
Thanks and greetings,
Florian


 

SCBuilder SystemC IDE

$
0
0

Hi all,

I have written a simple Windows SystemC IDE called SCBuilder.

http://www.ht-lab.com/scbuilder.htm

The basic idea is to have a dedicated SystemC IDE which allows the user to create SystemC/SCV/UVM programs with a minimum of fuss. The user can simply drag and drop files into a project and compile/debug/run the program with a click of a button (thanks to the power of CMake). Other features are a build-in VCD viewer and Tcl scripting capability. The compiler is based on the latest tdm-gcc (gcc 5.1.0). Upcoming features are (basic) synthesis and code coverage,

I would appreciate any feedback on this alpha version,

Thanks,
Hans.
www.ht-lab.com

SwitchToFiber called on NULL-pointer

$
0
0

Hello!

I'm using Visual Studio 2015 to simulate my design. When it reaches a
specific size, it throws an exception due to dereferencing a
NULL-pointer inside SwitchToFiber. Is there a way to tweak the settings
somehow, to get around this limitation? Also it would be nice to add
some more asserts to catch the error, when creating the Fiber actually
fails.

 

best regards

Markus

Skipping this library for "sccom-link"

$
0
0

 Hello Sir,

 

I am new to the integration of SystemC and UVM components using UVMC library from Mentor. I have compiled the separate library for uvm and uvmc connect library. But with the same target. Like this:

 

UVM_LIB    = /home/lap2/Desktop/tool/questasim/verilog_src/uvmc-2.3.0/lib/uvmc_lib

UVMC_LIB = /home/lap2/Desktop/tool/questasim/verilog_src/uvmc-2.3.0/lib/uvmc_lib

 

My project directory is work created by default. I found difficulty in while linking the library with the project library.

 

My Makefile is like this:

 

rm -rf work
    vlib work
    vlog -64 -novopt -sv +incdir+$(UVM_HOME)/src -L work $(INC) $(PKG)
    sccom -64 -work work -DSC_INCLUDE_DYNAMIC_PROCESSES -DQUESTA -I$(UVMC_HOME)/src/connect/sc -I$(RTL)   
    sccom -link -DSC_INCLUDE_DYNAMIC_PROCESSES -lib $(UVMC_LIB) -lib work
 

$(RTL) is all .h and .cpp files.

$(INC) and $(PKG) is all .sv files.

 

************************************************************************************************************************************************************

 

While running this, it gives error:

** Warning: (sccom-6197) No object files found for SystemC version 2.3 compiled with gcc-4.7.4 in '/home/lap2/Desktop/tool/questasim/verilog_src/uvmc-2.3.0/lib/uvmc_lib'. Skipping this library for "sccom -link".
** Warning: (sccom-6197) No object files found for SystemC version 2.3 compiled with gcc-4.7.4 in 'work'. Skipping this library for "sccom -link".
** Error: (sccom-6207) No object files found for SystemC version 2.3 with gcc-4.7.4 in any library. Make sure that compilation and linking is being done with correct options.
 

*************************************************************************************************************************************************************

 

From the error it seems like i have missed one step of SystemC library compilation. That i am totally not aware.

Please guide and help me

 

Regards

Sunil S. :(

 

 

Newbie sc_signal<class T> creation problem

$
0
0

Hi,

I'm a newbie with systemc and using it for design.

I want to implement a class representing a generic register file which requires a mandatory parameter NUM_REGS in its constructor.

I want to then contain this register file inside sc_signal<> to allow event handling.

The reg_files header looks something like this (simplified version):

#include<systemc.h>

class reg_file
{
   private:
   sc_uint<8> *reg_set;

   public:
   unsigned REG_NUMS;

   reg_file(const unsigned numberOfRegs)
   {
      REG_NUMS = numberOfRegs;
      reg_set = new sc_uint<8> [REG_NUMS];
   }

   ~reg_file()
   {
      delete reg_set;
   }
}; 

I want to contain the objects of this class in sc_signal by passing numberOfRegs as as a parameter during a creation of the the signal like this:

sc_signal<reg_file> tmr_regs;     // Where to pass numberOfRegs?

Selling tool written in SystemC 2.2.0

$
0
0

Hi everyone,

 

During the past years I've developed a very nice simulator in SystemC 2.2.0 and now, since I've some clients interested in using the tool, I would like to sell it.

 

Basically the idea is to sell the tool as a closed-source object code or, if it is not possible, to sell the source code of the simulator at a given price.

 

Is it possible or there are some limitations with the SystemC license?

 

I've read the license but I didn't found any limitation about "selling the object" or "selling the source code".

 

Thanks in advance

how to get full hierarchical instance name inside systemc module?

$
0
0

Hi,

 

In my design I have one module instantiated 3 level down the hierarchy from sc_main. And I want to get the full hierarchical path inside that module as I have to generate different files based on the full hierarchy path.

 

To do that I have used-

 

sc_module(my_module)

{

 

const char *instance_name;

 

sc_has_process(my_module);

 

my_module(sc_module_name name) : sc_module(name)
{
instance_name = name;
 
 
 
}
 
 
};
 
 
By doing this at "instance_name" I am getting only one level hierarchy, not the full hierarchy. Can you inform me how to get full hierarchy path inside any module?
 
 

Is dynamic and Static process scheduling differs?

$
0
0

Hi All,

 

I have below doubts could you please help;

 

We have two process

1. one with static sensitivity

(a,b,c are input ports)

 

SC_METHOD(P1);

sensitivity<<a<<b<<c;

 

2.second with dynamic sensitivity created using sc_spwan 

 

spawn_opt.spawn_method()

spwan_opt.set_sensitivity(a);

spwan_opt.set_sensitivity( b );

spwan_opt.set_sensitivity©;

sc_scpawn(sc_bind(&p1,this,i),name,&spawn_opt);

 

Here is my doubt ,

1. How does scheduling happens for static and dynamic threads?

2. Is it different for static and dynamic process? I mean is static event gets priority

 

Thanks in advance.

 

Regards,

Pallavi

thread

$
0
0

hi,

 

   In systemc is in possible to invoke the same function using multiple threads ?

like in c++:

 

std::thread th1 (print_block,50,);
std::thread th2 (print_block,50,);

error in systemc.h 118:16 error std::gets is not declared using std::gets

$
0
0

hi ,

I have updated my gcc compiler to 4.9 version . now when I compile my system C model

with g++14 compiler option enabled ,it is giving this error in systemC header file

systemc.h 118:16 error std::gets is not declared using std::gets

 

I was not getting this error earlier . I tried building my systemC library with ./configure CXX=g++-4.9

but the same issue comes up ..

can anyone help in this ??

Viewing all 595 articles
Browse latest View live