Subversion Repositories Vertical

Rev

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

%{
/* 
 * $Header: C:/cvsroot/Vert03/gen_src/gen_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
 *
 * $Log: gen_yacc.y,v $
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
 * Imported into local repositrory
 *
 * Revision 1.10  2002/10/02 19:37:29  MJAMES
 * Moved dummy functions to a separate support file.
 *
 * Used correct number of arguments to define_pin
 *
 * Revision 1.9  2002/09/09 10:36:20  mjames
 * Checkpoint checkin
 *
 * Revision 1.8  2001/10/31 22:20:07  mjames
 * Tidying up problematical comments caused by CVS
 * 'intelligent' comment guessing
 *
 * Revision 1.7  2001/10/02 20:53:46  mjames
 * Moved documentation about code to main program module.
 *
 * Revision 1.6  2001/09/16 19:59:20  mjames
 * tidying
 *
 * Revision 1.5  2001/06/07 10:28:06  MJAMES
 * Removed ] symbol dropped in by mistake
 *
 * Revision 1.4  2001/06/06 14:46:02  mjames
 * Added further Verilog support.
 * Corrected write ext command to not require additional argument.
 * Added write quartus for creation of a pinfit file relevant to Quartus
 *
 * Revision 1.3  2001/06/06 12:10:21  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.18  2000/10/04  10:37:06  10:37:06  mjames (Mike James)
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
 * 
 * Revision 1.15  2000/09/27  10:45:41  10:45:41  mjames (Mike James)
 * Corrected to use correct return code from yyparse()
 * 
 * Revision 1.14  2000/09/21  10:15:45  10:15:45  mjames (Mike James)
 * Part of Release Sep21Alpha
 * 
 * Revision 1.13  2000/08/25  09:57:18  09:57:18  mjames (Mike James)
 * Part of Release Aug25_alpha
 * 
 * Revision 1.12  2000/08/16  08:57:35  08:57:35  mjames (Mike James)
 * Part of Release CD01_Aug2000
 * 
 * Revision 1.11  2000/08/14  14:45:15  14:45:15  mjames (Mike James)
 * Part of Release Aug_14_2000
 * 
 * Revision 1.10  2000/08/11  08:30:36  08:30:36  mjames (Mike James)
 * Part of Release Aug_11_2000
 * 
 * Revision 1.9  2000/08/09  10:31:52  10:31:52  mjames (Mike James)
 * Part of Release Aug__9_2000
 * 
 * Revision 1.8  2000/05/31  11:43:03  11:43:03  mjames (Mike James)
 * Part of Release May_31_2000
 * 
 * Revision 1.7  2000/05/08  17:01:42  17:01:42  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.6  2000/05/08  16:59:35  16:59:35  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.5  2000/05/08  16:57:11  16:57:11  mjames (Mike James)
 * Part of Release May__8_2000
 * 
 * Revision 1.4  2000/03/08  16:19:07  16:19:07  mjames (Mike James)
 * New version including PC
 * 
 * Revision 1.1  2000/02/23  13:17:00  13:17:00  mjames (Mike James)
 * Initial revision
 * 
 * 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
 * 
 *
 *  */

/*
@title
PROGRAM genread: Converter for .GEN files
@text
PCB netlist to ACFP converter. Looks for netlists in ASCII containing tags like:
@listing
$PACKAGES
$NETS   
$END    

@text
Commonly seen with a '.GEN' file suffix. Lots of exclamation marks '!' in the
netlist file. Mentor Graphics ?
@end
*/



#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/gen_src/gen_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;
%}
%union { char * string; }
%token PACKAGES NETS END NL PLING SEMI DOT COMMA
%token <string> ASTRING

%%




objects : objects object
        | object
        ;


object  : package_list
        | nets_list
        | END  NL
        | gap
        ;


package_list : PACKAGES NL component_lines gap;
nets_list    : NETS     NL nets gap ;

component_lines : component_lines component_line
                | component_line
                ;


component_line :  ASTRING PLING ASTRING SEMI ASTRING NL {
                 current_chip = find_socket(Ident,$5,Create,&socket_head);
                 set_socket(current_chip,Type,$1) ;
                 set_socket(current_chip,Value,$3) ;
                 };


nets            : net nets
                | net
                ;


net  : net_name pins gap;


pins       : pins pin
                | pin
                | pins COMMA NL pins
                ;

net_name   : ASTRING SEMI { strcpy(curr_net_nam,$1); };


pin           : ASTRING DOT ASTRING { define_pin(&routed_list,
                              find_socket(Ident,$1,Create,&socket_head),
                              curr_net_nam,BIDIR,0,$3,
                              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;
  }