[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA-user: vpiHandles for the regs and nets




[ Ales here, I'm reposting this since majordomo didn't recognize the
  e-mail as being subscribed to the geda-dev or geda-user mailing list.
  Please post to geda-dev or geda-user via the e-mail address that you
  subscribed with or your message might get lost. ]

-- Cut here --
From: Lonnie L Gliem <lgliem@goldengate.net>

I have been having trouble with getting vpiHandles for the regs and nets
under my top level module. I have enclosed the code anyone knwo what
I am doing wrong???
Thanks
Lonnie

                /* get TOP Module handle */
                top_iter = vpi_iterate (vpiModule, NULL);
                module_h = vpi_scan (top_iter);
                if (module_h == NULL){
                        printf("vpiModule no more nets\n");
                } else {
                        mod_name = vpi_get_str (vpiFullName, module_h);
                        printf("TOP Module Name =  %s\n",mod_name);
                        scope_h = vpi_handle (vpiScope, module_h);
                        if (scope_h != NULL){
                                sig_iter = vpi_iterate (vpiNet, scope_h);
                                if (sig_iter != NULL){
                                        while ((signal_h = vpi_scan(sig_iter)) != NULL){
                                                signal_type = vpi_get(vpiType, signal_h);
                                                mod_name = vpi_get_str (vpiName, signal_h);
                                                printf("NET Name =  %s\n",mod_name);
                                        }
                                } else {
                                        printf("sig_iter NULL\n");
                                }
                                sig_iter = vpi_iterate (vpiReg, scope_h);
                                if (sig_iter != NULL){
                                        while ((signal_h = vpi_scan (sig_iter)) != NULL){
                                                signal_type = vpi_get(vpiType, signal_h);
                                                mod_name = vpi_get_str (vpiName, signal_h);
                                                printf("REG Name =  %s\n",mod_name);
                                        }
                                } else {
                                        printf("sig_iter NULL\n");
                                }
                        } else {
                                printf("No Signals\n");
                        }
                }

                /* get TOP Module Nets */
                net_iter = vpi_iterate (vpiNet, module_h);
                if (net_iter != NULL){
                        while ((net_h = vpi_scan (net_iter)) != NULL){
                                mod_name = vpi_get_str (vpiFullName, net_h);
                                printf("Net Name =  %s \n",mod_name);
                        }
                } else {
                        printf("No Nets\n");
                }

                /* get TOP Module Regs */
                net_iter = vpi_iterate (vpiReg, module_h);
                if (net_iter != NULL){
                        while ((net_h = vpi_scan (net_iter)) != NULL){
                                mod_name = vpi_get_str (vpiFullName, net_h);
                                printf("Reg Name =  %s \n",mod_name);
                        }
                } else {
                        printf("No Regs\n");
                }

                /* get TOP Module one to one Nets */
                h = vpi_handle (vpiNet, module_h);
                if (h != NULL){
                        mod_name = vpi_get_str (vpiFullName, h);
                        printf("Reg Name =  %s \n",mod_name);
                } else {
                        printf("No Top Level Nets\n");
                }

                /* get TOP Module one to one Nets */
                h = vpi_handle (vpiReg, module_h);
                if (h != NULL){
                        mod_name = vpi_get_str (vpiFullName, h);
                        printf("Reg Name =  %s \n",mod_name);
                } else {
                        printf("No Top Level Regs\n");
                }



Here are the results when I run it.

TOP Module Name =  drv_iv
No Signals
No Nets
No Regs
No Top Level Nets
No Top Level Regs