Mangle nexus names.

This commit is contained in:
steve 2001-08-30 04:31:04 +00:00
parent f063bf833f
commit a3c3019a04
3 changed files with 50 additions and 4 deletions

View File

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: fpga_priv.h,v 1.1 2001/08/28 04:14:20 steve Exp $"
#ident "$Id: fpga_priv.h,v 1.2 2001/08/30 04:31:04 steve Exp $"
# include <stdio.h>
# include "device.h"
@ -39,8 +39,13 @@ extern device_t device;
extern void mangle_logic_name(ivl_net_logic_t net, char*buf, size_t nbuf);
extern void mangle_lpm_name(ivl_lpm_t net, char*buf, size_t nbuf);
extern const char*mangle_nexus_name(ivl_nexus_t net);
/*
* $Log: fpga_priv.h,v $
* Revision 1.2 2001/08/30 04:31:04 steve
* Mangle nexus names.
*
* Revision 1.1 2001/08/28 04:14:20 steve
* Add the fpga target.
*

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: gates.c,v 1.1 2001/08/28 04:14:20 steve Exp $"
#ident "$Id: gates.c,v 1.2 2001/08/30 04:31:04 steve Exp $"
# include <ivl_target.h>
# include "fpga_priv.h"
@ -25,7 +25,7 @@
void draw_pin(ivl_nexus_t nex, const char*nam, char dir)
{
const char*use_name = nam;
const char*nex_name = ivl_nexus_name(nex);
const char*nex_name = mangle_nexus_name(nex);
int invert = 0;
if (use_name[0] == '~') {
@ -76,6 +76,9 @@ int show_scope_gates(ivl_scope_t net, void*x)
/*
* $Log: gates.c,v $
* Revision 1.2 2001/08/30 04:31:04 steve
* Mangle nexus names.
*
* Revision 1.1 2001/08/28 04:14:20 steve
* Add the fpga target.
*

View File

@ -16,11 +16,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: mangle.c,v 1.1 2001/08/28 04:14:20 steve Exp $"
#ident "$Id: mangle.c,v 1.2 2001/08/30 04:31:05 steve Exp $"
# include "fpga_priv.h"
# include <string.h>
# include <malloc.h>
static size_t mangle_scope_name(ivl_scope_t net, char*buf, size_t nbuf)
{
@ -56,9 +57,46 @@ void mangle_lpm_name(ivl_lpm_t net, char*buf, size_t nbuf)
strcpy(buf+cnt, ivl_lpm_basename(net));
}
/*
* Nexus names are used in pin records to connect things together. It
* almost doesn't matter what the nexus name is, but for readability
* we choose a name that is close to the nexus name. This function
* converts the existing name to a name that XNF can use.
*
* For speed, this function saves the calculated string into the real
* nexus by using the private pointer. Every nexus is used at least
* twice, so this cuts the mangling time in half at least.
*/
const char* mangle_nexus_name(ivl_nexus_t net)
{
char*name = ivl_nexus_get_private(net);
char*cp;
if (name != 0) {
return name;
}
name = malloc(strlen(ivl_nexus_name(net)) + 1);
strcpy(name, ivl_nexus_name(net));
for (cp = name ; *cp ; cp += 1) switch (*cp) {
case '.':
*cp = '/';
break;
default:
break;
}
ivl_nexus_set_private(net, name);
return name;
}
/*
* $Log: mangle.c,v $
* Revision 1.2 2001/08/30 04:31:05 steve
* Mangle nexus names.
*
* Revision 1.1 2001/08/28 04:14:20 steve
* Add the fpga target.
*