-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
units overhaul - get time & cap units from the tech library
- Loading branch information
1 parent
81a00ff
commit 788ebb9
Showing
17 changed files
with
122 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"name": "ASAP7 Library", | ||
"grid_unit": "0.001", | ||
"time_unit": "1 ps", | ||
"installs": [ | ||
{ | ||
"id": "$PDK", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
hammer/technology/sky130/extra/sky130-tech-gen-files/beginning_nda.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# lib_utils.py | ||
# Misc Liberty utilities | ||
# | ||
# See LICENSE for licence details. | ||
|
||
import re | ||
import os | ||
import gzip | ||
from decimal import Decimal | ||
from typing import List, Optional, Tuple | ||
__all__ = ['LIBUtils'] | ||
|
||
|
||
class LIBUtils: | ||
@staticmethod | ||
def get_time_unit(source: str) -> Optional[str]: | ||
""" | ||
Get the time unit from the given LIB source file. | ||
""" | ||
lines = LIBUtils.get_headers(source) | ||
try: | ||
match = next(line for line in lines if "time_unit" in line) | ||
# attibute syntax: time_unit : <value><unit> ; | ||
unit = re.split(" : | ; ", match)[1] | ||
return unit | ||
except StopIteration: # should not get here | ||
return None | ||
|
||
@staticmethod | ||
def get_cap_unit(source: str) -> Optional[str]: | ||
""" | ||
Get the load capacitance unit from the given LIB source file. | ||
""" | ||
lines = LIBUtils.get_headers(source) | ||
try: | ||
match = next(line for line in lines if "capacitive_load_unit" in line) | ||
# attibute syntax: capacitive_load_unit(<value>,<unit>); | ||
# Also need to capitalize last f to F | ||
split = re.split("\(|,|\)", match) | ||
return split[1] + split[2].strip()[:-1] + split[2].strip()[-1].upper() | ||
except StopIteration: # should not get here | ||
return None | ||
|
||
@staticmethod | ||
def get_headers(source: str) -> List[str]: | ||
""" | ||
Get the header lines with the major info | ||
""" | ||
nbytes = 10000 | ||
if source.split('.')[-1] == "gz": | ||
z = gzip.GzipFile(source) | ||
lines = z.peek(nbytes).splitlines() | ||
else: | ||
# TODO: handle other compressed file types? Tools only seem to support gzip. | ||
fd = os.open(source, os.O_RDONLY) | ||
lines = os.pread(fd, nbytes, 0).splitlines() | ||
return list(map(lambda l: l.decode('ascii', errors='ignore'), lines)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters