summaryrefslogtreecommitdiff
path: root/chip_design
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-12-12 01:28:23 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-12 01:28:23 +0100
commit40c3c72ff09f07e23f4bc6e46c86c6a4be72e94f (patch)
tree3042fa5dc142a3ecc2412c4575c21baa6ebe5de5 /chip_design
parent43205ebac5e3c0282de4ecd272c677d34a5baefc (diff)
download2IMF25-AR-40c3c72ff09f07e23f4bc6e46c86c6a4be72e94f.tar.gz
ChipDesign: add FIXME and print coordinate
Diffstat (limited to 'chip_design')
-rwxr-xr-xchip_design/generate-chipdesign.py12
-rwxr-xr-xchip_design/solution-to-latex.py26
2 files changed, 20 insertions, 18 deletions
diff --git a/chip_design/generate-chipdesign.py b/chip_design/generate-chipdesign.py
index d834078..23328ae 100755
--- a/chip_design/generate-chipdesign.py
+++ b/chip_design/generate-chipdesign.py
@@ -111,11 +111,15 @@ for i in range(len(powers), len(all_components)):
# Power (j) top/right side hits component (i) bottom/left side or
# Power (j) bottom/left side hits component (i) top/right side.
# (note: copied from above overlap check with '>='/'<=' -> '='.)
+ # Additionally: to "hit" the power resource over the X axis, an
+ # component Y coordinate must be within the power resource.
+ # FIXME need to check whether there is an overlap
+ pr_range = ' (>= x{j} )'
altpreds += fillin([
- '(= (+ y{j} h{j}) y{i})',
- '(= (+ x{j} w{j}) x{i})',
- '(= y{j} (+ y{i} h{i}))',
- '(= x{j} (+ x{i} w{i}))',
+ '(and (= (+ y{j} h{j}) y{i})'' )',
+ '(and (= (+ x{j} w{j}) x{i})'' )',
+ '(and (= y{j} (+ y{i} h{i}))'' )',
+ '(and (= x{j} (+ x{i} w{i}))'' )',
], vars())
preds += ['(or %s)' % ' \n'.join(altpreds)]
diff --git a/chip_design/solution-to-latex.py b/chip_design/solution-to-latex.py
index 798267a..6c74f4c 100755
--- a/chip_design/solution-to-latex.py
+++ b/chip_design/solution-to-latex.py
@@ -70,6 +70,11 @@ def print_boxes():
attrs = ','.join(attrs)
+ # HACK: print coords for debugging
+ if sys.argv[-1] == 'debug':
+ print(x, y, w, h)
+ continue
+
# For easier detection, reduce box dimension (add margin)
margin = 0.01
x += margin
@@ -80,22 +85,15 @@ def print_boxes():
tpl = r"\draw[{attrs}] ({x}, {y}) rectangle ({x2}, {y2});"
print(tpl.strip().format(**vars()))
+ # Reset for printing text
+ x, y, w, h = component
+ x2, y2 = x + w, y + h
+
# Draw number for debugging
tx = x + w/2
ty = y + h/2
- text = r"%s\\(%s x %s)" % (i, w, h)
+ text = r"%s\\(%s,%s)\\(%s x %s)" % (i, x, y, w, h)
print(r'\node[align=center] at (%f,%f) {%s};' % (tx, ty, text))
-def print_grid():
- # XXX currently hard-coding grid size
- print(r'\draw[step=1,gray,very thin] (0, 0) grid (30, 30);')
-
-if not True:
- # Complete picture
- print(r'\begin{tikzpicture}')
- print_grid()
- print_boxes()
- print(r'\end{tikzpicture}')
-else:
- # Just the boxes.
- print_boxes()
+# Just the boxes.
+print_boxes()