_ses_path_cmp()
authoryu.dongliang <18588496441@163.com>
Thu, 27 Jul 2023 14:39:21 +0000 (22:39 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 27 Jul 2023 14:39:21 +0000 (22:39 +0800)
ses_step_topo.c

index 0843179a29780709c1cfa5e812f1526e892f9b7d..83342565423158d3788d7411b768909424003d95 100644 (file)
@@ -1,5 +1,19 @@
 #include"ses_core.h"
 
+static int _ses_path_cmp(const void* v0, const void* v1)
+{
+       const ses_path_t* p0 = *(const ses_path_t**)v0;
+       const ses_path_t* p1 = *(const ses_path_t**)v1;
+
+       if (p0->pins->size > p1->pins->size)
+               return -1;
+
+       if (p0->pins->size < p1->pins->size)
+               return 1;
+
+       return 0;
+}
+
 static int __dfs_path(ScfEfunction* f, ScfEcomponent* rc, ScfEpin* rp, ses_ctx_t* ctx, ses_path_t** ppath)
 {
        ScfEcomponent*   c;
@@ -215,6 +229,8 @@ static int _topo_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t*
                path = NULL;
        }
 
+       scf_vector_qsort(ctx->paths, _ses_path_cmp);
+
 #if 1
        for (i = 0; i < ctx->paths->size; i++) {
                path      = ctx->paths->data[i];