3 Commits
Author SHA1 Message Date
stefan ea2ef1c3ec update rtd build image 2026-07-20 13:31:49 +09:00
stefan aabef17eea parse sky130 def files 2026-07-15 15:20:49 +09:00
stefan f0c10633bf disconnect unused clk from dff to prevent spurious sanity check fails 2026-07-05 10:26:37 +09:00
3 changed files with 20 additions and 10 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
version: 2
build:
os: "ubuntu-20.04"
os: "ubuntu-24.04"
tools:
python: "3.12"
jobs:
+18 -9
View File
@@ -6,7 +6,7 @@ as an intermediate representation (:class:`DefFile` object).
from collections import defaultdict
from lark import Lark, Transformer, Tree
from lark import Lark, Transformer
from kyupy import readtext
@@ -85,6 +85,8 @@ class DefFile:
self.pins = {}
self.specialnets = {}
self.nets = {}
self.design = ""
self.diearea = 0
class DefTransformer(Transformer):
@@ -140,8 +142,10 @@ class DefTransformer(Transformer):
def comp_stmt(self, args):
name = args[0].value
kind = args[1].value
point = args[2]
orientation = args[3].value
for aidx in range(2, len(args)):
if args[aidx] in ('PLACED', 'FIXED'):
point = args[aidx+1]
orientation = args[aidx+2].value
self.def_file.components[name] = (kind, point, orientation)
def pins_stmt(self, args):
@@ -207,6 +211,7 @@ GRAMMAR = r"""
| /DIEAREA/ point+ ";"
| /ROW/ ID ID NUMBER NUMBER ID do_step ";"
| /TRACKS/ /[XY]/ NUMBER "DO" NUMBER "STEP" NUMBER "LAYER" ID ";"
| /GCELLGRID/ /[XY]/ NUMBER "DO" NUMBER "STEP" NUMBER ";"
| propdef | vias | nondef | comp | pins | pinprop | spnets | nets
propdef: "PROPERTYDEFINITIONS" propdef_stmt* "END" "PROPERTYDEFINITIONS"
@@ -228,7 +233,9 @@ GRAMMAR = r"""
| "+" /VIA/ ID )* ";"
comp: "COMPONENTS" NUMBER ";" comp_stmt* "END" "COMPONENTS"
comp_stmt: "-" ID ID "+" "PLACED" point ID ";"
comp_stmt: "-" ID ID ( "+" /PLACED/ point ID
| "+" /FIXED/ point ID
| "+" /SOURCE/ ID )* ";"
pins: "PINS" NUMBER ";" pins_stmt* "END" "PINS"
pins_stmt: "-" ID pins_opt* ";"
@@ -239,6 +246,8 @@ GRAMMAR = r"""
| "+" /PORT/
| "+" /LAYER/ ID point point
| "+" /PLACED/ point ID
| "+" /FIXED/ point ID
pinprop: "PINPROPERTIES" NUMBER ";" pinprop_stmt* "END" "PINPROPERTIES"
pinprop_stmt: "-" "PIN" ID "+" "PROPERTY" ID STRING ";"
@@ -266,10 +275,10 @@ GRAMMAR = r"""
wire: ID wire_opt points
wire_opt: ( "TAPER" | "TAPERRULE" ID )? ("STYLE" ID)?
points: point ( point | points_via )+
points_via: ID ORIENTATION?
points: point ( point | points_via_or_rect )+
points_via_or_rect: ID ( ORIENTATION? | "(" (NUMBER|SIGNED_NUMBER|/\*/) (NUMBER|SIGNED_NUMBER|/\*/) (NUMBER|SIGNED_NUMBER|/\*/) (NUMBER|SIGNED_NUMBER|/\*/) ")" )
point: "(" (NUMBER|/\*/) (NUMBER|/\*/) NUMBER? ")"
point: "(" (NUMBER|SIGNED_NUMBER|/\*/) (NUMBER|SIGNED_NUMBER|/\*/) NUMBER? ")"
do_step: "DO" NUMBER "BY" NUMBER "STEP" (NUMBER|SIGNED_NUMBER) (NUMBER|SIGNED_NUMBER)
@@ -284,9 +293,9 @@ GRAMMAR = r"""
"""
def parse(text):
def parse(text) -> DefFile:
"""Parses the given ``text`` and returns a :class:`DefFile` object."""
return Lark(GRAMMAR, parser="lalr", transformer=DefTransformer()).parse(text)
return Lark(GRAMMAR, parser="lalr", transformer=DefTransformer()).parse(text) # type: ignore
def load(file):
+1
View File
@@ -204,6 +204,7 @@ class SimOps:
assert len(n.ins) <= 4, f'Too many input pins for node {n}. Map circuit to KYUPY techlib first using resolve_tlib_cells().'
in_idxs = [n.ins[x].index if len(n.ins) > x and n.ins[x] is not None else self.zero_idx for x in [0,1,2,3]]
if n in ppio2idx:
in_idxs[1] = self.zero_idx
if 'dff' in n.kind.lower() or in_idxs[0] == self.zero_idx:
in_idxs[0] = self.ppi_offset + ppio2idx[n]
else: # this is a PO that is also used within the circuit. Treat as normal fork with ref counting. TODO: check strip_forks=True case for this.