Index: trunk/util/boxsym-rnd/7400.bs =================================================================== --- trunk/util/boxsym-rnd/7400.bs (revision 2831) +++ trunk/util/boxsym-rnd/7400.bs (revision 2832) @@ -1,5 +1,10 @@ refdes U?? +pinalign right center +pinalign bottom center +pinalign top center +attr device 7400 + begin slot power shape box begin pin Vcc @@ -10,11 +15,16 @@ num 7 loc bottom end pin + pinalign top center +# pinalign bottom center end slot begin slot logic shape box right=halfcirc + label "4*AND" + attr device 7400 + attr_both slot 1 begin pin A num 1:4:9:12 Index: trunk/util/boxsym-rnd/generator.awk =================================================================== --- trunk/util/boxsym-rnd/generator.awk (revision 2831) +++ trunk/util/boxsym-rnd/generator.awk (revision 2832) @@ -152,16 +152,39 @@ align_calc(ALIGN, "bottom", "width", "x0", SLOT[sn, "pinalign", "bottom"]) } +function draw_all_labels(sn ,key,pat,x,y,ak,prefix,vis) +{ + pat = "^" sn SUBSEP "attr" SUBSEP + y = -2*pin_grid + x = -2*pin_grid + for(key in SLOT) { + if (key ~ pat) { + ak = key + sub(pat, "", ak) + vis = SLOT[sn, "attr_vis", ak] + if (vis == "both") + prefix = ak "=" + else + prefix = "" + grp_attr_append(SYM, ak, SLOT[key]) + if (vis != "none") + sym_text_attr(SYM, x, y, ak, 0, "sym-secondary", prefix) + y -= pin_grid + } + } +} + function gen_monolith( ALIGN) { ofn=basename ".sym" ALIGN["cfg", "expand_slot"] = 1 align_pins("", ALIGN) - sym_begin(refdes, 0, -half) + sym_begin(refdes, -2*pin_grid, -pin_grid) sym_rect(SYM, 0, -half, xs * step + xo, P["ny"] * step + yo - half) draw_box(SYM, ALIGN["box","width"], ALIGN["box","height"], border, "") draw_all_pin("", ALIGN, 1) + draw_all_labels("") sym_end() delete SYM ofn="" @@ -172,9 +195,10 @@ ofn=basename "_" sn ".sym" ALIGN["cfg", "expand_slot"] = 0 align_pins(sn, ALIGN) - sym_begin(refdes, 0, -half) + sym_begin(refdes, -2*pin_grid, -pin_grid) draw_box(SYM, ALIGN["box","width"], ALIGN["box","height"], border, "") draw_all_pin(sn, ALIGN, 0) + draw_all_labels(sn) sym_end() delete SYM ofn="" Index: trunk/util/boxsym-rnd/parser.awk =================================================================== --- trunk/util/boxsym-rnd/parser.awk (revision 2831) +++ trunk/util/boxsym-rnd/parser.awk (revision 2832) @@ -10,6 +10,14 @@ return tmp } +# return $0 in a string with $1 and $2 removed +function del2( tmp) +{ + tmp = $0 + sub("^[ \t]*[^ \t]*[ \t]*[^ \t]*[ \t]*", "", tmp) + return tmp +} + function add_pin() { PINS[slot, SLOT[slot, "npins"]] = pin @@ -77,6 +85,14 @@ SLOT[slot, "shape"] = del1($0) else if ($1 == "pinalign") SLOT[slot, "pinalign", $2] = $3 + else if ($1 == "label") + SLOT[slot, "label", ++SLOT["", "labels"]] = $2 + else if ($1 == "attr") + SLOT[slot, "attr", $2] = del2($0) + else if ($1 == "attr_both") { + SLOT[slot, "attr", $2] = del2($0) + SLOT[slot, "attr_vis", $2] = "both" + } else if ($1 == "begin") parse_any() else { @@ -96,3 +112,6 @@ ($1 == refdes) { refdes = $2 } /begin slot/ { parse_slot() } ($1 == "pinalign") { SLOT["", "pinalign", $2] = $3 } +($1 == "label") { SLOT["", "label", ++SLOT["", "labels"]] = $2 } +($1 == "attr") { SLOT["", "attr", $2] = del2($0) } +($1 == "attr_both") { SLOT["", "attr", $2] = del2($0); SLOT["", "attr_vis", $2] = "both"; }