Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: ScTool internal error : Record owner is not variable #80

Open
libalis opened this issue Feb 9, 2025 · 14 comments
Open

error: ScTool internal error : Record owner is not variable #80

libalis opened this issue Feb 9, 2025 · 14 comments

Comments

@libalis
Copy link

libalis commented Feb 9, 2025

First of all, I want to thank you very much for this great project and all the hard work that has gone into it.
I am currently pursuing my Bachelor's degree in Computer Science and it's been incredibly helpful for my studies.
Since this is my first time using SystemC, I apologize in advance for any poorly written code.

Description:

When running the following command:

ctest -R sata --rerun-failed --output-on-failure

I encountered this error:

--------------------------------------------------------------
Intel Compiler for SystemC (ICSC) version 1.6.10, Dec 06, 2024
--------------------------------------------------------------
Top module is MATRIX_VECTOR
Elaboration database created

error: ScTool internal error : Record owner is not variable
sata_sctool: /home/robert/Downloads/sc_tools/icsc/sc_tool/lib/sc_tool/cfg/SValue.h:428: sc::SRecord::SRecord(const clang::QualType&, std::vector<sc::SValue>, const sc::SValue&, const sc::SValue&, size_t): Assertion `false' failed.

The issue occurs during the synthesis process.
You can find my repository here: https://github.com/libalis/bachelor.

Additional Information:

  • Intel Compiler for SystemC (ICSC): Version 1.6.10 (Dec 06, 2024)
  • Top module: MATRIX_VECTOR

I would greatly appreciate any help or insights regarding this issue.
Thank you again for all the effort you’ve put into this amazing project!

@mikhailmoiseev
Copy link
Contributor

In the project, there is btint class which has user-defined default constructor btint(). Such classes cannot be used in arrays as soon as the default constructor code should be substituted at the array declaration, which makes the generated code ugly and unreadable. Have updated the compiler to print a reasonable error message.

Generally, I would recommend to rid of btint and replace it with sc_biguint<2*T+1> with correspondent functions. The class implementation has lots of extra things like function calls which will be resulted in extra logic. Classes which are not modules have limited usage in synthesizable SystemC.

@libalis
Copy link
Author

libalis commented Feb 11, 2025

Thank you very much for the quick reply and the time you spent.
Are custom data types generally not supported by the compiler, or only in arrays, or only those with a standard constructor?
My implementation is based on this: https://www.learnsystemc.com/basic/customized_datatype
Are helper functions like the ones I use capable of synthesis?

@mikhailmoiseev
Copy link
Contributor

There is synthesizable subset of SystemC which is supported for hardware synthesis.
For ICSC this subset explained at here.

Custom data types are generally supported. Helper functions are also supported in most cases.

@libalis
Copy link
Author

libalis commented Feb 11, 2025

Thank you for the resources, they are very helpful.
Would removing the standard constructor solve the problem or should I really get rid of the custom data type and just leave the helper functions?

@mikhailmoiseev
Copy link
Contributor

That needs to be checked. Normally you run a compiler periodically for a new portion of code to ensure the code syntaxis is correct. As soon as you come with large amount of code it is difficult to say how many fixes it requires.

General recommendation is to think of which HW cells are generated for SystemC statements you are writing. Many places can be simplified and rewritten more efficiently from HW viewpoint.

@libalis
Copy link
Author

libalis commented Feb 11, 2025

I understand, I will definitely take that into account and do it that way, if necessary I will get in touch again.
Thank you for everything.

@libalis
Copy link
Author

libalis commented Feb 18, 2025

I am currently trying to synthesize each module one by one, now I got this error:

--------------------------------------------------------------
 Intel Compiler for SystemC (ICSC) version 1.6.12, Feb 10,2024
--------------------------------------------------------------
Top module is ADDER_SUBTRACTOR
Elaboration database created

error: ScTool internal error : SValue::getRecord() incorrect type
sata_sctool: /home/robert/Downloads/sc_tools/icsc/sc_tool/lib/sc_tool/cfg/SValue.cpp:480: sc::SRecord& sc::SValue::getRecord() const: Assertion `false' failed.

What does this error mean, how can I fix it?

@mikhailmoiseev
Copy link
Contributor

Could you provide updated Cmake with svc_target for this target? I see two instances of ADDER_SUBTRACTOR module.

@libalis
Copy link
Author

libalis commented Feb 19, 2025

I just added a new adder subtractor instance in the system module.
Please excuse the txt file extension, GItHub does not allow cpp uploads.
CMakeLists.txt
main.txt

@libalis
Copy link
Author

libalis commented Feb 19, 2025

Although I have just pushed a new commit, I am still referring to this:
https://github.com/libalis/bachelor/tree/273135990479ef35746a219bffe1d8dc79a33ca7

@mikhailmoiseev
Copy link
Contributor

That not compiled at my side:
matrix/Source Code/cpp/main.cpp:30:45: error: no match for call to ‘(sc_core::sc_in<sc_dt::sc_biguint<17> >) (sc_core::sc_signal<btint<8>, sc_core::SC_ONE_WRITER>&)’
2122: 30 | adder_subtractor->adder_subtractor_a(adder_subtractor_a);
2122: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

Please add 2nd compilation target in CMakeLIst.txt with another main.cpp or ifdef in the current one. Try that it is compiled and passed stage BUILD in ICSC at your side. I wont do any changes in your code.

@libalis
Copy link
Author

libalis commented Feb 20, 2025

Thank you for your patience.
As I mentioned, the error message was from an older commit.
I’ve created and attached a zip file with the updated main and CMakeLists.
It works on my end.
Thanks again for your help!

bachelor.zip

@mikhailmoiseev
Copy link
Contributor

The problem was in return *this; in btint set_value(int index, int decimal_value) -- dereference of this is not supported. When I replaced btint() with btint() = default, it synthesized.

For btint class I strongly recommend you to remove all the constructors, replace them with simple initialization functions. Instead of using set_value with individual bit setting, set whole values if possible.

Another thing, there is almost no reason to use any pointers. Instead of SC object pointers array it needs to use sc_vector. We do not have any pointers in industrial designs.

@libalis
Copy link
Author

libalis commented Feb 21, 2025

Thank you so much, that was so helpful!
I will definitely implement all of your suggestions.
Just one stupid question: do you have an example of how to create and use vectors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants