--- Begin Message ---
Author: daveb
Date: 2010-01-11 18:39:57 +0100 (Mon, 11 Jan 2010)
New Revision: 5791
Added:
trunk/gta02-core/modules/dtc123je.fpd
trunk/gta02-core/modules/ms2v-t1s.fpd
trunk/gta02-core/modules/tas4025a.fpd
Modified:
trunk/gta02-core/AUTHORS
trunk/gta02-core/modules/INFO
trunk/gta02-core/modules/STATUS
trunk/gta02-core/modules/mkloe
Log:
some small components
Modified: trunk/gta02-core/AUTHORS
===================================================================
--- trunk/gta02-core/AUTHORS 2010-01-10 22:11:46 UTC (rev 5790)
+++ trunk/gta02-core/AUTHORS 2010-01-11 17:39:57 UTC (rev 5791)
@@ -13,10 +13,13 @@
components/sc32442.lib
components/wm8753lgefl.lib
modules/bf2520.fpd
+ modules/dtc123je.fpd
modules/ht210.fpd
modules/k4m51323pe.fpd
+ modules/ms2v-t1s.fpd
modules/pcf50633-04-n3.fpd
modules/smsn16.fpd
+ modules/tas4025a.fpd
modules/u.fl-r-smt-1.fpd
Compilations:
Modified: trunk/gta02-core/modules/INFO
===================================================================
--- trunk/gta02-core/modules/INFO 2010-01-10 22:11:46 UTC (rev 5790)
+++ trunk/gta02-core/modules/INFO 2010-01-11 17:39:57 UTC (rev 5791)
@@ -122,3 +122,9 @@
# Rohm 1SS400 diode, SOD-523 (JEDEC) aka EMD2 (Rohm) aka SC-79 (JEITA)
F: sod-523
S: 1ss400
+
+#dtc123je
+F: dtc123je
+D:
http://www.digikey.com/Web%20Export/Supplier%20Content/ROHM_511/PDF/Rohm_TransistorSoldering.pdf
+
+
Modified: trunk/gta02-core/modules/STATUS
===================================================================
--- trunk/gta02-core/modules/STATUS 2010-01-10 22:11:46 UTC (rev 5790)
+++ trunk/gta02-core/modules/STATUS 2010-01-11 17:39:57 UTC (rev 5791)
@@ -4,6 +4,7 @@
bf2520 Dave
bga96-8x12-0mm8 Werner
dfbm-cs320 Rene
+dtc123je Dave
exc24c Rene
fa2012 Rene
fh23-39s-0.3shw Rene pin numbering needs to be
verified
@@ -12,14 +13,16 @@
k4m51323pe Dave
lis302dl Rene DRAFT
mini-usb Rene drill holes still missing!
+ms2v-t1s.fpd Dave
pcf50633-04-n3 Dave
-smsn16 Dave DRAFT
+smsn16 Dave DRAFT (missing drill holes)
sc70-5 Rene
sc89-6 Rene
sod-523 Werner DRAFT
son1408-3 Rene
sot23-5 Rene
stdpass Werner EXPERIMENTAL - DO NOT USE YET
+tas4025a Dave
tdfn34-16 Rene
tsop-6 Rene
tst Werner
Added: trunk/gta02-core/modules/dtc123je.fpd
===================================================================
--- trunk/gta02-core/modules/dtc123je.fpd (rev 0)
+++ trunk/gta02-core/modules/dtc123je.fpd 2010-01-11 17:39:57 UTC (rev
5791)
@@ -0,0 +1,22 @@
+/* MACHINE-GENERATED ! */
+
+package "dtc123je"
+unit mm
+__0: vec @(0mm, 1.3mm)
+__1: vec __0(-0.7mm/2, 0.7mm/2)
+__2: vec .(0.7mm, -0.7mm)
+pad "3" __1 .
+__3: vec @(0.5mm, 0mm)
+__4: vec __3(-0.6mm/2, 0.7mm/2)
+__5: vec .(0.6mm, -0.7mm)
+pad "1" __4 .
+__6: vec @(-0.5mm, 0mm)
+__7: vec __6(-0.6mm/2, 0.7mm/2)
+__8: vec .(0.6mm, -0.7mm)
+pad "2" __7 .
+measx __6 >> __3 -0.5mm
+measy __3 >> __0 -0.5mm
+measy __8 >> __7 0.8mm
+measx __7 >> __8 0.2mm
+measx __1 >> __2 0.2mm
+measy __2 >> __1 0.9mm
Modified: trunk/gta02-core/modules/mkloe
===================================================================
--- trunk/gta02-core/modules/mkloe 2010-01-10 22:11:46 UTC (rev 5790)
+++ trunk/gta02-core/modules/mkloe 2010-01-11 17:39:57 UTC (rev 5791)
@@ -4,7 +4,8 @@
MODS="332fbga-p05 bga96-8x12-0mm8 ge865 stdpass tst wm3236aq wm8753fl lis302dl"
MODS="$MODS dfbm-cs320 exc24c sc70-5 vssop8 sot23-5 tdfn34-16 mini-usb tsop-6"
MODS="$MODS sc89-6 son1408-3 fh23-39s-0.3shw fa2012 smsn16 wlcsp12-p05 sod-523"
-MODS="$MODS u.fl-r-smt-1 ht210 k4m51323pe pcf50633-04-n3 bf2520"
+MODS="$MODS u.fl-r-smt-1 ht210 k4m51323pe pcf50633-04-n3 bf2520 ms2v-t1s"
+MODS="$MODS tas4025a dtc123je"
LIB=gta02-core.mod
Added: trunk/gta02-core/modules/ms2v-t1s.fpd
===================================================================
--- trunk/gta02-core/modules/ms2v-t1s.fpd (rev 0)
+++ trunk/gta02-core/modules/ms2v-t1s.fpd 2010-01-11 17:39:57 UTC (rev
5791)
@@ -0,0 +1,20 @@
+/* MACHINE-GENERATED ! */
+
+package "MS2V-T1S"
+unit mm
+__0: vec @(-2mm, 2mm/2)
+__1: vec __0(2mm, -2mm)
+pad "3" __0 .
+__2: vec @(3.8mm, 0.6mm/2)
+__3: vec __2(1.6mm, 0.7mm)
+pad "1" __2 .
+__4: vec @(3.8mm, -0.6mm/2)
+__5: vec __4(1.6mm, -0.7mm)
+pad "2" __4 .
+measx __1 >> __4 -0.5mm
+measx __4 >> __5 -1.2mm
+measy __5 >> __4 -0.5mm
+measy __4 >> __2 -2.1mm
+measx __0 >> __1 -2.5mm
+measy __1 >> __0 2.5mm
+measy __2 >> __3 -2.1mm
Added: trunk/gta02-core/modules/tas4025a.fpd
===================================================================
--- trunk/gta02-core/modules/tas4025a.fpd (rev 0)
+++ trunk/gta02-core/modules/tas4025a.fpd 2010-01-11 17:39:57 UTC (rev
5791)
@@ -0,0 +1,24 @@
+/* MACHINE-GENERATED ! */
+
+package "tas4025a"
+unit mm
+__0: vec @(-3mm/2, 1.6mm/2)
+__1: vec __0(-1.4mm/2, 1.15mm/2)
+__2: vec .(1.4mm, -1.15mm)
+pad "4" __1 .
+__3: vec @(3mm/2, -1.6mm/2)
+__8: vec __3(-1.4mm/2, 1.15mm/2)
+__11: vec __8(1.4mm, -1.15mm)
+pad "2" __8 .
+__4: vec @(3mm/2, 1.6mm/2)
+__9: vec __4(-1.4mm/2, 1.15mm/2)
+__10: vec .(1.4mm, -1.15mm)
+pad "3" __9 .
+__5: vec @(-3mm/2, -1.6mm/2)
+__6: vec __5(-1.4mm/2, 1.15mm/2)
+__7: vec .(1.4mm, -1.15mm)
+pad "1" __6 .
+measx __5 >> __3 -1mm
+measy __3 >> __4 -1.2mm
+measx __1 >> __2 0.5mm
+measy __2 >> __1 1.9mm
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-01-12 03:18:58 +0100 (Tue, 12 Jan 2010)
New Revision: 5792
Modified:
trunk/eda/fped/inst.c
trunk/eda/fped/obj.c
trunk/eda/fped/obj.h
Log:
When clicking on an instance, fped used to select the currenly active instance
of the corresponding object but didn't change any table or loop selection to
make it active. (It did already change the frame reference.) This meant that,
upon clicking on an instance, often a different instance of the same object
would be selected. This was confusing at best.
With the below changes, table rows and loop iterations are adjusted such that
the instance that was clicked on becomes active. If the algorithm fails, fped
will print "__inst_select: tries exhausted" and fail safely. Please report if
this happens.
- obj.c (search_inst, find_inst, instantiate): added mechanism to search for
instances matching a previous instance
- obj.c (run_loops, iterate_tables): record matches in found_* elements of the
object's struct
- obj.c (reset_found, activate_found): helper functions to initialize and apply
the activation leading to the instance found
- inst.c (activate_item): added comment explaining how activate_item is
supposed to work and the fallacies of that logic
- inst.c (inst_select): added tries counter to avoid infinite recursion when
results don't converge
- inst.c (__inst_select): when selecting an instance in the same frame, adjust
tables and loops such that the instance becomes active
- inst.c: added call to find_inst after most instance creations (add_inst)
- obj.h: documented the meaning of the curr[ent]*, active*, and found* fields
Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c 2010-01-11 17:39:57 UTC (rev 5791)
+++ trunk/eda/fped/inst.c 2010-01-12 02:18:58 UTC (rev 5792)
@@ -162,6 +162,34 @@
}
+/*
+ * @@@ This logic is overly complicated and should be simplified. The general
+ * idea was to avoid making unnecessary changes to the user's selections, but
+ * that risk doesn't exist. Furthermore, the way activate_item is used, its
+ * preconditions aren't met. It works anyway but it could be simpler as a
+ * consequence.
+ *
+ * activate_item tries to activate the path through the frame references,
+ * leading to a specific instance. It returns whether this is failed or whether
+ * it may have been successful.
+ *
+ * The initial condition is that we want to activate an item on a frame
+ * instance that's not active. Since the frame has been instantiated, there
+ * must be a way to activate it. We just have to find out how.
+ *
+ * The first test eliminates the root frame. If we're at the root frame and
+ * still haven't figured out what to do, something is wrong and we give up.
+ *
+ * The next test skips references that are already right. Since we know that
+ * there must be at least one reference that leads elsewhere, and we haven't
+ * found it yet, the recursion will tell us whether it can find it at all.
+ *
+ * Finally, if we've found a mismatch, we correct it. We then try to fix any
+ * further mismatches. Since we've made progress, we return 1, even if the
+ * other fixes should fail (or reach the root frame).
+ *
+ */
+
static int activate_item(struct inst *inst)
{
if (!inst->outer)
@@ -174,7 +202,7 @@
}
-int inst_select(struct coord pos)
+static int __inst_select(struct coord pos, int tries)
{
enum inst_prio prio;
const struct inst *prev;
@@ -188,6 +216,10 @@
int select_next;
int dist, i;
+ if (!tries) {
+ fprintf(stderr, "__inst_select: tries exhausted\n");
+ return 0;
+ }
prev = selected_inst;
deselect_outside();
edit_nothing();
@@ -259,14 +291,17 @@
return 0;
if (any_same_frame) {
- if (activate_item(any_same_frame))
- return inst_select(pos);
+ activate_item(any_same_frame);
+ search_inst(any_same_frame);
+ instantiate();
+ change_world();
+ return __inst_select(pos, tries-1);
}
if (any_first) {
frame = any_first->outer ? any_first->outer->u.frame.ref : NULL;
if (frame != active_frame) {
select_frame(frame);
- return inst_select(pos);
+ return __inst_select(pos, tries-1);
}
}
@@ -278,6 +313,17 @@
}
+int inst_select(struct coord pos)
+{
+ /*
+ * We shouldn't need more than 2 tries to select any item, so 5 is more
+ * than enough. This can still fail, but then it would for any number
+ * of tries.
+ */
+ return __inst_select(pos, 5);
+}
+
+
struct inst *inst_find_point(struct coord pos)
{
struct inst *inst, *found;
@@ -696,6 +742,7 @@
inst = add_inst(&vec_ops, ip_vec, base);
inst->vec = vec;
inst->u.vec.end = vec->pos;
+ find_inst(inst);
update_bbox(&inst->bbox, vec->pos);
propagate_bbox(inst);
return 1;
@@ -745,6 +792,7 @@
inst->obj = obj;
inst->u.rect.end = b;
inst->u.rect.width = width;
+ find_inst(inst);
update_bbox(&inst->bbox, b);
grow_bbox_by_width(&inst->bbox, width);
propagate_bbox(inst);
@@ -785,6 +833,7 @@
inst->obj = obj;
inst->u.rect.end = b;
inst->u.rect.width = width;
+ find_inst(inst);
update_bbox(&inst->bbox, b);
grow_bbox_by_width(&inst->bbox, width);
propagate_bbox(inst);
@@ -873,6 +922,7 @@
inst->u.pad.name = stralloc(name);
inst->u.pad.other = b;
inst->u.pad.layers = pad_type_to_layers(obj->u.pad.type);
+ find_inst(inst);
update_bbox(&inst->bbox, b);
propagate_bbox(inst);
return 1;
@@ -946,6 +996,7 @@
inst->bbox.max.x = center.x+r;
inst->bbox.min.y = center.y-r;
inst->bbox.max.y = center.y+r;
+ find_inst(inst);
grow_bbox_by_width(&inst->bbox, width);
propagate_bbox(inst);
return 1;
@@ -1122,6 +1173,7 @@
inst->u.frame.ref = frame;
inst->u.frame.active = is_active_frame;
inst->active = active;
+ find_inst(inst);
curr_frame = inst;
}
Modified: trunk/eda/fped/obj.c
===================================================================
--- trunk/eda/fped/obj.c 2010-01-11 17:39:57 UTC (rev 5791)
+++ trunk/eda/fped/obj.c 2010-01-12 02:18:58 UTC (rev 5792)
@@ -38,6 +38,67 @@
void *instantiation_error = NULL;
+/* ----- Searching --------------------------------------------------------- */
+
+
+/*
+ * @@@ Known bug: we should compare all parameters of an instance, not just the
+ * object's base or the vectors end.
+ */
+
+static int found = 0;
+static int search_suspended = 0;
+static const struct vec *find_vec = NULL;
+static const struct obj *find_obj = NULL;
+static struct coord find_pos;
+
+
+static void suspend_search(void)
+{
+ search_suspended++;
+}
+
+static void resume_search(void)
+{
+ assert(search_suspended > 0);
+ search_suspended--;
+}
+
+
+static struct coord get_pos(const struct inst *inst)
+{
+ return inst->obj ? inst->base : inst->u.vec.end;
+}
+
+
+void find_inst(const struct inst *inst)
+{
+ struct coord pos;
+
+ if (search_suspended)
+ return;
+ if (find_vec != inst->vec)
+ return;
+ if (find_obj != inst->obj)
+ return;
+ pos = get_pos(inst);
+ if (pos.x != find_pos.x || pos.y != find_pos.y)
+ return;
+ found++;
+}
+
+
+void search_inst(const struct inst *inst)
+{
+ find_vec = inst->vec;
+ find_obj = inst->obj;
+ find_pos = get_pos(inst);
+}
+
+
+/* ----- Instantiation ----------------------------------------------------- */
+
+
static int generate_frame(struct frame *frame, struct coord base,
const struct frame *parent, struct obj *frame_ref, int active);
@@ -192,6 +253,7 @@
{
struct num from, to;
int n;
+ int found_before, ok;
if (!loop)
return generate_items(frame, base, active);
@@ -233,9 +295,17 @@
instantiation_error = loop;
goto fail;
}
- if (!run_loops(frame, loop->next, base,
- active && loop->active == n))
+ found_before = found;
+ if (loop->found == loop->active)
+ suspend_search();
+ ok = run_loops(frame, loop->next, base,
+ active && loop->active == n);
+ if (loop->found == loop->active)
+ resume_search();
+ if (!ok)
goto fail;
+ if (found_before != found)
+ loop->found = n;
n++;
}
loop->initialized = 0;
@@ -255,13 +325,24 @@
static int iterate_tables(struct frame *frame, struct table *table,
struct coord base, int active)
{
+ int found_before, ok;
+
if (!table)
return run_loops(frame, frame->loops, base, active);
for (table->curr_row = table->rows; table->curr_row;
- table->curr_row = table->curr_row->next)
- if (!iterate_tables(frame, table->next, base,
- active && table->active_row == table->curr_row))
+ table->curr_row = table->curr_row->next) {
+ found_before = found;
+ if (table->found_row == table->active_row)
+ suspend_search();
+ ok = iterate_tables(frame, table->next, base,
+ active && table->active_row == table->curr_row);
+ if (table->found_row == table->active_row)
+ resume_search();
+ if (!ok)
return 0;
+ if (found_before != found)
+ table->found_row = table->curr_row;
+ }
return 1;
}
@@ -296,6 +377,46 @@
}
+static void reset_found(void)
+{
+ struct frame *frame;
+ struct table *table;
+ struct loop *loop;
+
+ for (frame = frames; frame; frame = frame->next) {
+ for (table = frame->tables; table; table = table->next)
+ table->found_row = NULL;
+ for (loop = frame->loops; loop; loop = loop->next)
+ loop->found = -1;
+ frame->found_ref = NULL;
+ }
+}
+
+
+/*
+ * Note: we don't use frame->found_ref yet. Instead, we adjust the frame
+ * references with activate_item in inst.c
+ */
+
+static void activate_found(void)
+{
+ struct frame *frame;
+ struct table *table;
+ struct loop *loop;
+
+ for (frame = frames; frame; frame = frame->next) {
+ for (table = frame->tables; table; table = table->next)
+ if (table->found_row)
+ table->active_row = table->found_row;
+ for (loop = frame->loops; loop; loop = loop->next)
+ if (loop->found != -1)
+ loop->active = loop->found;
+ if (frame->found_ref)
+ frame->active_ref = frame->found_ref;
+ }
+}
+
+
int instantiate(void)
{
struct coord zero = { 0, 0 };
@@ -305,7 +426,14 @@
inst_start();
instantiation_error = NULL;
reset_all_loops();
+ reset_found();
+ found = 0;
+ search_suspended = 0;
ok = generate_frame(root_frame, zero, NULL, NULL, 1);
+ if (ok && (find_vec || find_obj) && found)
+ activate_found();
+ find_vec = NULL;
+ find_obj = NULL;
if (ok)
ok = refine_layers();
if (ok)
Modified: trunk/eda/fped/obj.h
===================================================================
--- trunk/eda/fped/obj.h 2010-01-11 17:39:57 UTC (rev 5791)
+++ trunk/eda/fped/obj.h 2010-01-12 02:18:58 UTC (rev 5792)
@@ -1,8 +1,8 @@
/*
* obj.h - Object definition model
*
- * Written 2009 by Werner Almesberger
- * Copyright 2009 by Werner Almesberger
+ * Written 2009, 2010 by Werner Almesberger
+ * Copyright 2009, 2010 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,34 @@
#include "layer.h"
+/*
+ * Objects contain various fields that help to select instances under various
+ * conditions. They are "current", "active", and "found":
+ *
+ * - current: the path taken while instantiating. E.g., we may make one frame
+ * reference the "current" reference of this frame and then recurse into it.
+ * "Current" is reset to a null value after instantiation is complete, to
+ * allow other functions (such as expression evaluation) to distinguish
+ * between instantiation and editing.
+ *
+ * - active: the path selected by the user, through the GUI. This allows the
+ * user to reach any instance, similar to how instantiation visits all
+ * instances. The difference to "current" is that "active" is persistent
+ * across instantiation while "current" iterates through all possible values
+ * during instantiation.
+ *
+ * - found: then clicking on an unselected instance, fped will try to activate
+ * this instance. In order to do so, it needs to determine which choices need
+ * to be activated to reach the instance. "Found" records this information.
+ * At the end of the search, all "found" choices become "active".
+ *
+ * If, during the search, an instance can be reached with the "found" choice
+ * being equal to the choice active at that time, "found" will not be set to
+ * any other value. This prevents searches from affecting choices that play
+ * no role in the selection of the instance.
+ */
+
+
struct var {
const char *name;
struct var *next;
@@ -67,6 +95,9 @@
/* GUI use */
struct row *active_row;
+
+ /* For searching */
+ struct row *found_row; /* NULL if not found yet */
};
struct loop {
@@ -83,6 +114,9 @@
double n; /* start value when it was active */
int iterations; /* iterations when it was active */
+ /* For searching */
+ int found; /* -1 if not found yet */
+
/* for evaluation */
int initialized;
};
@@ -127,6 +161,9 @@
/* generating and editing */
struct obj *active_ref;
+ /* For searching */
+ struct obj *found_ref; /* NULL if not found yet */
+
/* for dumping */
int dumped;
@@ -196,6 +233,24 @@
extern void *instantiation_error;
+struct inst;
+
+/*
+ * Search callback from inst, invoked after the instance has been populated.
+ */
+
+void find_inst(const struct inst *inst);
+
+/*
+ * If invoking search_inst before calling "instantiate", loop and tables are
+ * adjusted such that an instance matching the one passed to search_inst will
+ * become active. Note that this doesn't necessarily succeed, in which case no
+ * change is made. Also, if multiple matches are encountered, the result is
+ * arbitrary.
+ */
+
+void search_inst(const struct inst *inst);
+
int instantiate(void);
void obj_cleanup(void);
--- End Message ---