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

Fix uninitialized signal error #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Inky-13
Copy link

@Inky-13 Inky-13 commented Nov 20, 2024

I had some issues when building the core for simulation using verilator (see #125) This was first related to me using an older version of verilator as well as an uninitialized warning I was getting from verilator.

This PR documents adds verilator as a dependency and specifies the version and also initializes the variable that was causing the issue.

Closes: #125

@Inky-13 Inky-13 changed the title Fix uninitialized signal error and document verilator dependency with… Fix uninitialized signal error Nov 20, 2024
@Inky-13 Inky-13 changed the title Fix uninitialized signal error Fix uninitialized signal error Nov 20, 2024
Copy link
Contributor

@marnovandermaas marnovandermaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, just a few comments from my side.

@@ -30,6 +30,7 @@ probe is required.
* openocd (version 0.11.0 or above)
* screen
* srecord
* verilator (version 5.024-1 or above)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using 5.024, is there a difference between that and 5.024-1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe no difference. However, I saw it being reference here as 5.024-1 unsure if this is an ubuntu thing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the -1 because it is not reported by Verilator itself and it doesn't exist as a tag: https://github.com/verilator/verilator/tags

@@ -53,7 +53,7 @@ static bool has_hpm_counter(int index) {

std::string ibex_pcount_string(bool csv) {
char separator = csv ? ',' : ':';
std::string::size_type longest_name_length;
std::string::size_type longest_name_length = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that this wasn't flagged before. What behavior did this cause?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to build the verilator simulation using:

fusesoc --cores-root=. run --target=sim --tool=verilator --setup --build lowrisc:ibex:demo_system

I got the following error:

ERROR: ../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc: In function ‘std::string ibex_pcount_string(bool)’:
../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc:80:41: warning: ‘longest_name_length’ may be used uninitialized [-Wmaybe-uninitialized]
   80 |       int padding = longest_name_length - ibex_counter_names[i].length();
      |                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lowrisc_dv_verilator_ibex_pcounts_0/cpp/ibex_pcounts.cc:56:26: note: ‘longest_name_length’ was declared here
   56 |   std::string::size_type longest_name_length;
      |                          ^~~~~~~~~~~~~~~~~~~

The full error message when building with the wrong verilator version (5.020) as well is in issue #125

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to vendored code, which essentially lives in another repository. The original file lives here: https://github.com/lowRISC/ibex/blob/master/dv/verilator/pcount/cpp/ibex_pcounts.cc
Would you like to make a PR in the Ibex repo or shall I do that for you?

Copy link
Contributor

@marnovandermaas marnovandermaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as request changes because it makes changes to vendored code.

@marnovandermaas
Copy link
Contributor

Thank you so much for making these changes by the way. Very useful to get these fixes in!

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

Successfully merging this pull request may close these issues.

Error building the simulation
2 participants