Skip to content

Smallfix for generated clock#36

Merged
akashlevy merged 5 commits intomainfrom
genclk
Jan 30, 2026
Merged

Smallfix for generated clock#36
akashlevy merged 5 commits intomainfrom
genclk

Conversation

@stanminlee
Copy link

@stanminlee stanminlee commented Jan 29, 2026

Small bug where strings get corrupted due to stringPrintTmp. May interfere with generated clock lookup. Fixed by making a copy of the string instead of using a temporary buffer.

Added more verbosity since it is an additional feature for debug help


Important

Fix string corruption in generated clock lookup and add verbose debug logging.

  • Bug Fix:
    • Replace stringPrintTmp with stringCopy(stringPrintTmp(...)) in createLibertyGeneratedClocks() in Sdc.cc and makeGeneratedClocks() in VerilogReader.cc to prevent string corruption.
  • Debugging:
    • Add debug prints in createLibertyGeneratedClocks() in Sdc.cc to log found generated clock pins and creation of generated clocks.
    • Add debug prints in makeGeneratedClocks() in VerilogReader.cc to log addition of generated clock pins to liberty cells.

This description was created by Ellipsis for 4df9d68. You can customize this summary. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to ccd1b2e in 16 seconds. Click for details.
  • Reviewed 60 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_P0S5Y3IQfM3aWYQD

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@greptile-apps
Copy link

greptile-apps bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

Fixes a critical string corruption bug in generated clock processing by ensuring stringPrintTmp results are copied before use, and adds verbose logging for debugging.

  • Fixed string corruption in createLibertyGeneratedClocks() by wrapping stringPrintTmp with stringCopy for generatedClockName
  • Fixed string corruption in makeGeneratedClocks() by wrapping stringPrintTmp with stringCopy for pinPath
  • Added debug logging to report found pins, created clocks, and added clock pins
  • Added guard condition to skip createLibertyGeneratedClocks when no generated clock pins exist

Confidence Score: 4/5

  • Safe to merge with correct bug fix and appropriate logging additions
  • The string corruption fix correctly addresses the issue where stringPrintTmp temporary buffers could be overwritten. The logging is intentional for debug purposes. No breaking changes or risky modifications.
  • No files require special attention

Important Files Changed

Filename Overview
sdc/Sdc.cc Fixed string corruption bug by copying stringPrintTmp result and added debug logging
verilog/VerilogReader.cc Fixed string corruption bug by copying stringPrintTmp result and added debug logging

Sequence Diagram

sequenceDiagram
    participant Sdc
    participant Network
    participant VerilogReader
    participant Clock
    participant stringPrintTmp as stringPrintTmp Buffer
    participant stringCopy as stringCopy

    Note over VerilogReader: makeGeneratedClocks()
    VerilogReader->>stringPrintTmp: Format pin path
    stringPrintTmp-->>VerilogReader: Temporary buffer
    VerilogReader->>stringCopy: Copy temp buffer
    stringCopy-->>VerilogReader: Persistent copy
    VerilogReader->>Network: addGeneratedClockPinToCell(pinPath, cell)
    VerilogReader->>VerilogReader: reportLine (logging)

    Note over Sdc: makeClock()
    Sdc->>Sdc: Check generatedClockPinsToCellMap size
    alt Map not empty
        Sdc->>Sdc: createLibertyGeneratedClocks(clk)
        
        Note over Sdc: createLibertyGeneratedClocks()
        Sdc->>Network: Get generatedClockPinsToCellMap
        Network-->>Sdc: Map of pins to cells
        
        loop For each pin in map
            Sdc->>Network: findPin(pinName)
            Network-->>Sdc: Pin object
            
            alt Pin in clock network
                Sdc->>Sdc: reportLine "Found pin..." (logging)
                
                loop For each generated clock
                    Sdc->>stringPrintTmp: Format generated clock name
                    stringPrintTmp-->>Sdc: Temporary buffer
                    Sdc->>stringCopy: Copy temp buffer
                    stringCopy-->>Sdc: Persistent copy (generatedClockName)
                    Sdc->>Sdc: reportLine "Creating generated clock..." (logging)
                    Sdc->>Sdc: makeGeneratedClock(generatedClockName, ...)
                    Sdc->>Clock: new Clock(generatedClockName, ...)
                    Clock->>stringCopy: Copy name internally
                    stringCopy-->>Clock: Owned copy
                end
            end
        end
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 4a1078c in 17 seconds. Click for details.
  • Reviewed 52 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_ZN4QlIMwgsryMAC6

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 4df9d68 in 27 seconds. Click for details.
  • Reviewed 69 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_5iTlRLoi1uw9lk7x

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@akashlevy akashlevy merged commit 5aea94a into main Jan 30, 2026
6 checks passed
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.

2 participants