Jump to content
katang

A strange SystemC warning

Recommended Posts

I receive a kind of strange warning: the same runtime warning repeats, next time one character shorter, as long as the length of the path in message lasts. Like the fragment shown below. However, the test runs file. Since in the message only SystemC files are referred to, I have no idea what could be the reason. (Honestly, if it would be the task to program by intention something like this, I would be in serious trouble). Any idea, what and where to look for?

 

The call scMod(/*"My_Name_"+ char(ID+'A')) results in what shown, (0<=ID<= 16)

The call scMod("My_Name_")  runs fine. (scMod is a SystemC module)

Do I something illegal?

 

Warning: (W506) illegal characters: include/sysc/communication/sc_port.h substituted by include/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264


Warning: (W506) illegal characters: nclude/sysc/communication/sc_port.h substituted by nclude/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264


Warning: (W506) illegal characters: clude/sysc/communication/sc_port.h substituted by clude/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

Starts with

 

Warning: (W506) illegal characters: /usr/local/systemc231a/include/sysc/communication/sc_port.h substituted by /usr/local/systemc231a/include/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

ends with

 

Warning: (W506) illegal characters: /sysc/communication/sc_port.h substituted by /sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

 

Share this post


Link to post
Share on other sites

The root for your problem is not in the implementation of SystemC, but in your code. You forgot that in C, you cannot simply concatenate C string (i.e., arrays of type char) by adding them. Instead of concatenating strings the addition of char(ID+'A') to the string "My_Name_" modified the pointer to the string to point ID+65 positions beyond the start of the original string. At that point in memory is probably only garbage, which was interpreted by the sc_object constructor as an object name thus causing the illegal characters warning.

To properly concatenate strings in C, you need to reserve a big enough buffer to hold the concatenated result and then use strcpy(), strcat(), strncpy(), strncat() functions copying / concatenating strings. However, in C++, you can use std::string to simplify your task. The following code should work. Though, it may not be optimal in terms of performance (a std:: string gets temporarily constructed):

scMod((std::string("My_Name_") + char(ID+'A')).c_str())

 

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

×