Downloads

Calendar

Everything posted by sonalidutta

Hi,
I want to access the unique process id of a SystemC process P inside process P. Can I do that? If yes, what is the API for that?
The base class for all sc_process is class sc_process_b. sc_method_process and sc_thread_process are derived from it. sc_process class has a public member variable, called proc_id. This denotes the unique id of a process.
My question is how to access this id inside the process itself. For example:
Inside process P:
std::cout << proc_id << std::endl;
does not work!
Thanks
Sonali

In http://www.cs.rice.edu/CS/Verification/Theses/Archive/dtabakov_dissertation2010.pdf:
An assertion is an LTL formula with a set of sampling points that describes a formal property of your SystemC model under verification. In Assertion-based Dynamic Verification of SystemC models, each assertion is converted to a C++ monitor class. A C++ monitor class is just a C++ encoding of a deterministic finite automaton. The transition function of the DFA is encoded as a step() function in the monitor class.
Now the question is when and how frequently to execute the step() function of a monitor class. This is where the sampling points come into the picture. You execute the step() function only when any of the specified set of sampling points occur during your simulation. In the above dissertation, it allows you to sample at different phases of the SystemC kernel, for example: when a new delta cycle begins, when a particular event is notified by the kernel or when a SystemC process suspends. This cannot be done with the unmodified version of the SystemC kernel since all these kernel informations are hidden from the user. So in the above work, the author puts a minimal patch on the SystemC kernel to expose the necessary kernel information.
But this is not mandatory. You can also only sample at different points in your user model. For that you do not need to modify the SystemC kernel. But allowing sampling also at kernel phases adds to the monitoring power. So as a summary, it is not necessary to change the kernel to do assertion-based verification of SystemC. But since in SystemC (unlike SystemVerilog), the kernel plays a very important role in the simulation, if you change the kernel to expose certain information, it might be useful.
Universal Verification Methodology (UVM) is a new "de-facto standard" for verification (based on Accellera's marketing materials) (Primer here: http://www.doulos.com/knowhow/sysverilog/uvm/tutorial_0/). UVM is a base class library for hooking up monitors and generating tests, but does not do anything about Kernel events or about generating monitors.

Dear Alan,
Thanks for you reply. I would like to see some example how to use SCV_EXTENSIONS_BASE_CLASS macro. The scv package or the manual doe not have any example.
Also I want to do the following:
1. Define a base class A.
2. Define two classes B, C derived from A.
3. I want to track the value changes of the member variables of class B and C. - So I need to define scv_extensions for them.
4. Now I want to use polymorphism: use base class point A* to point derived class objects new B() and new C(). Also I want to define function f(A* a) that actually receives objects of type B and C and determines in the runtime what kind of object it is. It finally does type cast on a as: (B*)a or (C*)a to use methods defined in B or C.
I wonder if this kind of polymorphism is doable with scv_smart_pointer<A>, scv_smart_pointer<B> , scv_smart_pointer<C>. It will be really helpful if I can see some example about the syntax and everything. The manual really doe snot show anything. I also have gone through all the example programs scv package provides.
Can you let me know whom I can talk to regarding this in the developer's group?
Regards
Sonali

Companies like Intel, TI, Cadence, Synopsys are working actively on different SystemC projects, mainly using it to build firmware, hardware system prototypes to develop the software etc.
Also SystemC is still in research phase. The best deal is to work on some industrial project or in some research lab. Institutions having interesting SystemC projects to work on are hard to find, especially in India.

Here is a few general questions about the limitations SCV might have:
1. Hierarchical Types:
To use scv_smart_ptr of class A, I need to define SCV_EXTENSIONS(A). Now suppose, class A is a subclass of class B.
For example:
class B{
public:
int attB1;
protected:
int attB2;
...
};
class A: public class B{
public:
int attA1;
private:
std::string attA2;
...
};
Now how do I define SCV_EXTENSIONS(A)? Does SCV support this? Do I need to define SCV_EXTENSIONS( B ) too?
2. C++ library types: std::vector, std::list, std::map ...
SCV has already defined SCV_EXTENSIONS template class for C++ built-in types like int, float etc and also some systemC built-in types. That means we can create variables of type scv_smart_ptr<int> or scv_smart_ptr<float> etc.
But can I create variable of type scv_smart_ptr<std::map> or scv_smart_ptr<std::list> or scv_smart_ptr<std::vector> etc? Is SCV_EXTENSIONS template class already defined for them or do I need to define it as I did for class A?
Thanks
Sonali

Dear Alan,
Thanks for the quick reply.
I want to use SCV to call a callback function f() whenever any member variable of an object "a" of class A will be written a new value. Also f() will use the object "a" inside it.
My guess is that I can take any of the following two approaches:
Approach 1.
- define SCV_EXTENSIONS(A).
- instantiate a as: scv_smart_ptr<A> a;
- define callback function f() as:
void f(scv_extensions_if& a_ext, scv_extensions_if::callback_reason r) {
if ( r == scv_extensions_if::VALUE_CHANGE) { //Use a_ext to do some operation
}
- register callback f() to a as a->register_cb(f)
My question here is:
1. How can I get a from a_ext? I need the object of type A or something similar inside f().
Approach 2:
- define each member variables "v" of A as scv_smart_ptr.
- register callback f() with each of them in the constructor of A. The manual has an example on Page 46.
My question here is:
1. I like this approach better. But is there any way to get hold of object "a" inside callback f(). The object which is passed to it is a->v, not a. I need a.
Does it mean I need to use approach 1? Or is there any other way?
Thanks
Sonali

I would suggest you to read the systemC manual A to Z. It is very well-written. It is more like a book than manual. I learned it in that way. Also http://emedia.art.sunysb.edu/debt/downloads/books/System%20Design%20with%20SystemC.pdf is a good book for the initial stage.

SystemC kernel simulates parallel execution of hardware. Processes suspends and resumes. A process can suspend itself and wait for an event to take place. When the event happens, that process resumes its execution. This is the most important power of SystemC. You cannot gain this advantage using flags, even inside the same module.

Hi,
I am working on Assertion Based Dynamic Verification of SystemC models. To expose some states of the kernel to the runtime monitors I am doing some minimal modification to the SystemC-2.3.0 kernel.
I added 4 new files:
mon_prototype.cpp/h
mon_observer.cpp/h
I also did some minimal modification(adding callbacks) to:
sc_event.cpp/h
sc_sim_context.cpp/h
sc_object.cpp/h
sc_thread_process.h
I did the required modification to : systemc-2.3.0/src/systemc.
For installation I modified:
1. /systemc-2.3.0/src/sysc/kernel/Makefile.am to add the new 4 files I have added to kernel (see above for detail)
2. /systemc-2.3.0/configure.in to add a new flag called -DDEBUG_PRINT_IN_SCHEDULER
Now I ran:
autoconf: This takes aclocal.m4 and configure.in as input and generates ./configure file as output.
automake: This takes configure.in and Makefile.am as input and generates Makefile.in as output.
Now I follow the steps in INSTALL file for the rest of the installation process.
The modified systemC got installed successfully at: modified_systemc-2.3.0/
Now I try to run a small systemC model adder using this modified SystemC. When I compile adder model with modified_systemc-2.3.0, it compiles without any warning or error. But when I run it, it gives me the following error:
# ./addy
./addy: error while loading shared libraries: libsystemc-2.3.0.so: cannot open shared object file: No such file or directory.
But libsystemc-2.3.0.so is there at /modified_systemc-2.3.0/lib-linux64/libsystemc-2.3.0.so
So I got the following workaround:
# LD_LIBRARY_PATH=modified_systemc-2.3.0/lib-linux64
# export LD_LIBRARY_PATH
And now if I run ./addy, it runs fine.
This problem does not occur while running ./addy using unmodified version of SystemC 2.3.0. My guess is that I missed setting some default path while modifying the systemc-2.3.0. So the paths that should be set by default is not set be default and need manual setting.
Does anyone have any idea how I can fix it?
Thanks and Regards
Sonali

Dear Alan,
I installed fresh systemc-2.3.0 in /root/Desktop/systemc-2.3.0
[root@localhost systemc-2.3.0]# pwd /root/Desktop/systemc-2.3.0
In Desktop I have created hello_world.cpp
Now I run:
[root@localhost Desktop]# g++ -I /root/Desktop/systemc2.3.0/include/ -L /root/Desktop/systemc2.3.0/lib-linux64/ -Xlinker -rpath -Xlinker /root/Desktop/systemc2.3.0/lib-linux64/ hello_world.cpp -lsystemc hello_world.cpp:1:21: error: systemc.h: No such file or directory hello_world.cpp:3: error: expected constructor, destructor, or type conversion before ‘(’ token
Wierd!!!
But my adder model is running using it.
The thing I observerd that the behavior of systemc-2.3.0 in terms of setting LD_LIBRARY_PATH automnatically is completely unpredictable. Sometimes it does, sometimes it does not.
I installed the fresh systemc-2.3.0 1bout 8 times. Only 2 times it did not give the LD_LIBRARY_PATH issue and my systemc model ran fine.
So it is not about my modification. As you pointed out correctly, there is some problem in systemc-2.3.0 itself. Can you report a bug?
Also I am running as root. So it does not work for root user too!
Regarding /etc/ld.so:
There is a file called ld.so.conf and a directory callled ld.so.conf.d.
But there is no file called ld.so
And there is nothing added in any of these file.
Thanks
Sonali

Alan,
I changed the name from modified_systemc-2.3.0 to systemc-2.3.0 and reinstalled. But I still has the same issue. As you said I did:
ldd addy and here is what I get:
[root@localhost adders1]# ldd addy linux-vdso.so.1 => (0x00007fffefb72000) libsystemc-2.3.0.so => not found libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000032b3600000) libm.so.6 => /lib64/libm.so.6 (0x00002b666f186000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000032aee00000) libc.so.6 => /lib64/libc.so.6 (0x00002b666f409000) /lib64/ld-linux-x86-64.so.2 (0x00002b666ef68000)
This is my installation path:
[root@localhost lib-linux64]# pwd /root/Desktop/CHIMP_ea/systemc-2.3.0/lib-linux64 [root@localhost lib-linux64]# ls libsystemc-2.3.0.so libsystemc.a libsystemc.la libsystemc.so [root@localhost lib-linux64]#
As you can see, libsystemc-2.3.0.so exists!

Here is my analysis:
In you look at systemc-2.3.0/configure:
you will see some variables are set in there:
PACKAGE=systemc
VERSION=2.3.0
And there are many others like this. Search configure file for "systemc" and you will find them.
My guess is that these variables are being used to setup default LD_LIBRARY_PATH. Since I have changed the package name from systemc-2.3.0 to modified_systemc-2.3.0, the default path does not work for me anymore. I will run some experiments now to see if I am right.
Regards
Sonali

Thank you for replying.
If you look at the Makefile in my earlier post I do the same thing.
This is what I do not want to do. Why do I need to export it explicitly? I do not need to do with systems-2.3.0. I only need it with my modified version modified_systemc-2.3.0.

My guess is that I have both systems-2.3.0 and modified_systemc-2.3.0 in the same path. So the linker by default finds the .so files in systemc-2.3.0/lib-linux64 and it does not complain.
But the adder Makefile points to the modified_systemc-2.3.0 and that is when it gives error.
Yes.
I will try this and let you know Alan. Thanks.

Hi,
Let us consider the following example:
sc_event a, b;
....
SC_CTOR(...){
SC_THREAD(p);
sensitive << a << b;
}
My question is process p here is statically sensitive to (a and b ) OR (a or b )?
I went through the relevant parts of 1666-2011_systemc_manual.pdf. But still I did not find the exact answer.
If anyone knows the answer, it will be great!
Thanks
Sonali

Hi Philipp,
Yes. I ran ../configure before gmake.
Probably you are right! But I will move on since everything is working now. Thanks for your help.
I appreciate that you pointed out about the parameters of aclocal specifically -I config. Something I got to learn! So dealing with these nasty errors sometimes gives you valuable knowledge. Not that bad!
Thanks
Sonali

Hi,
I am working on Runtime Monitoring of SystemC models. One of my projects requires adding some callbacks to the systemc kernel.
In systemc-2.3.0/src/sysc/kernel:
I added 4 new files:
mon_prototype.cpp/h
mon_observer.cpp/h
I also did some minimal modification(adding callbacks) to:
sc_event.cpp/h
sc_sim_context.cpp/h
sc_object.cpp/h
sc_thread_process.h
I did the required modification to : systemc-2.3.0/src/systemc.
There are hierarchical Makefiles: Makefile.in and Makefile.am in systemc-2.3.0
My question is: what is the clean way of doing this Makefile modifications? How many Makefiles do I need to modify manually?
I definitely need to change one of the Makefile.in and Makefile.am in src/sysc/kernel. My guess is that I can regenerate the other Makefiles(modified) using automake and aclocal. I need to know the right way to do it.
Finally, I want to release the modified systems-2.3.0 kernel that can be compiled and installed using the same steps described in systems-2.3.0/INSTALL.
Can anybody from the developer group advise me in this respect?
Regards
Sonali