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

Subversion Repositories csa

[/] [csa/] [trunk/] [bench/] [csa_pli.c] - Diff between revs 24 and 35

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

Rev 24 Rev 35
Line 48... Line 48...
        arg_handle = vpi_scan(arg_itr);
        arg_handle = vpi_scan(arg_itr);
        value_s.format = vpiStringVal;
        value_s.format = vpiStringVal;
        vpi_get_value(arg_handle, &value_s);
        vpi_get_value(arg_handle, &value_s);
        strcpy(str,value_s.value.str);
        strcpy(str,value_s.value.str);
 
 
        fp=fopen(str,"r");
        fp=fopen(str,"rb");
        if(fp)
        if(fp)
        {
        {
                fscanf(fp,"%s",&data);
                int i;
                value_s.format = vpiBinStrVal;
                int b;
                value_s.value.str=data;
                unsigned int word;
 
                int vector_size;
 
                //fscanf(fp,"%s",&data);
                arg_handle = vpi_scan(arg_itr);
                arg_handle = vpi_scan(arg_itr);
 
 
 
                vector_size = vpi_get(vpiSize, arg_handle);
 
                vpi_printf("vector_size=%d \n", vector_size);
 
 
 
                value_s.format = vpiVectorVal;
 
                vpi_get_value(arg_handle, &value_s);
 
                for (i=0;i<vector_size/32;i++)
 
                {
 
                        fread(&word,4,1,fp);
 
                        value_s.value.vector[i].bval=0;
 
                        value_s.value.vector[i].aval=word;
 
                }
                vpi_put_value(arg_handle, &value_s,NULL, vpiNoDelay);
                vpi_put_value(arg_handle, &value_s,NULL, vpiNoDelay);
                fclose(fp);
                fclose(fp);
        }
        }
        else
        else
        {
        {
Line 107... Line 121...
 
 
        arg_handle = vpi_scan(arg_itr);
        arg_handle = vpi_scan(arg_itr);
        value_s.format = vpiStringVal;
        value_s.format = vpiStringVal;
        vpi_get_value(arg_handle, &value_s);
        vpi_get_value(arg_handle, &value_s);
        if(!strcmp("a",value_s.value.str))
        if(!strcmp("a",value_s.value.str))
                fp=fopen(str,"a");
                fp=fopen(str,"ab");
        else
        else
                fp=fopen(str,"w");
                fp=fopen(str,"wb");
        if(fp)
        if(fp)
        {
        {
                value_s.format = vpiBinStrVal;
                unsigned int word;
 
                int b;
 
                int i;
 
                int vector_size;
 
                value_s.format = vpiVectorVal;
                arg_handle = vpi_scan(arg_itr);
                arg_handle = vpi_scan(arg_itr);
 
                vector_size = vpi_get(vpiSize, arg_handle);
 
                vpi_printf("str:%s vector_size=%d\n",str,vector_size);
                vpi_get_value(arg_handle, &value_s);
                vpi_get_value(arg_handle, &value_s);
                //fprintf(fp,"%s\n",data);
                for(i=0;i<vector_size/32;i++)
                fprintf(fp,"%s\n",value_s.value.str);
                {
 
                        vpi_printf("i=%d\n",i);
 
                        fwrite(&value_s.value.vector[i].aval,4,1,fp);
 
                }
 
                fwrite(&value_s.value.vector[i].aval,(vector_size%32)/8,1,fp);
                fclose(fp);
                fclose(fp);
        }
        }
        else
        else
        {
        {
                vpi_printf("can't open the output file in %s \n", __FUNCTION__);
                vpi_printf("can't open the output file in %s \n", __FUNCTION__);

powered by: WebSVN 2.1.0

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