From: yu.dongliang <18588496441@163.com>
Date: Mon, 16 Oct 2023 17:10:17 +0000 (+0800)
Subject: ses_layout_function()
X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=8da5013985090ab60e30c4e3d116a85769083d09;p=ses.git

ses_layout_function()
---

diff --git a/ses_layout.c b/ses_layout.c
index d9ecdb2..548723e 100644
--- a/ses_layout.c
+++ b/ses_layout.c
@@ -483,8 +483,8 @@ static void __ses_layout_components(ScfEfunction* f, int d)
 				p0 = c->pins[el0->pins[m + 1]];
 				p1 = c->pins[el1->pins[n + 1]];
 
-				p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % d;
-				p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % d;
+				p0->x = el0->lines[0]->x1 + j * d + 10 + rand() % 20;
+				p1->x = el1->lines[0]->x1 + j * d + 10 + rand() % 20;
 				p0->y = el0->lines[0]->y0;
 				p1->y = el1->lines[0]->y0;
 
@@ -514,7 +514,7 @@ static void __ses_layout_components(ScfEfunction* f, int d)
 
 			if (0 == p0->x) {
 
-				p0->x = el0->lines[0]->x1 + d + 10 + rand() % d;
+				p0->x = el0->lines[0]->x1 + d + 10 + rand() % 20;
 				p0->y = el0->lines[0]->y1;
 
 				el0->lines[0]->x1 = p0->x;
@@ -738,6 +738,7 @@ int ses_layout_function(ScfEfunction* f, int d)
 {
 	ScfEcomponent* c;
 	ScfEline*      el;
+	ScfEline*      el2;
 	ScfEpin*       p0;
 	ScfEpin*       p1;
 
@@ -838,10 +839,21 @@ int ses_layout_function(ScfEfunction* f, int d)
 			cx = c->x;
 
 			for (k = 0; k < c->n_pins; k++) {
+				p1 =        c->pins[k];
+
 				if (k < 2)
-					c->pins[k]->x  = c->x;
+					p1->x  = c->x;
 				else
-					c->pins[k]->x += c->x - tmp;
+					p1->x += c->x - tmp;
+
+				el2 = f->elines[p1->lid];
+
+				if (el2->lines[0]->x1 < p1->x) {
+					el2->lines[0]->x1 = p1->x;
+
+					if (f->w < p1->x)
+						f->w = p1->x;
+				}
 			}
 
 			if (x0 > p0->x)
@@ -853,9 +865,12 @@ int ses_layout_function(ScfEfunction* f, int d)
 
 		el->lines[0]->x0 = x0;
 		el->lines[0]->x1 = x1;
+
+		if (f->w < x1)
+			f->w = x1;
 	}
 
-	f->w -= mx - 3 * d + px - nx;
+	f->w += d;
 	f->h += d;
 
 	scf_loge("f->x: %d, y: %d, w: %d, h: %d\n", f->x, f->y, f->w, f->h);