OpenCores
URL https://opencores.org/ocsvn/sc2v/sc2v/trunk

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [src/] [sc2v_step3.y] - Diff between revs 14 and 16

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 16
Line 1... Line 1...
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
 *
 *
 *  SystemC to Verilog Translator v0.3
 *  SystemC to Verilog Translator v0.4
 *  Provided by OpenSoc Design
 *  Provided by OpenSoc Design
 *
 *
 *  www.opensocdesign.com
 *  www.opensocdesign.com
 *
 *
 * -----------------------------------------------------------------------------
 * -----------------------------------------------------------------------------
Line 29... Line 29...
  int module_found = 0;
  int module_found = 0;
  int concat_found = 0;
  int concat_found = 0;
  int opened_pars;
  int opened_pars;
  int *concat_par_num;
  int *concat_par_num;
  int concats_found = 0;
  int concats_found = 0;
 
  int lastsymbol=0;
  char *aux;
  char *aux;
  void yyerror (const char *str)
  void yyerror (const char *str)
  {
  {
    fprintf (stderr, "error: %s\n", str);
    fprintf (stderr, "error: %s\n", str);
  }
  }
Line 50... Line 51...
 
 
  }
  }
 
 
%}
%}
 
 
%token WORD
%token WORD WORDCOLON
%token OPENPAR CLOSEPAR
%token OPENPAR CLOSEPAR
%token MODULE
%token MODULE SYMBOL
 
 
%% commands:
%% commands:
/* empty */
/* empty */
|commands command;
|commands command;
 
 
Line 66... Line 67...
|
|
closepar
closepar
|
|
concat
concat
|
|
openpar;
openpar
 
|
 
word
 
|
 
symbol;
 
 
module:
module:
MODULE
MODULE
{
{
 
  lastsymbol=0;
  module_found = 1;
  module_found = 1;
  opened_pars++;
  opened_pars++;
  printf ("%s", (char *) $1);
  printf ("%s", (char *) $1);
};
};
 
 
Line 117... Line 123...
      printf (")");
      printf (")");
    }
    }
};
};
 
 
concat:
concat:
WORD
WORDCOLON
{
{
 
 if(lastsymbol==1){
  aux = (char *) $1;
  aux = (char *) $1;
  aux++;
  aux++;
  printf ("{%s", aux);
  printf ("{%s", aux);
  concat_found = 1;
  concat_found = 1;
  opened_pars++;
  opened_pars++;
  concats_found++;
  concats_found++;
  *(concat_par_num + concats_found) = opened_pars;
  *(concat_par_num + concats_found) = opened_pars;
 
 }else{
 
   printf ("%s", (char *)$1);
 
 }
 
 lastsymbol=0;
 
};
 
 
 
symbol:
 
SYMBOL
 
{
 
  lastsymbol=1;
 
  printf("%c",*((char *)$1));
 
};
 
 
 
word:
 
WORD
 
{
 
  lastsymbol=0;
 
  printf("%s",(char *)$1);
};
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.