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 21 additions and 11 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
version: 2 version: 2
build: build:
os: "ubuntu-20.04" os: "ubuntu-24.04"
tools: tools:
python: "3.12" python: "3.12"
jobs: jobs:
+19 -10
View File
@@ -6,7 +6,7 @@ as an intermediate representation (:class:`DefFile` object).
from collections import defaultdict from collections import defaultdict
from lark import Lark, Transformer, Tree from lark import Lark, Transformer
from kyupy import readtext from kyupy import readtext
@@ -85,6 +85,8 @@ class DefFile:
self.pins = {} self.pins = {}
self.specialnets = {} self.specialnets = {}
self.nets = {} self.nets = {}
self.design = ""
self.diearea = 0
class DefTransformer(Transformer): class DefTransformer(Transformer):
@@ -140,9 +142,11 @@ class DefTransformer(Transformer):
def comp_stmt(self, args): def comp_stmt(self, args):
name = args[0].value name = args[0].value
kind = args[1].value kind = args[1].value
point = args[2] for aidx in range(2, len(args)):
orientation = args[3].value if args[aidx] in ('PLACED', 'FIXED'):
self.def_file.components[name] = (kind, point, orientation) point = args[aidx+1]
orientation = args[aidx+2].value
self.def_file.components[name] = (kind, point, orientation)
def pins_stmt(self, args): def pins_stmt(self, args):
pin = DefPin(args[0].value) pin = DefPin(args[0].value)
@@ -207,6 +211,7 @@ GRAMMAR = r"""
| /DIEAREA/ point+ ";" | /DIEAREA/ point+ ";"
| /ROW/ ID ID NUMBER NUMBER ID do_step ";" | /ROW/ ID ID NUMBER NUMBER ID do_step ";"
| /TRACKS/ /[XY]/ NUMBER "DO" NUMBER "STEP" NUMBER "LAYER" ID ";" | /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 | vias | nondef | comp | pins | pinprop | spnets | nets
propdef: "PROPERTYDEFINITIONS" propdef_stmt* "END" "PROPERTYDEFINITIONS" propdef: "PROPERTYDEFINITIONS" propdef_stmt* "END" "PROPERTYDEFINITIONS"
@@ -228,7 +233,9 @@ GRAMMAR = r"""
| "+" /VIA/ ID )* ";" | "+" /VIA/ ID )* ";"
comp: "COMPONENTS" NUMBER ";" comp_stmt* "END" "COMPONENTS" 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: "PINS" NUMBER ";" pins_stmt* "END" "PINS"
pins_stmt: "-" ID pins_opt* ";" pins_stmt: "-" ID pins_opt* ";"
@@ -239,6 +246,8 @@ GRAMMAR = r"""
| "+" /PORT/ | "+" /PORT/
| "+" /LAYER/ ID point point | "+" /LAYER/ ID point point
| "+" /PLACED/ point ID | "+" /PLACED/ point ID
| "+" /FIXED/ point ID
pinprop: "PINPROPERTIES" NUMBER ";" pinprop_stmt* "END" "PINPROPERTIES" pinprop: "PINPROPERTIES" NUMBER ";" pinprop_stmt* "END" "PINPROPERTIES"
pinprop_stmt: "-" "PIN" ID "+" "PROPERTY" ID STRING ";" pinprop_stmt: "-" "PIN" ID "+" "PROPERTY" ID STRING ";"
@@ -266,10 +275,10 @@ GRAMMAR = r"""
wire: ID wire_opt points wire: ID wire_opt points
wire_opt: ( "TAPER" | "TAPERRULE" ID )? ("STYLE" ID)? wire_opt: ( "TAPER" | "TAPERRULE" ID )? ("STYLE" ID)?
points: point ( point | points_via )+ points: point ( point | points_via_or_rect )+
points_via: ID ORIENTATION? 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) 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.""" """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): 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().' 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]] 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: if n in ppio2idx:
in_idxs[1] = self.zero_idx
if 'dff' in n.kind.lower() or in_idxs[0] == self.zero_idx: if 'dff' in n.kind.lower() or in_idxs[0] == self.zero_idx:
in_idxs[0] = self.ppi_offset + ppio2idx[n] 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. 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.