Subversion Repositories Vertical

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

%{
/* 
 * $Id: cdi_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ 
 *
 * $Log: cdi_yacc.y,v $
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
 * Imported into local repositrory
 *
 * Revision 1.8  2002/10/02 19:37:30  MJAMES
 * Moved dummy functions to a separate support file.
 *
 * Used correct number of arguments to define_pin
 *
 * Revision 1.7  2002/09/09 10:36:19  mjames
 * Checkpoint checkin
 *
 * Revision 1.6  2001/10/31 22:19:58  mjames
 * Tidying up problematical comments caused by CVS
 * 'intelligent' comment guessing
 *
 * Revision 1.5  2001/10/02 20:55:37  mjames
 * Moved documentation about code to main program module.
 *
 * Revision 1.4  2001/09/16 19:59:47  mjames
 * tidying
 *
 * Revision 1.3  2001/06/06 12:10:26  mjames
 * Move from HPUX
 *
 * Revision 1.2  2000/12/04 13:14:02  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:34  mjames
 * Mike put it here
 *
 *
 * Revision 1.32  2000/10/04  10:37:01  10:37:01  mjames (Mike James)
 * Modified to become part of vertical2, complete
 * with VHDL COMPONENT and SIGNAL declarations.
 * 
 * Revision 1.29  2000/09/27  10:41:53  10:41:53  mjames (Mike James)
 * Modified to use correct return code from yyparse.
 * 
 * Revision 1.28  2000/09/21  10:15:37  10:15:37  mjames (Mike James)
 * Part of Release Sep21Alpha
 * 
 * Revision 1.27  2000/08/25  09:57:06  09:57:06  mjames (Mike James)
 * Part of Release Aug25_alpha
 * 
 * Revision 1.26  2000/08/16  08:57:23  08:57:23  mjames (Mike James)
 * Part of Release CD01_Aug2000
 * 
 * Revision 1.25  2000/08/14  14:45:06  14:45:06  mjames (Mike James)
 * Part of Release Aug_14_2000
 * 
 * Revision 1.24  2000/08/11  08:30:26  08:30:26  mjames (Mike James)
 * Part of Release Aug_11_2000
 * 
 * Revision 1.23  2000/08/09  10:31:39  10:31:39  mjames (Mike James)
 * Part of Release Aug__9_2000
 * 
 * Revision 1.22  2000/05/31  11:42:45  11:42:45  mjames (Mike James)
 * Part of Release May_31_2000
 * 
 * Revision 1.21  2000/05/08  17:01:31  17:01:31  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.20  2000/05/08  16:59:24  16:59:24  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.19  2000/05/08  16:57:00  16:57:00  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.18  2000/05/08  16:42:54  16:42:54  mjames (Mike James)
 * Added a null action to a terminal pattern .
 * Makes Bison happy.
 * 
 * Revision 1.17  2000/03/08  16:17:30  16:17:30  mjames (Mike James)
 * Removed syntactically confused 'junk'
 * 
 * Revision 1.14  2000/01/20  15:58:39  15:58:39  mjames (Mike James)
 * Part of Release R22
 * 
 * Revision 1.13  99/12/22  11:15:19  11:15:19  mjames (Mike James)
 * Part of Release Dec_22_1999
 * 
 * Revision 1.12  99/06/25  14:34:27  14:34:27  mjames (Mike James)
 * Added in reference to expression.h, but no changes made 
 * to the function of acfread yet.
 * 
 * Revision 1.11  99/06/18  09:06:38  09:06:38  mjames (Mike James)
 * Checkin before major design changes
 * 
 * Revision 1.10  1999/06/14  10:47:18  mjames
 * *** empty log message ***
 *
 * Revision 1.10  1999/06/14  10:47:18  mjames
 * *** empty log message ***
 *
 * Revision 1.9  1999/06/11  14:21:15  mjames
 * *** empty log message ***
 *
 * Revision 1.9  1999/06/11  14:21:15  mjames
 * *** empty log message ***
 *
 * Revision 1.8  99/05/04  09:48:19  09:48:19  mjames (Mike James)
 * 
 * 
 * Revision 1.5  98/07/14  13:22:06  13:22:06  mjames (Mike James)
 * Altered calling of some database functions
 * 
 * Revision 1.4  98/03/16  11:35:31  11:35:31  mjames (Mike James)
 * Made compatible with newer example of .cdi file
 * 
 * Revision 1.3  98/02/11  11:24:59  11:24:59  mjames (Mike James)
 * Checked in for version 6.2a
 * 
 * Revision 1.2  97/04/23  08:45:08  08:45:08  mjames (Mike James)
 * CHecked in for release rel23041997
 * 
 * Revision 1.1  97/01/03  13:43:13  13:43:13  mjames (Mike James)
 * Initial revision
 * 
 *
 *  */

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


static char IDstr[] = "@(#)$Header: C:/cvsroot/Vert03/cdi_src/cdi_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $";


static socket_t * current_chip;
static char curr_net_id[MAXIDLEN];
int inside_block;
%}
%union { char * string; }
%token ASS  IMP  COM CSP PCB CON COD REM EOD NL QUOTE
%token <string> ASTRING
%%




objects : objects object
        | object
        ;


object  : junk_line
        | junk_block
        | CON NL netlist EOD
        | gap
        ;


/* Get rid of anything boring at present */
junk_line : junk_line_start words ;

junk_line_start :  CSP | PCB | REM | IMP ;

words : words ASTRING
      | ASTRING { } 
      | /* nothing */
      ;

junk_block : junk_block_start NL lines ;


junk_block_start : ASS | COM ;

lines : line lines
      | line
      ;
      
line  : words NL;




netlist : netlist netnodes
        | netnodes
        ;



netnodes:  rem_part   /* tree nnn */
          | name_part   /* named net */ 
          | cod_part  /* no action as this is a net width */
          | nodelines 
          | NL ;

rem_part   : REM ASTRING ASTRING NL { sprintf(curr_net_id,"%s_%s",$2,$3); };

name_part : QUOTE ASTRING QUOTE NL {  strcpy(curr_net_id,$2); };

cod_part  : COD ASTRING NL; 

nodelines : nodelines nodeline
          | nodeline
          ;

nodeline  : nodes  NL;


nodes     : nodes node 
          | node
          ;


node : ASTRING ASTRING { current_chip =find_socket(Ident,
                                $1,Create,&socket_head);
                         define_pin(&routed_list,current_chip,
                              curr_net_id,BIDIR,0,$2,
                              default_vhdl_datatype,NULL); };



gap              : NL gap
                  | NL
                  |
                  ;


%%

/* 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;
  }