ferrandi / PandA-bambu

PandA-bambu public repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in the tutorial with verilator simulation

hushanjushi opened this issue · comments

I followed the tutorial of bambu, and I met a error in section 4 ,simulation:

I input:

 bambu ../spec.c --simulate --simulator=VERILATOR

And I got

Warning: XML file "/home/saltyfish/PandA-bambu-0.9.8/examples/crc/tutorial/test.xml" cannot be opened, creating a stub with random values
/home/saltyfish/PandA-bambu-0.9.8/examples/crc/tutorial/./simulate_main.sh: line 19: /home/saltyfish/PandA-bambu-0.9.8/examples/crc/tutorial/HLS_output//verilator_beh/verilator_obj/Vmain_tb: No such file or directory
error -> The simulation does not end correctly

It seems something absent. But I have install newest stable verilator, and the bambu is used appimage, where could be error?

The verilator version is:

Verilator 4.224 2022-06-19 rev v4.224-26-g8b748080

I use verilator 4.038 and it works, maybe the new version is not compartible with bambu

Which tutorial are you following? I can't see the exercise you mention in the 2022 Colab notebooks.

Which tutorial are you following? I can't see the exercise you mention in the 2022 Colab notebooks.

In the website, emm bambu tutorial,is it out-of-date?

I would suggest to start from the DATE or ISC tutorials, as those have been updated more recently. But I will also verify if I can reproduce the error, thanks for pointing it out.

I would suggest to start from the DATE or ISC tutorials, as those have been updated more recently. But I will also verify if I can reproduce the error, thanks for pointing it out.

Dear Developer, I think you should point out the website url "https://release.bambuhls.eumage/bambu-date2022.AppImage" should be changed into newest website. Its url is a temporary url,right?

And I tried again according to data tutorial, it shows the same error. So maybe it is really incompatible to newest verilator.

Dear Developer, I think you should point out the website url "https://release.bambuhls.eumage/bambu-date2022.AppImage" should be changed into newest website. Its url is a temporary url,right?

I think it is just a typo, the correct URL is https://release.bambuhls.eu/appimage/bambu-date2022.AppImage .

And I tried again according to data tutorial, it shows the same error. So maybe it is really incompatible to newest verilator.

About the verilator issue, it is something we encountered before and I can confirm it is related to the version of the tool.

Dear Developer, I think you should point out the website url "https://release.bambuhls.eumage/bambu-date2022.AppImage" should be changed into newest website. Its url is a temporary url,right?

I think it is just a typo, the correct URL is https://release.bambuhls.eu/appimage/bambu-date2022.AppImage .

And I tried again according to data tutorial, it shows the same error. So maybe it is really incompatible to newest verilator.

About the verilator issue, it is something we encountered before and I can confirm it is related to the version of the tool.

Ok, all work now.

Dear Developer, I think you should point out the website url "https://release.bambuhls.eumage/bambu-date2022.AppImage" should be changed into newest website. Its url is a temporary url,right?

I think it is just a typo, the correct URL is https://release.bambuhls.eu/appimage/bambu-date2022.AppImage .

And I tried again according to data tutorial, it shows the same error. So maybe it is really incompatible to newest verilator.

About the verilator issue, it is something we encountered before and I can confirm it is related to the version of the tool.

emm, I think I met error again.

Simulation FAILED

Start reading vector           2's values from input file.

Reading of vector values from input file completed. Simulation started.
Simulation ended after                   34 cycles.

Simulation completed with success

No more values found. Simulation(s) executed:           2.

- /home/test/workspace/content/bambu-tutorial/01-introduction/Exercise2/HLS_output//simulation/testbench_min_max_tb.v:214: Verilog $finish
No more values found. Simulation(s) executed:           2.

- /home/test/workspace/content/bambu-tutorial/01-introduction/Exercise2/HLS_output//simulation/testbench_min_max_tb.v:255: Verilog $finish
- /home/test/workspace/content/bambu-tutorial/01-introduction/Exercise2/HLS_output//simulation/testbench_min_max_tb.v:255: Second verilog $finish, exiting
error -> Simulation not correct!

I follow the tutorial in a Ubuntu 22.04 virtual machine. And I didn't change anything but the url.

Could you please share the input file, the testbench initialization file (the XML file where test inputs are written), and the command line you used to call bambu?
Just as a guess, if the top function has pointer arguments and no user-defined testbench XML is passed to bambu, then memory is not initialized and this can lead to errors during the simulation.

Could you please share the input file, the testbench initialization file (the XML file where test inputs are written), and the command line you used to call bambu? Just as a guess, if the top function has pointer arguments and no user-defined testbench XML is passed to bambu, then memory is not initialized and this can lead to errors during the simulation.

I'm sorry for I forget to do them. The error happens in 01-introduction/Exercise5. I didn't change anything. The command line is and the file is like the tutorial:

bambu minmax.c --top-fname=min_max --device-name=xc4vlx100-10ff1513 --clock-period=15 --no-iob --simulate --simulator=VERILATOR 

testbench.xml

<?xml version="1.0"?>
<function>
   <testbench input="{0,1,2,3,4}" num_elements="5" out_max="{0}" out_min="{0}"/>
   <testbench input="{15,10,5}" num_elements="3" out_max="{15}" out_min="{5}"/>
</function>

minmax.c

void min_max(int input[10], int* out_max)
{
   int local_max = input[0];
   int i = 0;
   for(i = 0; i < 10; i++)
   {
      if(input[i] > local_max)
      {
         local_max = input[i];
      }
   }
   *out_max = local_max;
}

I tried to go through the tutorial myself and I think the issue is that it is not really clear without the actual explanation that we add on top during presentations. I am really sorry for that, I will try to wrap up in the following lines.
The code you are trying to synthesize is supposed to be a starting point for the exercise that is presented in that section of the tutorial. As you can see from the min_max function signature the input array is expected to have 10 items in it while the one defined in testbench.xml is initialized with 5 items only (or even 3 if looking at the second testbench line).
Here the attendee is asked to fix the issue and add the missing initialization values or, as an alternative, change the min_max signature and body to read the input array size from an additional argument num_elements which you can already see in the testbench.xml
Finally, please remember to pass the testbench.xml file to bambu using the command line argument --generate-tb=testbench.xml.
Hope this helps and thank you for pointing out the issue.

The exercises are supposed to be run in order: if you don't go through exercise 3, which explains how to modify the C code and the XML file, many of the following exercises will not work.