-
Notifications
You must be signed in to change notification settings - Fork 19
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
type info is being repeated in some cases #46
Comments
@mayagokhale There are two bugs this issue identifies that have been noted.
For (1), although not entirely sure, I suspect that the RecursiveASTVisitor does not completely visit all children of template instantiations. This is perhaps one of the reasons why such issues are coming up. I'm going to try first by updating clang to see if some of those have been resolved. If not, then something else must be devised. For (2), this should have been fixed in the master (d303ef5). The concern about sc_stream_0 being emitted multiple times still needs further investigation. I'll need to create smaller examples to isolate this. |
I confirmed that 2 is fixed. |
Issue (1) occurs within Related:
side: |
@mayagokhale A complete rewrite of |
This seems to be working fine afaik. |
In the latest build, type information appears to be duplicated again, this time the template type parameters. As a simple instance, the signal clk which is a sc_in, shows up twice. This is true of all the types being reported from the port, signal, and variable lists.object name is clk |
@mayagokhale I don't see this in any of my tests. For example, Can you point me to how you are accessing the port information in your code? |
In plugins/xlat/Xlat.cpp, line 114 is the function that emits type declarations to hcode and prints debug information. Line 121 prints out the number of template type arguments, and then the code iterates through the arguments and dumps each argument. |
@mayagokhale I understand the issue. After the introduction of To give you an example on how to access the internal types, I've updated the The code fragment that is important is below. for (auto const &port : test_module_inst->getIPorts()) {
auto name{get<0>(port)};
auto template_args{template_type->getTemplateArgTreePtr()};
// Note: template_args must be dereferenced.
for (auto const &node : *template_args) {
auto type_data{node->getDataPtr()};
llvm::outs() << "\n@> name: " << name << ", type name: " << type_data->getTypeName() << " ";
}
llvm::outs() << "\n";
} Things to note:
|
Thank you I have updated the Xlat.cpp code and confirms that it is now correct. |
This is a problem that I thought was previously fixed, but noticed it again on the current master branch. Using the test.cpp example from the sc_zfp version the causes find_emax to be instantiated, certain type parameters are being repeated. So for the signal "data" in stream.h
sc_signal data;
we see the following generated .txt fragment below. Additionally, the sc_stream_0 module is being emitted three times. I wonder if this could be because the matcher is matching multiple rules and adding the matched item to the list each time.
hModule sc_stream_0 [
hPortsigvarlist NONAME [
hSigdecl data NOLIST
hTypeinfo NONAME [
hType sc_signal NOLIST
hType fp_t<11, 52> NOLIST
hType fp_t<11, 52> NOLIST
]
hSigdecl ready NOLIST
hTypeinfo NONAME [
hType sc_signal NOLIST
hType _Bool NOLIST
]
hSigdecl valid NOLIST
hTypeinfo NONAME [
hType sc_signal NOLIST
hType _Bool NOLIST
]
]
The text was updated successfully, but these errors were encountered: