The-OpenROAD-Project / OpenSTA

OpenSTA engine
GNU General Public License v3.0
389 stars 170 forks source link

Inquiry about OpenSTA with the `replaceCell` function from `STA` class. #81

Closed KKA92 closed 2 years ago

KKA92 commented 2 years ago

When I used your OpenSTA library, I ran into a weird problem. My task involved changing/replacing a particular cell with another type and calculating the slack improvement. I tried to use the function replaceCell from the STA class to do that. However, when I tried to revert back to the original cell for further processing, the slack values before and after were not matched.

In more detail, this is the step-by-step of how to reproduce the above problem:

  1. I use the OpenSTA Tool with reference designs from OpenLane. In particular, I used the sound design for the following example.
    1. Read the synthesis Verilog file and set up the environment.
    2. Initialize all instance cell size equals 1 (the postfix is alway _1, ex: sky130_fd_sc_hd_nor21")
    3. Choose a specific one Instance (cell) to calculate slack by using the vertexSlack(vertex, min_max) function from the STA class. Let's denote the slack value of this step as SLACK_A
    4. Replace the chosen Instance (cell) with the cell size equals to 2 (ex: sky130_fd_sc_hd_nor22) and calculate slack by using the same function as step 4.
    5. Revert cell size equals 1 (ex: sky130_fd_sc_hd__nor2_1) of the chosen Instance(cell) and then re-calculate the slack value. Let's denote the value of this step is SLACK_B

Normally, SLACK_A should have the same value as SLACK_B in all cases. But in my experiments, in a few cases, such as the sound design, these two values have a small difference.

I wonder if there is something wrong with my setup or there is a hidden bug with the current implementation. I hope you could spend some time looking into this issue and give me your advice and possible solutions for this problem.

Thanks.

The following description shows how to run the minimal example code for demonstration of the above-mentioned problem.

  1. The whole example code is contained in test.cc test.hh test.i test.tcl files, make sure you already add these files in 'CMakeLists.txt' before compiling the source code. For more convenience, I also attached this file for reference.
  2. Notice that, for the simple demonstration, I have modified some configuration files in OpenLane, therefore you should make sure to provide the correct paths to these files (in test.cc) before compiling the code.
  3. Compile the source code (cd OpenSTA/build && cmake .. && make )
  4. After you compiled the source code, move the sound.tcl file into OpenSTA/example directory.
  5. Run "cd OpenSTA/example && ../app/sta sound.tcl"

test_code.zip

jjcherry56 commented 2 years ago

I have no interest in debugging your c++ code or installing openlane. I suggest you try and reproduce the problem using just opensta with a tcl script. If you can't you have an existence proof of what works.