2009-08-03 19:12:47 +03:00
|
|
|
/*
|
|
|
|
* obj.c - Object definition model
|
|
|
|
*
|
2012-05-26 01:20:29 +03:00
|
|
|
* Written 2009-2012 by Werner Almesberger
|
|
|
|
* Copyright 2009-2012 by Werner Almesberger
|
2009-08-03 19:12:47 +03:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "error.h"
|
|
|
|
#include "expr.h"
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
#include "bitset.h"
|
2009-08-07 16:37:51 +03:00
|
|
|
#include "meas.h"
|
2009-08-03 19:12:47 +03:00
|
|
|
#include "inst.h"
|
2010-04-25 16:09:36 +03:00
|
|
|
#include "hole.h"
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
#include "overlap.h"
|
2009-09-13 14:11:03 +03:00
|
|
|
#include "layer.h"
|
2009-08-21 11:34:17 +03:00
|
|
|
#include "delete.h"
|
2012-05-27 20:09:40 +03:00
|
|
|
#include "fpd.h"
|
2009-08-03 19:12:47 +03:00
|
|
|
#include "obj.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_SILK_WIDTH make_mil(15) /* @@@ */
|
2009-08-22 17:29:48 +03:00
|
|
|
#define DEFAULT_OFFSET make_mil(0) /* @@@ */
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
#define MAX_ITERATIONS 1000 /* abort "loop"s at this limit */
|
|
|
|
|
|
|
|
|
2009-08-17 23:42:51 +03:00
|
|
|
char *pkg_name = NULL;
|
2009-08-03 19:12:47 +03:00
|
|
|
struct frame *frames = NULL;
|
|
|
|
struct frame *active_frame = NULL;
|
2009-08-13 12:30:16 +03:00
|
|
|
void *instantiation_error = NULL;
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
enum allow_overlap allow_overlap = ao_none;
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
static struct bitset *frame_set; /* frames visited in "call chain" */
|
|
|
|
|
|
|
|
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
/* ----- 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Added debugging directives to the fped language. They're describe at the end
of README.
- fpd.l, fpd.y, README: added debugging directives %del, %move, %print, %dump,
and %exit
- obj.h, fpd.y (find_obj, find_label, new_obj): objects can now be labeled
- obj.c (obj_anchors), inst.c (inst_anchors): gathering the list of anchors is
now a per-object function, not an instance "method". inst_anchors implements
the vector vs. object switch.
- inst.h, inst.c: removed all *_op_anchors functions
- expr.c (str_unit): in the past, we returned a malloc'ed string, but these
times are long gone. Thus, don't stralloc("").
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5919 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 17:39:57 +03:00
|
|
|
/* ----- Get the list of anchors of an object ------------------------------ */
|
|
|
|
|
|
|
|
|
|
|
|
int obj_anchors(struct obj *obj, struct vec ***anchors)
|
|
|
|
{
|
|
|
|
anchors[0] = &obj->base;
|
|
|
|
switch (obj->type) {
|
|
|
|
case ot_frame:
|
|
|
|
return 1;
|
|
|
|
case ot_rect:
|
|
|
|
case ot_line:
|
|
|
|
anchors[1] = &obj->u.rect.other;
|
|
|
|
return 2;
|
|
|
|
case ot_pad:
|
|
|
|
anchors[1] = &obj->u.pad.other;
|
|
|
|
return 2;
|
2010-04-25 13:58:07 +03:00
|
|
|
case ot_hole:
|
|
|
|
anchors[1] = &obj->u.hole.other;
|
|
|
|
return 2;
|
Added debugging directives to the fped language. They're describe at the end
of README.
- fpd.l, fpd.y, README: added debugging directives %del, %move, %print, %dump,
and %exit
- obj.h, fpd.y (find_obj, find_label, new_obj): objects can now be labeled
- obj.c (obj_anchors), inst.c (inst_anchors): gathering the list of anchors is
now a per-object function, not an instance "method". inst_anchors implements
the vector vs. object switch.
- inst.h, inst.c: removed all *_op_anchors functions
- expr.c (str_unit): in the past, we returned a malloc'ed string, but these
times are long gone. Thus, don't stralloc("").
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5919 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 17:39:57 +03:00
|
|
|
case ot_meas:
|
|
|
|
anchors[1] = &obj->u.meas.high;
|
|
|
|
return 2;
|
|
|
|
case ot_arc:
|
|
|
|
/*
|
|
|
|
* Put end point first so that this is what we grab if dragging
|
|
|
|
* a circle (thereby turning it into an arc).
|
|
|
|
*/
|
|
|
|
anchors[1] = &obj->u.arc.end;
|
|
|
|
anchors[2] = &obj->u.arc.start;
|
|
|
|
return 3;
|
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
/* ----- Instantiation ----------------------------------------------------- */
|
|
|
|
|
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
static int generate_frame(struct frame *frame, struct coord base,
|
2009-08-05 03:32:38 +03:00
|
|
|
const struct frame *parent, struct obj *frame_ref, int active);
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
|
2009-08-07 16:37:51 +03:00
|
|
|
struct num eval_unit(const struct expr *expr, const struct frame *frame);
|
|
|
|
/*static*/ struct num eval_unit(const struct expr *expr, const struct frame *frame)
|
2009-08-03 19:12:47 +03:00
|
|
|
{
|
|
|
|
struct num d;
|
|
|
|
|
|
|
|
d = eval_num(expr, frame);
|
|
|
|
if (!is_undef(d) && to_unit(&d))
|
|
|
|
return d;
|
|
|
|
fail_expr(expr);
|
|
|
|
return undef;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static struct num eval_unit_default(const struct expr *expr,
|
|
|
|
const struct frame *frame, struct num def)
|
|
|
|
{
|
|
|
|
if (expr)
|
|
|
|
return eval_unit(expr, frame);
|
|
|
|
to_unit(&def);
|
|
|
|
return def;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-25 22:46:26 +03:00
|
|
|
static int recurse_vec(const char *name, const struct frame *frame,
|
2011-10-25 22:13:11 +03:00
|
|
|
struct coord *res)
|
|
|
|
{
|
2011-10-25 22:46:26 +03:00
|
|
|
const struct vec *v;
|
|
|
|
|
|
|
|
if (!frame)
|
|
|
|
return 0;
|
|
|
|
for (v = frame->vecs; v; v = v->next)
|
|
|
|
if (v->name == name) {
|
|
|
|
*res = v->pos;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return recurse_vec(name, frame->curr_parent, res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int resolve_vec(const struct vec *vec, struct coord base_pos,
|
|
|
|
const struct frame *frame, struct coord *res)
|
|
|
|
{
|
|
|
|
const char *name = (const char *) vec;
|
|
|
|
|
|
|
|
if (!vec) {
|
|
|
|
*res = base_pos;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!*name) {
|
|
|
|
*res = vec->pos;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (recurse_vec(name, frame->curr_parent, res))
|
|
|
|
return 1;
|
|
|
|
fail("unknown vector \"%s\"", name);
|
|
|
|
return 0;
|
2011-10-25 22:13:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int generate_vecs(struct frame *frame, struct coord base_pos)
|
2009-08-03 19:12:47 +03:00
|
|
|
{
|
|
|
|
struct coord vec_base;
|
|
|
|
struct vec *vec;
|
|
|
|
struct num x, y;
|
|
|
|
|
|
|
|
for (vec = frame->vecs; vec; vec = vec->next) {
|
|
|
|
x = eval_unit(vec->x, frame);
|
|
|
|
if (is_undef(x))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
y = eval_unit(vec->y, frame);
|
|
|
|
if (is_undef(y))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(vec->base, base_pos, frame, &vec_base))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
vec->pos = vec_base;
|
|
|
|
vec->pos.x += x.n;
|
|
|
|
vec->pos.y += y.n;
|
|
|
|
if (!inst_vec(vec, vec_base))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
meas_post(vec, vec->pos, frame_set);
|
2009-08-03 19:12:47 +03:00
|
|
|
}
|
|
|
|
return 1;
|
2009-08-13 12:30:16 +03:00
|
|
|
|
|
|
|
error:
|
|
|
|
instantiation_error = vec;
|
|
|
|
return 0;
|
2009-08-03 19:12:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-25 22:13:11 +03:00
|
|
|
static int generate_objs(struct frame *frame, struct coord base_pos,
|
|
|
|
int active)
|
2009-08-03 19:12:47 +03:00
|
|
|
{
|
|
|
|
struct obj *obj;
|
|
|
|
char *name;
|
|
|
|
int ok;
|
2009-08-21 21:20:37 +03:00
|
|
|
struct num width, offset;
|
2011-10-25 22:13:11 +03:00
|
|
|
struct coord base, other, start, end;
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2011-10-25 22:13:11 +03:00
|
|
|
for (obj = frame->objs; obj; obj = obj->next) {
|
|
|
|
if (obj->type != ot_meas)
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->base, base_pos, frame, &base))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
switch (obj->type) {
|
|
|
|
case ot_frame:
|
2011-10-25 22:13:11 +03:00
|
|
|
if (!generate_frame(obj->u.frame.ref, base, frame, obj,
|
2009-08-04 00:10:49 +03:00
|
|
|
active && obj->u.frame.ref->active_ref == obj))
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case ot_line:
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.line.other, base_pos, frame,
|
|
|
|
&other))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
width = eval_unit_default(obj->u.line.width, frame,
|
|
|
|
DEFAULT_SILK_WIDTH);
|
|
|
|
if (is_undef(width))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2011-10-25 22:13:11 +03:00
|
|
|
if (!inst_line(obj, base, other, width.n))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
break;
|
|
|
|
case ot_rect:
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.rect.other, base_pos, frame,
|
|
|
|
&other))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
width = eval_unit_default(obj->u.rect.width, frame,
|
|
|
|
DEFAULT_SILK_WIDTH);
|
|
|
|
if (is_undef(width))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2011-10-25 22:13:11 +03:00
|
|
|
if (!inst_rect(obj, base, other, width.n))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
break;
|
|
|
|
case ot_pad:
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.pad.other, base_pos, frame,
|
|
|
|
&other))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
name = expand(obj->u.pad.name, frame);
|
|
|
|
if (!name)
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2011-10-25 22:13:11 +03:00
|
|
|
ok = inst_pad(obj, name, base, other);
|
2009-08-03 19:12:47 +03:00
|
|
|
free(name);
|
|
|
|
if (!ok)
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
break;
|
2010-04-25 13:58:07 +03:00
|
|
|
case ot_hole:
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.hole.other, base_pos, frame,
|
|
|
|
&other))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
|
|
|
if (!inst_hole(obj, base, other))
|
2010-04-25 13:58:07 +03:00
|
|
|
goto error;
|
|
|
|
break;
|
2009-08-03 19:12:47 +03:00
|
|
|
case ot_arc:
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.arc.start, base_pos, frame,
|
|
|
|
&start))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2011-10-25 22:46:26 +03:00
|
|
|
if (!resolve_vec(obj->u.arc.end, base_pos, frame,
|
|
|
|
&end))
|
2011-10-25 22:13:11 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
width = eval_unit_default(obj->u.arc.width, frame,
|
|
|
|
DEFAULT_SILK_WIDTH);
|
|
|
|
if (is_undef(width))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2011-10-25 22:13:11 +03:00
|
|
|
if (!inst_arc(obj, base, start, end, width.n))
|
2009-08-13 12:30:16 +03:00
|
|
|
goto error;
|
2009-08-03 19:12:47 +03:00
|
|
|
break;
|
|
|
|
case ot_meas:
|
2010-04-28 03:34:32 +03:00
|
|
|
assert(frame == frames);
|
2009-08-21 21:20:37 +03:00
|
|
|
offset = eval_unit_default(obj->u.meas.offset, frame,
|
2009-08-22 17:29:48 +03:00
|
|
|
DEFAULT_OFFSET);
|
2009-08-21 21:20:37 +03:00
|
|
|
if (is_undef(offset))
|
|
|
|
goto error;
|
|
|
|
inst_meas_hint(obj, offset.n);
|
2009-08-03 19:12:47 +03:00
|
|
|
break;
|
2012-05-27 20:09:40 +03:00
|
|
|
case ot_iprint:
|
|
|
|
dbg_print(obj->u.iprint.expr, frame);
|
|
|
|
break;
|
2009-08-03 19:12:47 +03:00
|
|
|
default:
|
|
|
|
abort();
|
|
|
|
}
|
2011-10-25 22:13:11 +03:00
|
|
|
}
|
2009-08-03 19:12:47 +03:00
|
|
|
return 1;
|
2009-08-13 12:30:16 +03:00
|
|
|
|
|
|
|
error:
|
|
|
|
instantiation_error = obj;
|
|
|
|
return 0;
|
2009-08-03 19:12:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int generate_items(struct frame *frame, struct coord base, int active)
|
|
|
|
{
|
2009-08-17 23:42:51 +03:00
|
|
|
char *s;
|
2009-08-03 19:12:47 +03:00
|
|
|
int ok;
|
|
|
|
|
2010-04-28 03:34:32 +03:00
|
|
|
if (frame == frames) {
|
2009-08-17 23:42:51 +03:00
|
|
|
s = expand(pkg_name, frame);
|
2011-09-15 02:37:54 +03:00
|
|
|
/* s is NULL if expansion failed */
|
2012-05-26 01:20:29 +03:00
|
|
|
inst_select_pkg(s ? s : "_", active);
|
2009-08-17 23:42:51 +03:00
|
|
|
free(s);
|
|
|
|
}
|
2009-08-03 19:12:47 +03:00
|
|
|
inst_begin_active(active && frame == active_frame);
|
|
|
|
ok = generate_vecs(frame, base) && generate_objs(frame, base, active);
|
|
|
|
inst_end_active();
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int run_loops(struct frame *frame, struct loop *loop,
|
|
|
|
struct coord base, int active)
|
|
|
|
{
|
|
|
|
struct num from, to;
|
|
|
|
int n;
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
int found_before, ok;
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
if (!loop)
|
|
|
|
return generate_items(frame, base, active);
|
|
|
|
from = eval_num(loop->from.expr, frame);
|
|
|
|
if (is_undef(from)) {
|
|
|
|
fail_expr(loop->from.expr);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = loop;
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!is_dimensionless(from)) {
|
|
|
|
fail("incompatible type for start value");
|
|
|
|
fail_expr(loop->from.expr);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = loop;
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
to = eval_num(loop->to.expr, frame);
|
|
|
|
if (is_undef(to)) {
|
|
|
|
fail_expr(loop->to.expr);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = loop;
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!is_dimensionless(to)) {
|
|
|
|
fail("incompatible type for end value");
|
|
|
|
fail_expr(loop->to.expr);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = loop;
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(!loop->initialized);
|
|
|
|
loop->curr_value = from.n;
|
|
|
|
loop->initialized = 1;
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
for (; loop->curr_value <= to.n; loop->curr_value += 1) {
|
|
|
|
if (n >= MAX_ITERATIONS) {
|
|
|
|
fail("%s: too many iterations (%d)", loop->var.name,
|
|
|
|
MAX_ITERATIONS);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = loop;
|
2009-08-03 19:12:47 +03:00
|
|
|
goto fail;
|
|
|
|
}
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
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)
|
2009-08-03 19:12:47 +03:00
|
|
|
goto fail;
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
if (found_before != found)
|
|
|
|
loop->found = n;
|
2009-08-03 19:12:47 +03:00
|
|
|
n++;
|
|
|
|
}
|
|
|
|
loop->initialized = 0;
|
When editing a variable or value, the actual value is now shown. The choice
of active frame reference, row, and loop instance affects this value, as it
should.
- obj.c (run_loops): reset loop->curr_value to UNDEF when instantiation is done
- obj.c (generate_frame): reset frame->curr_parent to NULL when instantiation
is done
- expr.c (eval_var, eval_string_var): distinguish beteen instantiation and
editing mode, and use "active" values in the latter
- gui_frame.c (edit_var, edit_value, edit_value_list): display the value of the
variable or the active expression in the "X" field
- gui_frame.c (assignment_value_select_event, table_value_select_event,
loop_from_select_event, loop_to_select_event): pass the frame to edit_value
and edit_value_list
- expr.c (str_unit): since we may now accidently expose a wider range of
exponents, removed -2 ... 2 exponent range limitation
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5788 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-10 15:09:55 +02:00
|
|
|
loop->curr_value = UNDEF;
|
2009-08-23 01:55:39 +03:00
|
|
|
if (active) {
|
|
|
|
loop->n = from.n;
|
|
|
|
loop->iterations = n;
|
|
|
|
}
|
2009-08-03 19:12:47 +03:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
loop->initialized = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int iterate_tables(struct frame *frame, struct table *table,
|
|
|
|
struct coord base, int active)
|
|
|
|
{
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
int found_before, ok;
|
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
if (!table)
|
|
|
|
return run_loops(frame, frame->loops, base, active);
|
|
|
|
for (table->curr_row = table->rows; table->curr_row;
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
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)
|
2009-08-03 19:12:47 +03:00
|
|
|
return 0;
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
if (found_before != found)
|
|
|
|
table->found_row = table->curr_row;
|
|
|
|
}
|
2009-08-03 19:12:47 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int generate_frame(struct frame *frame, struct coord base,
|
2009-08-05 03:32:38 +03:00
|
|
|
const struct frame *parent, struct obj *frame_ref, int active)
|
2009-08-03 19:12:47 +03:00
|
|
|
{
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We ensure during construction that frames can never recurse.
|
|
|
|
*/
|
2009-08-05 03:32:38 +03:00
|
|
|
inst_begin_frame(frame_ref, frame, base,
|
2009-08-04 21:03:06 +03:00
|
|
|
active && parent == active_frame,
|
|
|
|
active && frame == active_frame);
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
bitset_set(frame_set, frame->n);
|
2009-08-03 19:12:47 +03:00
|
|
|
frame->curr_parent = parent;
|
|
|
|
ok = iterate_tables(frame, frame->tables, base, active);
|
|
|
|
inst_end_frame(frame);
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
bitset_clear(frame_set, frame->n);
|
When editing a variable or value, the actual value is now shown. The choice
of active frame reference, row, and loop instance affects this value, as it
should.
- obj.c (run_loops): reset loop->curr_value to UNDEF when instantiation is done
- obj.c (generate_frame): reset frame->curr_parent to NULL when instantiation
is done
- expr.c (eval_var, eval_string_var): distinguish beteen instantiation and
editing mode, and use "active" values in the latter
- gui_frame.c (edit_var, edit_value, edit_value_list): display the value of the
variable or the active expression in the "X" field
- gui_frame.c (assignment_value_select_event, table_value_select_event,
loop_from_select_event, loop_to_select_event): pass the frame to edit_value
and edit_value_list
- expr.c (str_unit): since we may now accidently expose a wider range of
exponents, removed -2 ... 2 exponent range limitation
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5788 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-10 15:09:55 +02:00
|
|
|
frame->curr_parent = NULL;
|
2009-08-03 19:12:47 +03:00
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-23 01:55:39 +03:00
|
|
|
static void reset_all_loops(void)
|
|
|
|
{
|
|
|
|
const struct frame *frame;
|
|
|
|
struct loop *loop;
|
|
|
|
|
|
|
|
for (frame = frames; frame; frame = frame->next)
|
|
|
|
for (loop = frame->loops; loop; loop = loop->next)
|
|
|
|
loop->iterations = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
static int enumerate_frames(void)
|
|
|
|
{
|
|
|
|
struct frame *frame;
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
for (frame = frames; frame; frame = frame->next)
|
|
|
|
frame->n = n++;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
int instantiate(void)
|
|
|
|
{
|
|
|
|
struct coord zero = { 0, 0 };
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
int n_frames;
|
2009-08-03 19:12:47 +03:00
|
|
|
int ok;
|
|
|
|
|
2009-08-07 16:37:51 +03:00
|
|
|
meas_start();
|
2009-08-17 23:42:51 +03:00
|
|
|
inst_start();
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
n_frames = enumerate_frames();
|
|
|
|
frame_set = bitset_new(n_frames);
|
2009-08-13 12:30:16 +03:00
|
|
|
instantiation_error = NULL;
|
2009-08-23 01:55:39 +03:00
|
|
|
reset_all_loops();
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
reset_found();
|
|
|
|
found = 0;
|
|
|
|
search_suspended = 0;
|
2010-04-28 03:34:32 +03:00
|
|
|
ok = generate_frame(frames, zero, NULL, NULL, 1);
|
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
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 04:18:58 +02:00
|
|
|
if (ok && (find_vec || find_obj) && found)
|
|
|
|
activate_found();
|
|
|
|
find_vec = NULL;
|
|
|
|
find_obj = NULL;
|
2010-04-25 16:09:36 +03:00
|
|
|
if (ok)
|
|
|
|
ok = link_holes();
|
2009-09-13 14:11:03 +03:00
|
|
|
if (ok)
|
Added relaxation of pad overlap checking. Not GUI-settable yet.
- README, fpd.l, fpd.y: added directives "allow touch" and "allow overlap" to
make overlap checking more permissive
- dump.c (dump_allow, dump): generate "allow" directive
- obj.h, obj.c (allow_overlap): added global variable for strictness of overlap
checking
- overlap.h, overlap.c (overlap, ...), layer.h, layer.c (refine_layers):
strictness of overlap checking is passed as an argument
- hole.c (check_through_hole), layer.h, layer.c (refine_copper), obj.c
(instantiate): updated callers of "overlap" to provide "allow" argument
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5974 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-08-09 07:16:37 +03:00
|
|
|
ok = refine_layers(allow_overlap);
|
2009-08-07 16:37:51 +03:00
|
|
|
if (ok)
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
ok = instantiate_meas(n_frames);
|
2009-08-03 19:12:47 +03:00
|
|
|
if (ok)
|
|
|
|
inst_commit();
|
|
|
|
else
|
|
|
|
inst_revert();
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
bitset_free(frame_set);
|
2009-08-03 19:12:47 +03:00
|
|
|
return ok;
|
|
|
|
}
|
2009-08-21 11:34:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* ----- deallocation ------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
|
|
|
void obj_cleanup(void)
|
|
|
|
{
|
|
|
|
free(pkg_name);
|
|
|
|
while (frames) {
|
|
|
|
delete_frame(frames);
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|