efabless / openlane2

The next generation of OpenLane, rewritten from scratch with a modular architecture
https://openlane2.readthedocs.io/
Apache License 2.0
168 stars 30 forks source link

Expected user error: Odb.SetPowerConnections fails with hard-to-understand error message #470

Open c-93 opened 1 month ago

c-93 commented 1 month ago

Description

While instantiating macros, Odb.SetPowerConnections in OpenLane2 sometimes fails for some macros.

Based on the logs: Do you have an idea what is happening?
I think the algorithm searches for a power pin, but doesn't find it. Or it iterates over pins, which are somehow not included.

How can this be debugged from within the container?

Expected Behavior

Don't fail.

Environment report

Container: `ghcr.io/efabless/openlane2:2.0.0rc2`.

Reproduction material

Unfortunately, I cannot provide the project for reproduction. I hope the logs provide enough information.

Relevant log output

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Set Power Connections ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[13:19:59] VERBOSE  Running 'Odb.SetPowerConnections'… (Log: ./runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/odb-setpowerconnections.log)                                                                                                                                                               step.py:1085
Traceback (most recent call last):                                                                                                                                                                                                                                                                                            
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 355, in <module>                                                                                                                                                               
cli()                                                                                                                                                                                                                                                                                                                         
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__                                                                                                                                                                                      
return self.main(*args, **kwargs)                                                                                                                                                                                                                                                                                             
^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                    
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1078, in main                                                                                                                                                                                          
rv = self.invoke(ctx)                                                                                                                                                                                                                                                                                                         
^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                              
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke                                                                                                                                                                                        
return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                                                                                                                                       
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                               
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke                                                                                                                                                                                        
return ctx.invoke(self.callback, **ctx.params)                                                                                                                                                                                                                                                                                
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                       
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 783, in invoke                                                                                                                                                                                         
return __callback(*args, **kwargs)                                                                                                                                                                                                                                                                                            
^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                   
File "/nix/store/lbzbqn0nc7dhn99wai7rw5vfm6kp17v5-python3.11-openlane/lib/python3.11/site-packages/openlane/scripts/odbpy/reader.py", line 213, in wrapper                                                                                                                                                                    
function(**kwargs)                                                                                                                                                                                                                                                                                                            
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 239, in set_power_connections                                                                                                                                                  
macro_instances = extract_instances(db, design_dict, design_name)                                                                                                                                                                                                                                                             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                               
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 170, in extract_instances                                                                                                                                                      
power_pins = extract_power_pins(db, design_dict, design_name, cell_name)                                                                                                                                                                                                                                                      
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                   
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 127, in extract_power_pins                                                                                                                                                     
power_pins = {                                                                                                                                                                                                                                                                                                                
^                                                                                                                                                                                                                                                                                                                             
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 130, in <dictcomp>                                                                                                                                                             
if is_power(db, module, pin_name)                                                                                                                                                                                                                                                                                             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                
File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 87, in is_power                                                                                                                                                                
pin = next(pin for pin in master.getMTerms() if pin.getName() == pin_name)                                                                                                                                                                                                                                                    
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                          
StopIteration                                                                                                                                                                                                                                                                                                                 
[13:20:00] ERROR    Subprocess had a non-zero exit.                                                                                                                                                                                                                                                               step.py:1310
[13:20:00] ERROR    Last 10 line(s):                                                                                                                                                                                                                                                                              step.py:1315
                      File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 127, in extract_power_pins                                                                                                                               
                        power_pins = {                                                                                                                                                                                                                                                                                        
                                     ^                                                                                                                                                                                                                                                                                        
                      File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 130, in <dictcomp>                                                                                                                                       
                        if is_power(db, module, pin_name)                                                                                                                                                                                                                                                                     
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                     
                      File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 87, in is_power                                                                                                                                          
                        pin = next(pin for pin in master.getMTerms() if pin.getName() == pin_name)                                                                                                                                                                                                                            
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                            
                    StopIteration                                                                                                                                                                                                                                                                                             

[13:20:00] ERROR    Full log file: 'runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/odb-setpowerconnections.log'                                                                                                                                                                                          step.py:1318
[13:20:00] WARNING  The following warnings were generated by the flow:                                                                                                                                                                                                                                             flow.py:650
[13:20:00] WARNING  [Checker.LintWarnings] 470 Lint warnings found.                                                                                                                                                                                                                                                flow.py:651
                    [OpenROAD.CheckSDCFiles] 'PNR_SDC_FILE' is not defined. Using generic fallback SDC for OpenROAD PnR steps.                                                                                                                                                                                                
                    [OpenROAD.CheckSDCFiles] 'SIGNOFF_SDC_FILE' is not defined. Using generic fallback SDC for OpenROAD PnR steps.                                                                                                                                                                                            
                    [OpenROAD.Floorplan] [STA-0053] /scratch/cs_local/scoooter_dexie/SKY130/openram_macros/sky130_sram_1kbyte_1rw1r_32x256_8/sky130_sram_1kbyte_1rw1r_32x256_8_TT_1p8V_25C.lib line 1, library sky130_sram_1kbyte_1rw1r_32x256_8_TT_1p8V_25C_lib already exists.                                              
                    [OpenROAD.Floorplan] [STA-0053] /scratch/cs_local/scoooter_dexie/SKY130/dffram_macros/32x32bit_ByteEnable_1RW/final/lib/nom_tt_025C_1v80/RAM32__nom_tt_025C_1v80.lib line 1, library RAM32 already exists.                                                                                                
                    [OpenROAD.Floorplan] [STA-0053] /scratch/cs_local/scoooter_dexie/SKY130/dffram_macros/128x32bit_ByteEnable_1RW/final/lib/nom_tt_025C_1v80/RAM128__nom_tt_025C_1v80.lib line 1, library RAM128 already exists.                                                                                             
                    [OpenROAD.Floorplan] [STA-0198] /scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/06-yosys-synthesis/mkWrapDexieAndScoooter.nl.v line 583806, module sky130_sram_1kbyte_1rw1r_32x128_32_chris not found. Creating black box for                                                        
                    dexieCore_cf_contextMemory_memory_inst_sram.                                                                                                                                                                                                                                                              
                    [OpenROAD.Floorplan] [ORD-2013] instance dexieCore_cf_contextMemory_memory_inst_sram LEF master sky130_sram_1kbyte_1rw1r_32x128_32_chris not found.                                                                                                                                                       
                    [Odb.CheckMacroAntennaProperties] Cell 'sky130_sram_1kbyte_1rw1r_32x256_8' has (57) input pin(s) without antenna gate information. They might not be connected to a gate.                                                                                                                                 
                    [Odb.CheckMacroAntennaProperties] Cell 'sky130_sram_1kbyte_1rw1r_32x256_8' has (64) output pin(s) without antenna diffusion information. They might not be driven.                                                                                                                                        
[13:20:00] ERROR    The following error was encountered while running the flow:                                                                                                                                                                                                                                __main__.py:152
                    Set Power Connections: subprocess (1, ['openroad', '-exit', '-no_splash', '-metrics', '/scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/or_metrics_out.json', '-python',                                                                                   
                    '/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py', 'set-power-connections', '--input-lef',                                                                                                                              
                    '/home/wimi/cs/.volare/volare/sky130/versions/bdc9412b3e468c102d01b7cf6337be06ec6e9c9a/sky130A/libs.ref/sky130_fd_sc_hd/techlef/sky130_fd_sc_hd__nom.tlef', '--input-lef',                                                                                                                                
                    '/home/wimi/cs/.volare/volare/sky130/versions/bdc9412b3e468c102d01b7cf6337be06ec6e9c9a/sky130A/libs.ref/sky130_fd_sc_hd/lef/sky130_ef_sc_hd.lef', '--input-lef',                                                                                                                                          
                    '/home/wimi/cs/.volare/volare/sky130/versions/bdc9412b3e468c102d01b7cf6337be06ec6e9c9a/sky130A/libs.ref/sky130_fd_sc_hd/lef/sky130_fd_sc_hd.lef', '--input-json',                                                                                                                                         
                    '/scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/05-yosys-jsonheader/mkWrapDexieAndScoooter.h.json', '--output-odb', '/scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/mkWrapDexieAndScoooter.odb', '--output-def',                   
                    '/scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/mkWrapDexieAndScoooter.def', '/scratch/cs_local/scoooter_dexie/SKY130/runs/RUN_2024-05-14_13-17-00/12-openroad-floorplan/mkWrapDexieAndScoooter.odb']) failed                                            
[13:20:00] ERROR    OpenLane will now quit.  

// and the content of `runs/RUN_2024-05-14_13-17-00/14-odb-setpowerconnections/odb-setpowerconnections.log`:
[WARNING ORD-0039] .openroad ignored with -python
Traceback (most recent call last):
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 355, in <module>
    cli()
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/lbzbqn0nc7dhn99wai7rw5vfm6kp17v5-python3.11-openlane/lib/python3.11/site-packages/openlane/scripts/odbpy/reader.py", line 213, in wrapper
    function(**kwargs)
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 239, in set_power_connections
    macro_instances = extract_instances(db, design_dict, design_name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 170, in extract_instances
    power_pins = extract_power_pins(db, design_dict, design_name, cell_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 127, in extract_power_pins
    power_pins = {
                 ^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 130, in <dictcomp>
    if is_power(db, module, pin_name)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qfxhwcwym73wnch7k4jwq8rmf13yrwiz-python3-3.11.6-env/lib/python3.11/site-packages/openlane/scripts/odbpy/power_utils.py", line 87, in is_power
    pin = next(pin for pin in master.getMTerms() if pin.getName() == pin_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration
donn commented 1 month ago

As you've surmised, the script looks for a power pin but does not find it. What this likely means is that the LEF view of the design states one thing about the power pins and the Verilog view (from which the JSON hierarchy of the design is created) states another thing.

I'll try to make the error messages a bit better.

donn commented 1 month ago

In the meantime, could you please verify the top-level pins are identical?