Skip to content

Commit

Permalink
Xic: FastHenry interface, got rid of FhMinRect and FhMinManhPart
Browse files Browse the repository at this point in the history
variables, new variable FhManhGridCnt.  The minimum size used to
approximate non-Manhattan is sqrt((area of interest)/FhManhGridCnt).
Larger is more accurate but slower, similar to FhVolElTarget.  Range
is 1e2-1e5 default 1e3.  Entry on Params page of pop-up.
  • Loading branch information
wrcad committed Nov 18, 2019
1 parent e9966e8 commit 004fba4
Showing 6 changed files with 52 additions and 127 deletions.
12 changes: 4 additions & 8 deletions xic/include/ext_fh.h
Original file line number Diff line number Diff line change
@@ -56,8 +56,7 @@
#define VA_FhFreq "FhFreq"
#define VA_FhLayerName "FhLayerName"
#define VA_FhMonitor "FhMonitor"
#define VA_FhMinRectSize "FhMinRectSize"
#define VA_FhMinManhPartSize "FhMinManhPartSize"
#define VA_FhManhGridCnt "FhManhGridCnt"
#define VA_FhUnits "FhUnits"
#define VA_FhVolElTarget "FhVolElTarget"

@@ -67,12 +66,9 @@
#define FH_LAYER_NAME "FHRY"

// Default partitioning params, microns
#define FH_MIN_RECT_SIZE_DEF 1.0
#define FH_MIN_RECT_SIZE_MIN 0.01
#define FH_MIN_RECT_SIZE_MAX 10.0
#define FH_MIN_MANH_PART_SIZE_DEF 5.0
#define FH_MIN_MANH_PART_SIZE_MIN 1.0
#define FH_MIN_MANH_PART_SIZE_MAX 10.0
#define FH_MIN_MANH_GRID_CNT 1e2
#define FH_MAX_MANH_GRID_CNT 1e5
#define FH_DEF_MANH_GRID_CNT 1e3

#define FH_MIN_TARG_VOLEL 1e2
#define FH_MAX_TARG_VOLEL 1e5
4 changes: 2 additions & 2 deletions xic/include/tech_ldb3d.h
Original file line number Diff line number Diff line change
@@ -159,9 +159,9 @@ struct Ldb3d
}

bool init_for_extraction(CDs *sd, const BBox *BB, const char *fn,
double d, double t, int manh_min=0, int manh_mode=0)
double d, double t, int manh_gcnt=0, int manh_mode=0)
{
return (init_stack(sd, BB, false, fn, d, t, manh_min, manh_mode));
return (init_stack(sd, BB, false, fn, d, t, manh_gcnt, manh_mode));
}

bool order_layers();
41 changes: 10 additions & 31 deletions xic/src/extract/ext_fh.cc
Original file line number Diff line number Diff line change
@@ -479,22 +479,16 @@ fhLayout::fhLayout()
lname = FH_LAYER_NAME;

// This is used only when approximating non-Manhattan edges.
int manh_min = INTERNAL_UNITS(FH_MIN_MANH_PART_SIZE_DEF);
const char *var = CDvdb()->getVariable(VA_FhMinManhPartSize);
int manh_gcnt = FH_DEF_MANH_GRID_CNT;
const char *var = CDvdb()->getVariable(VA_FhManhGridCnt);
if (var) {
double val = atof(var);
if (val >= FH_MIN_MANH_PART_SIZE_MIN &&
val <= FH_MIN_MANH_PART_SIZE_MAX)
manh_min = INTERNAL_UNITS(val);
}
int manh_mode = 0;
//XXX var = CDvdb()->getVariable(VA_FhManhMode);
var = CDvdb()->getVariable("FhManhMode");
if (var)
manh_mode = (atoi(var) != 0);
int val = atoi(var);
if (val >= FH_MIN_MANH_GRID_CNT && val <= FH_MAX_MANH_GRID_CNT)
manh_gcnt = val;
}
if (!init_for_extraction(CurCell(Physical), 0, lname,
Tech()->SubstrateEps(), Tech()->SubstrateThickness(),
manh_min, manh_mode)) {
manh_gcnt, 0)) {
Errs()->add_error("Layer setup failed.");
}
}
@@ -597,8 +591,6 @@ fhLayout::setup()
if (!num_layers())
return (false);

//XXX
printf("x1\n");
// Create debugging layers/zoids if set.
fhl_zoids = CDvdb()->getVariable(VA_FhZoids);

@@ -643,12 +635,8 @@ printf("x1\n");
c->set_siglam(sigma, lambda);
}
}
//XXX
printf("x2\n");

slice_groups(max_rect_size);
//XXX
printf("x3\n");

// Cut at outside edges of other objects, along the long
// dimension first, then the short dimension.
@@ -711,15 +699,11 @@ printf("x3\n");
}
}
}
//XXX
printf("x4\n");

// Do the self-cutting again, to propagate new boundaries.
//
slice_groups(0);
slice_groups_z(max_rect_size);
//XXX
printf("x5\n");

if (db3_logfp) {
int ztot = 0;
@@ -749,8 +733,9 @@ printf("x5\n");
cd->segmentize(fhl_ngen);
}
}
//XXX
printf("x6 %d\n", fhl_ngen.allocated());
if (db3_logfp) {
TPRINT("Nodes allocated=%d\n", fhl_ngen.allocated());
}

// Create terminals array.
fhl_terms = new fhTermList*[num_groups()];
@@ -837,8 +822,6 @@ printf("x6 %d\n", fhl_ngen.allocated());
if (err)
return (false);

//XXX
printf("x6a\n");
// Set the terminal nodes.
//
for (int i = 0; i < num_groups(); i++) {
@@ -859,8 +842,6 @@ printf("x6a\n");
tp = t;
}
}
//XXX
printf("x6b\n");

char *s = check_sort_terms();
if (s) {
@@ -878,8 +859,6 @@ printf("x6b\n");
}
}
}
//XXX
printf("x7\n");
return (true);
}

31 changes: 5 additions & 26 deletions xic/src/extract/ext_variables.cc
Original file line number Diff line number Diff line change
@@ -702,37 +702,17 @@ namespace {
}

bool
evFhMinRectSize(const char *vstring, bool set)
evFhManhGridCnt(const char *vstring, bool set)
{
if (set) {
double pmin = FH_MIN_RECT_SIZE_MIN;
double pmax = FH_MIN_RECT_SIZE_MAX;
double pmin = FH_MIN_MANH_GRID_CNT;
double pmax = FH_MAX_MANH_GRID_CNT;
double d;
if (str_to_dbl(&d, vstring) && d >= pmin && d <= pmax)
;
else {
Log()->ErrorLogV(mh::Variables,
"Incorrect FhMinRectSize: range %.2f - %.1f.",
pmin, pmax);
return (false);
}
}
CDvdb()->registerPostFunc(post_fh);
return (true);
}

bool
evFhMinManhPartSize(const char *vstring, bool set)
{
if (set) {
double pmin = FH_MIN_MANH_PART_SIZE_MIN;
double pmax = FH_MIN_MANH_PART_SIZE_MAX;
double d;
if (str_to_dbl(&d, vstring) && d >= pmin && d <= pmax)
;
else {
Log()->ErrorLogV(mh::Variables,
"Incorrect FhMinManhPartSize: range %.2f - %.1f.",
"Incorrect FhManhGridCnt: range %.1f - %.1f.",
pmin, pmax);
return (false);
}
@@ -862,8 +842,7 @@ cExt::setupVariables()
vsetup(VA_FhArgs, S, evFH);
vsetup(VA_FhForeg, B, evFH);
vsetup(VA_FhFreq, S, evFH);
vsetup(VA_FhMinRectSize, S, evFhMinRectSize);
vsetup(VA_FhMinManhPartSize, S, evFhMinManhPartSize);
vsetup(VA_FhManhGridCnt, S, evFhManhGridCnt);
vsetup(VA_FhMonitor, B, evFH);
vsetup(VA_FhPath, S, evFH);
vsetup(VA_FhUnits, S, evFH);
82 changes: 23 additions & 59 deletions xic/src/gtkxic/gtkextfh.cc
Original file line number Diff line number Diff line change
@@ -113,15 +113,14 @@ namespace {
int fh_end;
int fh_line_selected;

GTKspinBtn sb_fh_min_rect;
GTKspinBtn sb_fh_min_manh_part;
GTKspinBtn sb_fh_manh_grid_cnt;
GTKspinBtn sb_fh_volel_target;
};

sFh *Fh;

enum { FhRun, FhRunFile, FhDump, Foreg, ToCons, Enable, Kill };
enum { MinRect, MinManhPart, VolElTarg, FhPath, FhArgs, FhFreq };
enum { ManhGridCnt, VolElTarg, FhPath, FhArgs, FhFreq };
}

// FastHenry units menu, must have same order and length as Units[]
@@ -435,35 +434,21 @@ sFh::sFh(GRobject c)
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
(GtkAttachOptions)0, 2, 2);

frame = gtk_frame_new("FhMinRectSize");
frame = gtk_frame_new("FhManhGridCnt");
gtk_widget_show(frame);

int ndgt = CD()->numDigits();
double val = FH_MIN_RECT_SIZE_DEF;
GtkWidget *sb = sb_fh_min_rect.init(val, FH_MIN_RECT_SIZE_MIN,
FH_MIN_RECT_SIZE_MAX, ndgt);
gtk_widget_set_usize(sb, 100, -1);
sb_fh_min_rect.connect_changed(GTK_SIGNAL_FUNC(fh_change_proc),
(void*)MinRect, "FhMinRectSize");
gtk_container_add(GTK_CONTAINER(frame), sb);

gtk_table_attach(GTK_TABLE(table), frame, 1, 2, row, row+1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
(GtkAttachOptions)0, 2, 2);
row++;
//XXX int ndgt = CD()->numDigits();
// double val = FH_MIN_RECT_SIZE_DEF;

frame = gtk_frame_new("FhMinManhPartSize");
gtk_widget_show(frame);

val = FH_MIN_MANH_PART_SIZE_DEF;
sb = sb_fh_min_manh_part.init(val, FH_MIN_MANH_PART_SIZE_MIN,
FH_MIN_MANH_PART_SIZE_MAX, ndgt);
GtkWidget *sb = sb_fh_manh_grid_cnt.init(FH_DEF_MANH_GRID_CNT,
FH_MIN_MANH_GRID_CNT,
FH_MAX_MANH_GRID_CNT, 0);
gtk_widget_set_usize(sb, 100, -1);
sb_fh_min_manh_part.connect_changed(GTK_SIGNAL_FUNC(fh_change_proc),
(void*)MinManhPart, "FhMinManhPartSize");
sb_fh_manh_grid_cnt.connect_changed(GTK_SIGNAL_FUNC(fh_change_proc),
(void*)ManhGridCnt, "FhManhGridCnt");
gtk_container_add(GTK_CONTAINER(frame), sb);

gtk_table_attach(GTK_TABLE(table), frame, 0, 1, row, row+1,
gtk_table_attach(GTK_TABLE(table), frame, 1, 2, row, row+1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
(GtkAttachOptions)0, 2, 2);
row++;
@@ -650,22 +635,13 @@ sFh::update()
if (uoff != ucur)
gtk_option_menu_set_history(GTK_OPTION_MENU(fh_units), uoff);

var = CDvdb()->getVariable(VA_FhMinRectSize);
if (sb_fh_min_rect.is_valid(var))
sb_fh_min_rect.set_value(atof(var));
else {
if (var)
CDvdb()->clearVariable(VA_FhMinRectSize);
sb_fh_min_rect.set_value(FH_MIN_RECT_SIZE_DEF);
}

var = CDvdb()->getVariable(VA_FhMinManhPartSize);
if (sb_fh_min_manh_part.is_valid(var))
sb_fh_min_manh_part.set_value(atof(var));
var = CDvdb()->getVariable(VA_FhManhGridCnt);
if (sb_fh_manh_grid_cnt.is_valid(var))
sb_fh_manh_grid_cnt.set_value(atof(var));
else {
if (var)
CDvdb()->clearVariable(VA_FhMinManhPartSize);
sb_fh_min_manh_part.set_value(FH_MIN_MANH_PART_SIZE_DEF);
CDvdb()->clearVariable(VA_FhManhGridCnt);
sb_fh_manh_grid_cnt.set_value(FH_DEF_MANH_GRID_CNT);
}

static double fhvt_bak;
@@ -893,17 +869,13 @@ sFh::select_pid(int p)
const char *
sFh::fh_def_string(int id)
{
int ndgt = CD()->numDigits();
static char tbuf[16];
switch (id) {
case MinRect:
sprintf(tbuf, "%.*f", ndgt, FH_MIN_RECT_SIZE_DEF);
return (tbuf);
case MinManhPart:
sprintf(tbuf, "%.*f", ndgt, FH_MIN_MANH_PART_SIZE_DEF);
case ManhGridCnt:
sprintf(tbuf, "%.*f", 0, FH_DEF_MANH_GRID_CNT);
return (tbuf);
case VolElTarg:
sprintf(tbuf, "%.*f", ndgt, FH_DEF_TARG_VOLEL);
sprintf(tbuf, "%.*f", 0, FH_DEF_TARG_VOLEL);
return (tbuf);
case FhPath:
return (fxJob::fh_default_path());
@@ -970,21 +942,13 @@ sFh::fh_change_proc(GtkWidget *widget, void *arg)
return;
int id = (long)arg;
switch (id) {
case MinRect:
if (check_num(s, FH_MIN_RECT_SIZE_MIN, FH_MIN_RECT_SIZE_MAX))
break;
if (!strcmp(s, fh_def_string(id)))
CDvdb()->clearVariable(VA_FhMinRectSize);
else
CDvdb()->setVariable(VA_FhMinRectSize, s);
break;
case MinManhPart:
if (check_num(s, FH_MIN_MANH_PART_SIZE_MIN, FH_MIN_MANH_PART_SIZE_MAX))
case ManhGridCnt:
if (check_num(s, FH_MIN_MANH_GRID_CNT, FH_MAX_MANH_GRID_CNT))
break;
if (!strcmp(s, fh_def_string(id)))
CDvdb()->clearVariable(VA_FhMinManhPartSize);
CDvdb()->clearVariable(VA_FhManhGridCnt);
else
CDvdb()->setVariable(VA_FhMinManhPartSize, s);
CDvdb()->setVariable(VA_FhManhGridCnt, s);
break;
case VolElTarg:
if (check_num(s, FH_MIN_TARG_VOLEL, FH_MAX_TARG_VOLEL))
9 changes: 8 additions & 1 deletion xic/src/tech/tech_ldb3d.cc
Original file line number Diff line number Diff line change
@@ -348,7 +348,7 @@ namespace {
bool
Ldb3d::init_stack(CDs *sdesc, const BBox *AOI, bool is_cs,
const char *mask_lname, double subs_eps, double subs_thickness,
int manh_min, int manh_mode)
int manh_gcnt, int manh_mode)
{
// Grab and order the layers to be considered, in the db3_stack
// list.
@@ -387,6 +387,13 @@ Ldb3d::init_stack(CDs *sdesc, const BBox *AOI, bool is_cs,
Zlist::destroy(db3_zlref);
db3_zlref = zref;

// Smallest rectangle size to use when approximating non-Manhattan
// geometry. The manh_gcnt is a "volume area" count, the number of
// covered grid cells for manh_min squares.
//
int manh_min =
manh_gcnt > 0 ? INTERNAL_UNITS(sqrt(db3_aoi.area()/manh_gcnt)) : 0;

// Next, obtain geometry, and remove layers that are nonexistant
// in the sdesc layout. We invert dark-field layers, so that in
// the sequence, the absence of those layers indicates "everywhere

0 comments on commit 004fba4

Please sign in to comment.