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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [src/] [sc2v_step1.y] - Diff between revs 6 and 10

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

Rev 6 Rev 10
Line 93... Line 93...
        FILE_DEFINES = fopen(file_defines,(char *)"w");
        FILE_DEFINES = fopen(file_defines,(char *)"w");
 
 
        file_writes = (char *)malloc(256*sizeof(int));
        file_writes = (char *)malloc(256*sizeof(int));
        strcpy(file_writes, (char *)"file_writes.sc2v");
        strcpy(file_writes, (char *)"file_writes.sc2v");
        FILE_WRITES = fopen(file_writes,(char *)"w");
        FILE_WRITES = fopen(file_writes,(char *)"w");
 
 
                        if(FILE_WRITES!=NULL)
                        if(FILE_WRITES!=NULL)
                                printf("\nopening file => filename = %s\n",file_writes);
                                printf("\nopening file => filename = %s\n",file_writes);
 
 
 
        lastword=malloc(sizeof(char)*256);
 
 
    translate=1;
    translate=1;
        verilog=0;
        verilog=0;
        writemethod=0;
        writemethod=0;
 
 
        yyparse();
        yyparse();
Line 407... Line 410...
 
 
                                    fprintf(file,"begin\n");
                                    fprintf(file,"begin\n");
                                    openedcase = 0;
                                    openedcase = 0;
                             }
                             }
 
 
                                 lastword=malloc(sizeof(char)*strlen((char *)$1));
 
                             strcpy(lastword, (char *)$1);
                             strcpy(lastword, (char *)$1);
 
 
                             if(reg_found)
                             if(reg_found)
                             {
                             {
 
 
 
                              regname=malloc(sizeof(char)*(strlen((char *)$1)+1));
 
                              regname2=malloc(sizeof(char)*(strlen((char *)$1)+strlen(processname))+1);
 
 
                              strcpy(regname ,(char *)$1);
                              strcpy(regname ,(char *)$1);
                              strcpy(regname2 ,(char *)$1);
                              strcpy(regname2 ,(char *)$1);
                              strcat(regname2, processname);
                              strcat(regname2, processname);
                              fprintf(regs_file,"%s",regname2);
                              fprintf(regs_file,"%s",regname2);
                              InsertReg(regslist, regname, regname2);
                              InsertReg(regslist, regname, regname2);
 
                              free(regname);
 
                              free(regname2);
                             }
                             }
                             else
                             else
                             {
                             {
                               if(newline)
                               if(newline)
                                   {
                                   {
Line 443... Line 451...
                                   else
                                   else
                                         fprintf(file,"%s",regname2);
                                         fprintf(file,"%s",regname2);
 
 
                                   newline = 0;
                                   newline = 0;
                             }
                             }
 
 
                          }
                          }
                          else if(definefound)
                          else if(definefound)
                          {
                          {
                                if(IsDefine(defineslist, (char *)$1))
                                if(IsDefine(defineslist, (char *)$1))
                                {
                                {
Line 493... Line 502...
                                }
                                }
                                else if(definefound)
                                else if(definefound)
                                {
                                {
                                        fprintf(FILE_DEFINES," = ");
                                        fprintf(FILE_DEFINES," = ");
                                }
                                }
                                free(lastword);
 
 
 
                        }else if(verilog==1){
                        }else if(verilog==1){
                            fprintf(file,".write");
                            fprintf(file,".write");
                         }
                         }
                        };
                        };
Line 659... Line 667...
                                        printf("opening file => filename = %s\n",fileregs);
                                        printf("opening file => filename = %s\n",fileregs);
                                        regs_file = fopen(fileregs,(char *)"w");
                                        regs_file = fopen(fileregs,(char *)"w");
                                        processfound = 1;
                                        processfound = 1;
                                        regslist = (RegsList *)malloc(sizeof(RegsList));
                                        regslist = (RegsList *)malloc(sizeof(RegsList));
                                        InitializeRegsList(regslist);
                                        InitializeRegsList(regslist);
                                        regname = (char *)malloc(256*sizeof(int));
                        /*              regname = (char *)malloc(256*sizeof(int));
                                        regname2 = (char *)malloc(256*sizeof(int));
                                        regname2 = (char *)malloc(256*sizeof(int));*/
                                }
                                }
                                if(processfound)
                                if(processfound)
                                        if(openedkeys != switchparenthesis)
                                        if(openedkeys != switchparenthesis)
                                        {
                                        {
                                            fprintf(file,"\n");
                                            fprintf(file,"\n");
Line 721... Line 729...
                                else if(openedkeys==0)
                                else if(openedkeys==0)
                                {
                                {
                                        fclose(file);
                                        fclose(file);
                                        fclose(regs_file);
                                        fclose(regs_file);
                                        free(regslist);
                                        free(regslist);
                                        free(regname);
/*                                      free(regname);
                                        free(regname2);
                                        free(regname2);*/
                                        processfound = 0;
                                        processfound = 0;
                                }
                                }
                        }else if(verilog==1)
                        }else if(verilog==1)
                       fprintf(file,"}");
                       fprintf(file,"}");
                        };
                        };

powered by: WebSVN 2.1.0

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