Subversion Repositories Vertical

Rev

Blame | Last modification | View Log | Download | RSS feed

%{
/*
 * $Id: mentor_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
 *
 * $Log: mentor_yacc.y,v $
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
 * Imported into local repositrory
 *
 * Revision 1.3  2002/10/02 19:37:28  MJAMES
 * Moved dummy functions to a separate support file.
 *
 * Used correct number of arguments to define_pin
 *
 * Revision 1.2  2002/09/09 10:36:20  mjames
 * Checkpoint checkin
 *
 * Revision 1.1  2002/08/14 12:13:01  mjames
 * Mentor Board Station reader modified to work with latest .nets file format
 *
 * Revision 1.1  2002/04/04 14:53:07  mjames
 * Added mentor board station reader to the portfolio
 *
 * Revision 1.6  2001/10/31 22:20:09  mjames
 * Tidying up problematical comments caused by CVS
 * 'intelligent' comment guessing
 *
 * Revision 1.5  2001/10/02 20:53:27  mjames
 * Moved documentation about code to main program module.
 *
 * Revision 1.4  2001/09/16 19:55:42  mjames
 * tidying
 *
 * Revision 1.3  2001/06/06 12:10:20  mjames
 * Move from HPUX
 *
 * Revision 1.2  2000/12/04 13:14:03  mjames
 * Imported all of the PCB syntax readers.
 *
 * Converted "a/b" to mean "a" divided by "b" insted of a single string
 * "a/b" in Verilog
 *
 * Revision 1.1.1.1  2000/10/19 21:58:38  mjames
 * Mike put it here
 *
 *
 * Revision 1.27  2000/10/04  10:37:07  10:37:07  mjames (Mike James)
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
 * 
 * Revision 1.24  2000/09/27  10:58:04  10:58:04  mjames (Mike James)
 * Using correct return code from yyparse()
 * 
 * Revision 1.13  2000/03/08  16:19:19  16:19:19  mjames (Mike James)
 * New version including PC
 * 
 * Revision 1.10  2000/01/20  15:58:46  15:58:46  mjames (Mike James)
 * Part of Release R22
 * 
 * Revision 1.9  99/12/22  11:15:27  11:15:27  mjames (Mike James)
 * Part of Release Dec_22_1999
 * 
 * Revision 1.8  99/06/25  14:35:45  14:35:45  mjames (Mike James)
 * Added in reference to expression.h, but no changes made 
 * to the function of acfread yet.
 * 
 * Revision 1.7  99/05/04  09:52:32  09:52:32  mjames (Mike James)
 * General checkin
 * 
 * Revision 1.5  98/07/14  13:24:51  13:24:51  mjames (Mike James)
 * Altered calling of some database functions
 * 
 * Revision 1.4  98/02/11  11:26:46  11:26:46  mjames (Mike James)
 * Checked in for version 6.2a
 * 
 * Revision 1.3  97/04/23  08:45:10  08:45:10  mjames (Mike James)
 * CHecked in for release rel23041997
 * 
 * Revision 1.2  96/12/23  15:16:50  15:16:50  mjames (Mike James)
 * Altered because find_socket takes a reference
 * to the head-of-list-pointer noth the pointer itself.
 * 
 * Revision 1.1  96/12/13  08:43:46  08:43:46  mjames (Mike James)
 * Initial revision
 * 
 *
 *  */




#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "expression.h"
#include "generic.h"
#include "database.h"
#include "routing.h"


#ident "@(#)$Header: C:/cvsroot/Vert03/mentor_src/mentor_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $";


static socket_t * current_chip;
static char curr_net_nam[MAXIDLEN];
int inside_block;


static char illegal[]="#$:|/.\\ +-";
static char replace[]="Hsxxnxx_PN";

char *  fix_name(char * str)
  {
  int i,j,l;
  l=strlen(str);
  /* edit out illegal strings from the net name */
  for(i=0;i<l;i++)
    {
    for(j=0;j<sizeof(illegal);j++)
      {
      if (str[i]==illegal[j])
        {
        str[i] = replace[j];
        }
      }
    }
  return str;
  }




%}
%union { char * string; }
%token  NET NET_TYPE  NL QUOTE ENDFILE
%token <string> ASTRING
%token <string> POWERS

%%

file    : objects ENDFILE;

objects : objects object
        | object
        ;


object  : net_list
        | gap
        ;


net_list    : NET  net_name net_items gap ;

net_items  : net_items net_item
           | net_item
           ;


net_item    :   net_attribute
              |   pin
              ;              
 


net_name   : QUOTE ASTRING QUOTE { strcpy(curr_net_nam,$2); };


pin        : ASTRING '-' ASTRING { define_pin(&routed_list,
                              find_socket(Ident,$1,Create,&socket_head),
                              curr_net_nam,BIDIR,0,fix_name($3),
                              default_vhdl_datatype,NULL); }
            | QUOTE ASTRING '-' ASTRING QUOTE { define_pin(&routed_list,
                              find_socket(Ident,$2,Create,&socket_head),
                              curr_net_nam,BIDIR,0,fix_name($4),
                              default_vhdl_datatype,NULL); }

             ;             



gap              : NL gap
                  | NL
                  ;





net_attribute    : '(' ASTRING ',' 
                   QUOTE ASTRING QUOTE ')' 
    { net_t * thisnet;
      printf("--Net %s has attribute %s,%s (GUESS NOT ROUTABLE!!)\n",curr_net_nam,$2,$5);
      thisnet = find_net(&routed_list,
                Ident,
                curr_net_nam,
                Create);
     if(thisnet)
      {
      thisnet->how_routed = Not_Routable;
     }
    }
              | '(' ASTRING ',' QUOTE POWERS QUOTE ')' 
   {     net_t * thisnet;
         printf("--Net %s has attribute %s,%s (GUESS NOT ROUTABLE!!)\n",curr_net_nam,$2,$5);
         thisnet = find_net(&routed_list,
                Ident,
                curr_net_nam,
                Create);
     if(thisnet)
      {
      thisnet->how_routed = Not_Routable;
      }            
     };




%%

/* defining lineno here */

int lineno;
extern char * yytext;

int yyerror(char * x)
  {
  int token;
  printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex()); */
  return 1;
  }

int yywrap(void)
  {
  return 1;
  }