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

Feat(read_lib): Gz lib format support #362

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wjrforcyber
Copy link
Contributor

@wjrforcyber wjrforcyber commented Jan 21, 2025

Why this

According to some issues in thread: YosysHQ/yosys#4830 and YosysHQ/yosys#4830 (comment)
.gz format is needed.

How this is added

  1. I notice that read_aiger and read_blif support .gz format, I use the same function interface here and rename it as Io_LibLoadFileGz.
  2. As for p->nContents, I change it to a pointer, it will be updated by the gz interface, and it will remain the same in normal .lib format.

Test & verify

  • I use the Nangate45 lib file, gzip it and read it in abc to check the content of p->pContents, it can be verified to be the same.
  • Same output.
./abc -c "read_lib NangateOpenCellLibrary_typical.lib"
ABC command line: "read_lib NangateOpenCellLibrary_typical.lib".

Library "NangateOpenCellLibrary" from "NangateOpenCellLibrary_typical.lib" has 90 cells (35 skipped: 21 seq; 6 tri-state; 8 no func; 10 dont_use).  Time =     0.05 sec
Warning: Detected 2 multi-output gates (for example, "FA_X1").

./abc -c "read_lib NangateOpenCellLibrary_typical.lib.gz"
ABC command line: "read_lib NangateOpenCellLibrary_typical.lib.gz".

Library "NangateOpenCellLibrary" from "NangateOpenCellLibrary_typical.lib.gz" has 90 cells (35 skipped: 21 seq; 6 tri-state; 8 no func; 10 dont_use).  Time =     0.06 sec
Warning: Detected 2 multi-output gates (for example, "FA_X1").
  • No leaks.
leaks --atExit -- ./abc -c "read_lib NangateOpenCellLibrary_typical.lib"   
abc(34863) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null)
abc(34863) MallocStackLogging: recording malloc and VM allocation stacks using lite mode
ABC command line: "read_lib NangateOpenCellLibrary_typical.lib".

Library "NangateOpenCellLibrary" from "NangateOpenCellLibrary_typical.lib" has 90 cells (35 skipped: 21 seq; 6 tri-state; 8 no func; 10 dont_use).  Time =     0.05 sec
Warning: Detected 2 multi-output gates (for example, "FA_X1").
Process 34863 is not debuggable. Due to security restrictions, leaks can only show or save contents of readonly memory of restricted processes.

Process:         abc [34863]
Path:            /Users/USER/*/abc
Load Address:    0x1043d4000
Identifier:      abc
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  leaks [34862]

Date/Time:       2025-01-21 16:07:16.812 +0800
Launch Time:     2025-01-21 16:07:16.555 +0800
OS Version:      macOS 14.6 (23G80)
Report Version:  7
Analysis Tool:   /usr/bin/leaks

Physical footprint:         8785K
Physical footprint (peak):  17.8M
Idle exit:                  untracked
----

leaks Report Version: 4.0, multi-line stacks
Process 34863: 189 nodes malloced for 15 KB
Process 34863: 0 leaks for 0 total leaked bytes.
leaks --atExit -- ./abc -c "read_lib NangateOpenCellLibrary_typical.lib.gz"
abc(35732) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null)
abc(35732) MallocStackLogging: recording malloc and VM allocation stacks using lite mode
ABC command line: "read_lib NangateOpenCellLibrary_typical.lib.gz".

Library "NangateOpenCellLibrary" from "NangateOpenCellLibrary_typical.lib.gz" has 90 cells (35 skipped: 21 seq; 6 tri-state; 8 no func; 10 dont_use).  Time =     0.07 sec
Warning: Detected 2 multi-output gates (for example, "FA_X1").
Process 35732 is not debuggable. Due to security restrictions, leaks can only show or save contents of readonly memory of restricted processes.

Process:         abc [35732]
Path:            /Users/USER/*/abc
Load Address:    0x102b38000
Identifier:      abc
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  leaks [35731]

Date/Time:       2025-01-21 16:07:27.548 +0800
Launch Time:     2025-01-21 16:07:27.313 +0800
OS Version:      macOS 14.6 (23G80)
Report Version:  7
Analysis Tool:   /usr/bin/leaks

Physical footprint:         10.8M
Physical footprint (peak):  18.6M
Idle exit:                  untracked
----

leaks Report Version: 4.0, multi-line stacks
Process 35732: 189 nodes malloced for 15 KB
Process 35732: 0 leaks for 0 total leaked bytes.

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.

1 participant