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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [src/] [sc2v_step2.y] - Diff between revs 15 and 16

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

Rev 15 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 63... Line 63...
 
 
/* Global var to store last sensitivity found*/
/* Global var to store last sensitivity found*/
  char *last_sensibility;
  char *last_sensibility;
  int sensibility_active = 0;
  int sensibility_active = 0;
 
 
 
/* Global var to store last function found*/
 
  char *functionname;
 
  int outputlenght = 0;
 
 
  int translate;
  int translate;
 
 
 
 
  void yyerror (const char *str)
  void yyerror (const char *str)
Line 89... Line 92...
    signalslist = NULL;
    signalslist = NULL;
    sensibilitylist=NULL;
    sensibilitylist=NULL;
    processlist=NULL;
    processlist=NULL;
    instanceslist = NULL;
    instanceslist = NULL;
    enumlistlist = NULL;
    enumlistlist = NULL;
 
    funcinputslist = NULL;
 
    functionslist = NULL;
 
 
    translate = 1;
    translate = 1;
 
 
    fprintf(stderr,"\nSystemC to Verilog Translator v0.3\n\n");
    fprintf(stderr,"\nSystemC to Verilog Translator v0.3\n\n");
    fprintf(stderr,"Parsing header file.......\n\n");
    fprintf(stderr,"Parsing header file.......\n\n");
Line 100... Line 105...
    FILE* yyin = stdin;
    FILE* yyin = stdin;
    FILE* yyout = stdout;
    FILE* yyout = stdout;
 
 
    yyparse ();
    yyparse ();
 
 
 
 
    printf ("module %s(", module_name);
    printf ("module %s(", module_name);
    EnumeratePorts (portlist);
    EnumeratePorts (portlist);
    printf (");\n");
    printf (");\n");
 
 
 
 
    ShowPortList (portlist);
    ShowPortList (portlist);
    printf ("\n");
    printf ("\n");
    RegOutputs (portlist);
    RegOutputs (portlist);
    printf ("\n");
    printf ("\n");
 
 
 
 
    ShowEnumListList (enumlistlist);
    ShowEnumListList (enumlistlist);
 
 
    writeslist=ReadWritesFile (writeslist,(char *) "file_writes.sc2v");
    writeslist=ReadWritesFile (writeslist,(char *) "file_writes.sc2v");
 
 
    ShowSignalsList (signalslist, writeslist);
    ShowSignalsList (signalslist, writeslist);
Line 125... Line 127...
    ShowInstancedModules (instanceslist);
    ShowInstancedModules (instanceslist);
    printf ("\n");
    printf ("\n");
 
 
    ShowDefines ((char *) "file_defines.sc2v");
    ShowDefines ((char *) "file_defines.sc2v");
 
 
 
    ShowFunctionCode (functionslist);
 
 
    ShowProcessCode (processlist);
    ShowProcessCode (processlist);
    printf ("\n");
    printf ("\n");
 
 
    printf ("endmodule\n");
    printf ("endmodule\n");
 
 
Line 136... Line 140...
  }
  }
 
 
%}
%}
 
 
%token NUMBER SC_MODULE WORD OPENPAR CLOSEPAR SC_IN SC_OUT SEMICOLON BOOL ENUM
%token NUMBER SC_MODULE WORD OPENPAR CLOSEPAR SC_IN SC_OUT SEMICOLON BOOL ENUM
%token MENOR MAYOR SC_INT SC_UINT SC_METHOD SENSITIVE_POS SENSITIVE_NEG SENSITIVE
%token MENOR MAYOR SC_REG SC_METHOD SENSITIVE_POS SENSITIVE_NEG SENSITIVE
%token SENSIBLE CLOSEKEY OPENKEY SEMICOLON COLON SC_SIGNAL ARROW EQUALS NEW QUOTE
%token SENSIBLE CLOSEKEY OPENKEY SEMICOLON COLON SC_SIGNAL ARROW EQUALS NEW QUOTE
%token SC_CTOR VOID ASTERISCO TRANSLATEON TRANSLATEOFF
%token SC_CTOR VOID ASTERISCO TRANSLATEON TRANSLATEOFF
 
 
%% commands:    /* empty */
%% commands:    /* empty */
|commands command;
|commands command;
Line 148... Line 152...
command:
command:
module
module
  |
  |
  in_bool
  in_bool
  |
  |
  in_sc_int
  in_sc_reg
  |
 
  in_sc_uint
 
  |
  |
  out_bool
  out_bool
  |
  |
  out_sc_int
  out_sc_reg
  |
 
  out_sc_uint
 
  |
  |
  sc_method
  sc_method
  |
  |
  sensitive_pos
  sensitive_pos
  |
  |
Line 188... Line 188...
  |
  |
  word_closekey_word
  word_closekey_word
  |
  |
  signal_bool
  signal_bool
  |
  |
  signal_uint
  signal_reg
  |
 
  signal_int
 
  |
  |
  instantation
  instantation
  |
  |
  port_binding
  port_binding
  |
  |
  sc_ctor
  sc_ctor
  |
  |
  void
  void
  |
  |inst_decl
  inst_decl
 
  |
  |
  closekey_semicolon
  closekey_semicolon
  |
  |
  enumerates
  enumerates
  |
  |
Line 218... Line 215...
  |
  |
  multiple_sc_signal_declaration
  multiple_sc_signal_declaration
  |
  |
  translateoff
  translateoff
  |
  |
  translateon;
  translateon
 
  |
 
  function
 
  |
 
  functioninputs
 
  |
 
  finishfunctioninputs
 
  | boolfunction | boolfunctioninputs | boolfinishfunctioninputs;
 
 
module:
module:
SC_MODULE OPENPAR WORD CLOSEPAR OPENKEY
SC_MODULE OPENPAR WORD CLOSEPAR OPENKEY
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (module_name_found)
      if (module_name_found)
 
 
        {
        {
 
          fprintf (stderr,
          fprintf (stderr, "line: %d error: two or more modules found in the file\n",lineno);
                   "line: %d error: two or more modules found in the file\n",
 
                   lineno);
          exit (1);
          exit (1);
 
 
        }
        }
 
 
      else
      else
 
 
        {
        {
 
 
          module_name = (char *) malloc (256 * sizeof (char));
          module_name = (char *) malloc (256 * sizeof (char));
 
 
          strcpy (module_name, (char *) $3);
          strcpy (module_name, (char *) $3);
 
 
          module_name_found = 1;
          module_name_found = 1;
 
 
        }
        }
    }
    }
 
 
}
 
 
 
;
 
 
 
 
 
 
 
in_sc_uint:
 
SC_IN MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
 
{
 
 
 
  if (translate == 1)
 
    {
 
 
 
      activeport = 1;
 
 
 
      lastportsize = $5;
 
 
 
      lastportkind = (char *) "input";
 
 
 
    }
 
 
 
};
};
 
 
 
 
 
in_sc_reg:
in_sc_int:
SC_IN MENOR SC_REG MENOR NUMBER MAYOR MAYOR
SC_IN MENOR SC_INT MENOR NUMBER MAYOR MAYOR
 
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      activeport = 1;
      activeport = 1;
 
 
      lastportsize = $5;
      lastportsize = $5;
 
 
      lastportkind = (char *) "input";
      lastportkind = (char *) "input";
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
 
 
in_bool:
in_bool:
SC_IN MENOR BOOL MAYOR
SC_IN MENOR BOOL MAYOR
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      activeport = 1;
      activeport = 1;
 
 
      lastportsize = 0;
      lastportsize = 0;
 
 
      lastportkind = (char *) "input";
      lastportkind = (char *) "input";
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
signal_bool:
signal_bool:
SC_SIGNAL MENOR BOOL MAYOR
SC_SIGNAL MENOR BOOL MAYOR
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      signalactive = 1;
      signalactive = 1;
 
 
      lastsignalsize = 0;
      lastsignalsize = 0;
 
 
    }
 
 
 
};
 
 
 
 
 
 
 
signal_uint:
 
SC_SIGNAL MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
 
{
 
 
 
  if (translate == 1)
 
    {
 
 
 
      signalactive = 1;
 
 
 
      lastsignalsize = $5;
 
 
 
    }
    }
 
 
};
};
 
 
 
 
 
signal_reg:
signal_int:
SC_SIGNAL MENOR SC_REG MENOR NUMBER MAYOR MAYOR
SC_SIGNAL MENOR SC_INT MENOR NUMBER MAYOR MAYOR
 
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      signalactive = 1;
      signalactive = 1;
 
 
      lastsignalsize = $5;
      lastsignalsize = $5;
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
out_bool:
out_bool:
SC_OUT MENOR BOOL MAYOR
SC_OUT MENOR BOOL MAYOR
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      activeport = 1;
      activeport = 1;
 
 
      lastportsize = 0;
      lastportsize = 0;
 
 
      lastportkind = (char *) "output";
      lastportkind = (char *) "output";
 
 
    }
    }
 
 
};
};
 
 
 
out_sc_reg:
 
SC_OUT MENOR SC_REG MENOR NUMBER MAYOR MAYOR
out_sc_uint:
 
SC_OUT MENOR SC_UINT MENOR NUMBER MAYOR MAYOR
 
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      activeport = 1;
 
 
 
      lastportsize = $5;
 
 
 
      lastportkind = (char *) "output";
 
 
 
    }
 
 
 
};
 
 
 
 
 
 
 
out_sc_int:
 
SC_OUT MENOR SC_INT MENOR NUMBER MAYOR MAYOR
 
{
 
 
 
  if (translate == 1)
 
    {
 
 
 
      activeport = 1;
      activeport = 1;
 
 
      lastportsize = $5;
      lastportsize = $5;
 
 
      lastportkind = (char *) "output";
      lastportkind = (char *) "output";
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sc_method:
sc_method:
SC_METHOD OPENPAR WORD CLOSEPAR SEMICOLON
SC_METHOD OPENPAR WORD CLOSEPAR SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (method_found)
      if (method_found)
 
 
        {
        {
 
          processlist =
          processlist=InsertProcess (processlist, active_method, sensibilitylist,
            InsertProcess (processlist, active_method, sensibilitylist,
                         active_method_type);
                         active_method_type);
 
 
        }
        }
 
 
      active_method = (char *) $3;
      active_method = (char *) $3;
 
 
      method_found = 1;
      method_found = 1;
 
 
      /* New sensitivity list */
      /* New sensitivity list */
      sensibilitylist = NULL;
      sensibilitylist = NULL;
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sensible_par_neg:
sensible_par_neg:
SENSITIVE_NEG OPENPAR WORD CLOSEPAR SEMICOLON
SENSITIVE_NEG OPENPAR WORD CLOSEPAR SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      active_method_type = (char *) "seq";      //comb
      active_method_type = (char *) "seq";      //comb
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $3, "negedge");
      sensibilitylist =
 
        InsertSensibility (sensibilitylist, (char *) $3, "negedge");
    }
    }
 
 
};
};
 
 
 
 
 
 
sensible_par_pos:
sensible_par_pos:
SENSITIVE_POS OPENPAR WORD CLOSEPAR SEMICOLON
SENSITIVE_POS OPENPAR WORD CLOSEPAR SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      active_method_type = (char *) "seq";      //comb
      active_method_type = (char *) "seq";      //comb
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $3, "posedge");
      sensibilitylist =
 
        InsertSensibility (sensibilitylist, (char *) $3, "posedge");
    }
    }
 
 
};
};
 
 
 
 
 
 
sensitive_pos:
sensitive_pos:
SENSITIVE_POS
SENSITIVE_POS
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      last_sensibility = (char *) "posedge";
      last_sensibility = (char *) "posedge";
 
 
      active_method_type = (char *) "seq";      //seq
      active_method_type = (char *) "seq";      //seq
      sensibility_active = 1;
      sensibility_active = 1;
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sensitive_neg:
sensitive_neg:
SENSITIVE_NEG
SENSITIVE_NEG
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      last_sensibility = (char *) "negedge";
      last_sensibility = (char *) "negedge";
 
 
      active_method_type = (char *) "seq";      //seq
      active_method_type = (char *) "seq";      //seq
      sensibility_active = 1;
      sensibility_active = 1;
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sensitive:
sensitive:
SENSITIVE
SENSITIVE
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      last_sensibility = (char *) " ";
      last_sensibility = (char *) " ";
 
 
      active_method_type = (char *) "comb";     //comb
      active_method_type = (char *) "comb";     //comb
      sensibility_active = 1;
      sensibility_active = 1;
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sensible_par_colon:
sensible_par_colon:
SENSITIVE OPENPAR WORD CLOSEPAR SEMICOLON
SENSITIVE OPENPAR WORD CLOSEPAR SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      active_method_type = (char *) "comb";     //comb
      active_method_type = (char *) "comb";     //comb
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $3, " ");
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $3, " ");
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
 
 
sensible_word_colon:
sensible_word_colon:
SENSIBLE WORD
SENSIBLE WORD
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
      sensibilitylist =
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $2,
        InsertSensibility (sensibilitylist, (char *) $2,
                         (char *) last_sensibility);
                         (char *) last_sensibility);
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
sensible_word_semicolon:
sensible_word_semicolon:
SENSIBLE WORD SEMICOLON
SENSIBLE WORD SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
      sensibilitylist =
      sensibilitylist=InsertSensibility (sensibilitylist, (char *) $2,
        InsertSensibility (sensibilitylist, (char *) $2,
                         (char *) last_sensibility);
                         (char *) last_sensibility);
 
 
      if (sensibility_active)
      if (sensibility_active)
 
 
        {
        {
 
 
          sensibility_active = 0;
          sensibility_active = 0;
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
closekey:
closekey:
CLOSEKEY
CLOSEKEY
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (method_found)
      if (method_found)
 
 
        {
        {
 
 
          method_found = 0;
          method_found = 0;
 
          processlist =
          processlist=InsertProcess (processlist, active_method, sensibilitylist,
            InsertProcess (processlist, active_method, sensibilitylist,
                         active_method_type);
                         active_method_type);
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
word_semicolon:
word_semicolon:
WORD SEMICOLON
WORD SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (activeport)
      if (activeport)
 
 
        {
        {
 
          portlist =
          portlist=InsertPort (portlist,(char *) $1, lastportkind, lastportsize);
            InsertPort (portlist, (char *) $1, lastportkind, lastportsize);
 
 
          activeport = 0;
          activeport = 0;
 
 
        }
        }
 
 
      else if (signalactive)
      else if (signalactive)
 
 
        {
        {
 
          signalslist =
          signalslist=InsertSignal (signalslist,(char *) $1, lastsignalsize);
            InsertSignal (signalslist, (char *) $1, lastsignalsize);
 
 
          signalactive = 0;
          signalactive = 0;
 
 
        }
        }
      else if (multipledec)
      else if (multipledec)
        {
        {
 
 
          int length, list_pos;
          int length, list_pos;
 
 
          length = 0;
          length = 0;
 
 
          list_pos = 0;
          list_pos = 0;
 
 
          //Look in the enumerated list if it was declared e.j state_t state;
          //Look in the enumerated list if it was declared e.j state_t state;
          list_pos = findEnumList (enumlistlist, storedtype);
          list_pos = findEnumList (enumlistlist, storedtype);
 
 
          if (list_pos > -1)
          if (list_pos > -1)
            {
            {
 
 
              //Calculate the number of bits needed to represent the enumerate
              //Calculate the number of bits needed to represent the enumerate
              length = findEnumerateLength (enumlistlist, list_pos);
              length = findEnumerateLength (enumlistlist, list_pos);
 
 
 
 
              signalslist=InsertSignal (signalslist,(char *) $1, length);
              signalslist=InsertSignal (signalslist,(char *) $1, length);
 
 
              writeslist=InsertWrite (writeslist,(char *) $1);
              writeslist=InsertWrite (writeslist,(char *) $1);
 
 
              free (storedtype);
              free (storedtype);
 
 
              multipledec = 0;
              multipledec = 0;
 
 
            }
            }
          else
          else
            {
            {
 
              fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
              fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $1);
                       (char *) $1);
 
 
              return (1);
              return (1);
 
 
            }
            }
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
word_colon:
word_colon:
WORD COLON
WORD COLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (activeport)
      if (activeport)
 
 
        {
        {
 
          portlist =
          portlist=InsertPort (portlist,(char *) $1, lastportkind, lastportsize);
            InsertPort (portlist, (char *) $1, lastportkind, lastportsize);
 
 
        }
        }
 
 
      else if (signalactive)
      else if (signalactive)
 
 
        {
        {
 
          signalslist =
          signalslist=InsertSignal (signalslist,(char *) $1, lastsignalsize);
            InsertSignal (signalslist, (char *) $1, lastsignalsize);
 
 
        }
        }
 
 
      else if (reading_enumerates)
      else if (reading_enumerates)
 
 
        {
        {
 
 
          enumerateslist=InsertEnumerates (enumerateslist, (char *) $1);
          enumerateslist=InsertEnumerates (enumerateslist, (char *) $1);
 
 
 
 
        }
        }
      else if (multipledec)
      else if (multipledec)
        {
        {
 
 
          int length, list_pos;
          int length, list_pos;
 
 
          length = 0;
          length = 0;
 
 
          list_pos = 0;
          list_pos = 0;
 
 
          //Look in the enumerated list if it was declared e.j state_t state;
          //Look in the enumerated list if it was declared e.j state_t state;
          list_pos = findEnumList (enumlistlist, storedtype);
          list_pos = findEnumList (enumlistlist, storedtype);
 
 
          if (list_pos > -1)
          if (list_pos > -1)
            {
            {
 
 
              //Calculate the number of bits needed to represent the enumerate
              //Calculate the number of bits needed to represent the enumerate
              length = findEnumerateLength (enumlistlist, list_pos);
              length = findEnumerateLength (enumlistlist, list_pos);
 
 
 
 
              signalslist=InsertSignal (signalslist,(char *) $1, length);
              signalslist=InsertSignal (signalslist,(char *) $1, length);
 
 
              writeslist=InsertWrite (writeslist,(char *) $1);
              writeslist=InsertWrite (writeslist,(char *) $1);
 
 
              multipledec = 1;
              multipledec = 1;
 
 
            }
            }
          else
          else
            {
            {
 
              fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
              fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $1);
                       (char *) $1);
 
 
              return (1);
              return (1);
 
 
            }
            }
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
word_closekey_word:
word_closekey_word:
WORD CLOSEKEY WORD SEMICOLON
WORD CLOSEKEY WORD SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      //Finish enumerate var declaration
      //Finish enumerate var declaration
      if (reading_enumerates)
      if (reading_enumerates)
 
 
        {
        {
 
 
          enumerateslist=InsertEnumerates (enumerateslist, (char *) $1);
          enumerateslist=InsertEnumerates (enumerateslist, (char *) $1);
 
 
          enumlistlist=InsertEnumList (enumlistlist, enumerateslist, (char *) $4, 0);   //Insert also the variable name
          enumlistlist=InsertEnumList (enumlistlist, enumerateslist, (char *) $4, 0);   //Insert also the variable name
          reading_enumerates = 0;
          reading_enumerates = 0;
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
word_closekey:
word_closekey:
Line 811... Line 598...
    }
    }
 
 
};
};
 
 
 
 
 
 
 
 
instantation:
instantation:
WORD EQUALS NEW WORD OPENPAR QUOTE WORD QUOTE CLOSEPAR SEMICOLON
WORD EQUALS NEW WORD OPENPAR QUOTE WORD QUOTE CLOSEPAR SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
      instanceslist =
      instanceslist=InsertInstance (instanceslist, (char *) $1, (char *) $4);
        InsertInstance (instanceslist, (char *) $1, (char *) $4);
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
port_binding:
port_binding:
Line 835... Line 617...
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      if (instanceslist == NULL){
      if (instanceslist == NULL)
 
        {
             fprintf (stderr, "line: %d error: no instances found\n",lineno);
             fprintf (stderr, "line: %d error: no instances found\n",lineno);
          }else{
        }
 
      else
 
        {
 
 
            InstanceNode *ill;
            InstanceNode *ill;
        SGLIB_LIST_MAP_ON_ELEMENTS (InstanceNode, instanceslist, ill, next,
        SGLIB_LIST_MAP_ON_ELEMENTS (InstanceNode, instanceslist, ill, next,
        {
        {
                    if (strcmp (ill->nameinstance, (char *) $1) == 0){
                                      if (strcmp
               ill->bindslist=InsertBind (ill->bindslist, (char *) $3, (char *) $5);
                                          (ill->nameinstance,
                           break;
                                           (char *) $1) == 0)
                        }
                                      {
 
                                      ill->bindslist =
 
                                      InsertBind (ill->bindslist, (char *) $3,
 
                                                  (char *) $5); break;}
            }
            }
                );
                );
    }
    }
 
 
   }
   }
Line 932... Line 720...
WORD WORD SEMICOLON
WORD WORD SEMICOLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
 
 
      int length, list_pos;
      int length, list_pos;
 
 
      length = 0;
      length = 0;
 
 
      list_pos = 0;
      list_pos = 0;
 
 
      //Look in the enumerated list if it was declared e.j state_t state;
      //Look in the enumerated list if it was declared e.j state_t state;
      list_pos = findEnumList (enumlistlist, (char *) $1);
      list_pos = findEnumList (enumlistlist, (char *) $1);
 
 
      if (list_pos > -1)
      if (list_pos > -1)
        {
        {
 
 
          //Calculate the number of bits needed to represent the enumerate
          //Calculate the number of bits needed to represent the enumerate
          length = findEnumerateLength (enumlistlist, list_pos);
          length = findEnumerateLength (enumlistlist, list_pos);
 
 
 
 
          signalslist=InsertSignal (signalslist,(char *) $2, length);
          signalslist=InsertSignal (signalslist,(char *) $2, length);
 
 
          writeslist=InsertWrite (writeslist,(char *) $2);
          writeslist=InsertWrite (writeslist,(char *) $2);
 
 
        }
        }
      else
      else
        {
        {
 
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $1);
                   (char *) $1);
 
 
          return (1);
          return (1);
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
declaration_sc_signal:
declaration_sc_signal:
Line 1000... Line 777...
 
 
        }
        }
      else
      else
        {
        {
 
 
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $3);
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
 
                   (char *) $3);
 
 
          return (1);
          return (1);
 
 
        }
        }
 
 
Line 1048... Line 826...
 
 
        }
        }
      else
      else
        {
        {
 
 
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $1);
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
 
                   (char *) $1);
 
 
          return (1);
          return (1);
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
multiple_sc_signal_declaration:
multiple_sc_signal_declaration:
SC_SIGNAL MENOR WORD MAYOR WORD COLON
SC_SIGNAL MENOR WORD MAYOR WORD COLON
{
{
 
 
  if (translate == 1)
  if (translate == 1)
    {
    {
      int length, list_pos;
      int length, list_pos;
      length = 0;
      length = 0;
      list_pos = 0;
      list_pos = 0;
 
 
      //Look in the enumerated list if it was declared e.j state_t state;
      //Look in the enumerated list if it was declared e.j state_t state;
      list_pos = findEnumList (enumlistlist, (char *) $3);
      list_pos = findEnumList (enumlistlist, (char *) $3);
 
 
      if (list_pos > -1)
      if (list_pos > -1)
          {
          {
 
 
          //Calculate the number of bits needed to represent the enumerate
          //Calculate the number of bits needed to represent the enumerate
          length = findEnumerateLength (enumlistlist, list_pos);
          length = findEnumerateLength (enumlistlist, list_pos);
 
 
          storedtype = (char *)malloc (sizeof (char) * strlen ((char *) $3));
          storedtype = (char *)malloc (sizeof (char) * strlen ((char *) $3));
 
 
          strcpy (storedtype, (char *) $3);
          strcpy (storedtype, (char *) $3);
 
 
          signalslist=InsertSignal (signalslist,(char *) $5, length);
          signalslist=InsertSignal (signalslist,(char *) $5, length);
 
 
          writeslist=InsertWrite (writeslist,(char *) $5);
          writeslist=InsertWrite (writeslist,(char *) $5);
 
 
          multipledec = 1;
          multipledec = 1;
 
 
        }
        }
      else
      else
        {
        {
 
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno,
          fprintf (stderr, "\nline: %d Type %s unknow\n", lineno, (char *) $3);
                   (char *) $3);
 
 
          return (1);
          return (1);
 
 
        }
        }
 
 
    }
    }
 
 
};
};
 
 
 
 
 
 
translateoff:
translateoff:
TRANSLATEOFF
TRANSLATEOFF
{
{
 
 
  translate = 0;
  translate = 0;
 
 
  fprintf (stderr, "line: %d Found Translate off directive \n",lineno);
  fprintf (stderr, "line: %d Found Translate off directive \n",lineno);
 
 
};
};
 
 
 
 
 
 
translateon:
translateon:
TRANSLATEON
TRANSLATEON
{
{
 
 
  translate = 1;
  translate = 1;
 
 
  fprintf (stderr, "line: %d Found Translate on directive \n",lineno);
  fprintf (stderr, "line: %d Found Translate on directive \n",lineno);
 
};
 
 
 
function:
 
SC_REG MENOR NUMBER MAYOR WORD OPENPAR
 
{
 
  fprintf (stderr, "line: %d Found Function Declaration \n", lineno);
 
  /* New inputs list */
 
  functionname = (char *) $5;
 
  outputlenght = $3;
 
  funcinputslist = NULL;
 
};
 
 
 
functioninputs:
 
SC_REG MENOR NUMBER MAYOR WORD COLON
 
{
 
  funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3);
 
};
 
 
 
finishfunctioninputs:
 
SC_REG MENOR NUMBER MAYOR WORD CLOSEPAR SEMICOLON
 
{
 
  funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3);
 
  functionslist =
 
    InsertFunction (functionslist, functionname, funcinputslist,
 
                    outputlenght);
 
};
 
 
 
boolfunction:
 
BOOL WORD OPENPAR
 
{
 
  fprintf (stderr, "line: %d Found Function Declaration \n", lineno);
 
  /* New inputs list */
 
  functionname = (char *) $2;
 
  outputlenght = 1;
 
  funcinputslist = NULL;
 
};
 
 
 
boolfunctioninputs:
 
BOOL WORD COLON
 
{
 
  funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2, 1);
 
};
 
 
 
boolfinishfunctioninputs:
 
BOOL WORD CLOSEPAR SEMICOLON
 
{
 
  funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2, 1);
 
  functionslist =
 
    InsertFunction (functionslist, functionname, funcinputslist,
 
                    outputlenght);
};
};

powered by: WebSVN 2.1.0

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