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

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [pli/] [aes_bfm_wr.h] - Diff between revs 4 and 9

Show entire file | Details | Blame | View Log

Rev 4 Rev 9
Line 118... Line 118...
 
 
                                }else
                                }else
                                {
                                {
                                        STATE = WRITE;
                                        STATE = WRITE;
 
 
                                        counter = 0;
                                        counter = 1;
 
 
                                        v_wr.value.integer = vector_address[0];
                                        //v_wr.value.integer = vector_address[0];
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
                                        //vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
                                        v_wr.value.integer = 4094;
                                        //v_wr.value.integer = 4094;
                                        vpi_put_value(PWDATA, &v_wr, NULL, vpiNoDelay);
                                        //vpi_put_value(PWDATA, &v_wr, NULL, vpiNoDelay);
 
 
                                        v_wr.value.integer = 1;
                                        v_wr.value.integer = 1;
                                        vpi_put_value(PWRITE, &v_wr, NULL, vpiNoDelay);
                                        vpi_put_value(PWRITE, &v_wr, NULL, vpiNoDelay);
 
 
                                        v_wr.value.integer = 1;
                                        v_wr.value.integer = 1;
Line 139... Line 139...
 
 
                        break;
                        break;
 
 
                        case WRITE:
                        case WRITE:
 
 
 
 
 
 
 
                        v_wr.value.integer = 1;
 
                        vpi_put_value(PSEL, &v_wr, NULL, vpiNoDelay);
 
 
                                if(counter == 0)
                                if(counter == 0)
                                {
                                {
 
 
                                        counter_write++;
                                        counter_write++;
                                        counter++;
                                        counter++;
 
 
                                        v_wr.value.integer = 1;
                                        v_wr.value.integer = 1;
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
 
 
                                }else if(counter == 1)
                                }else if(counter == 1)
                                {
                                {
 
 
                                        v_wr.value.integer = vector_address[counter_write];
 
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        v_wr.value.integer = 0;
 
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        t_wr.type = vpiScaledRealTime;
                                        t_wr.type = vpiScaledRealTime;
                                        t_wr.real = 0;
                                        t_wr.real = 0;
                                        v_wr.format=vpiIntVal;
                                        v_wr.format=vpiIntVal;
 
 
 
                                v_wr.value.integer = 0;
 
                                vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
 
 
 
                                if(counter_write < 9)
 
                                {
 
 
 
                                        v_wr.value.integer = vector_address[counter_write];
 
                                        vpi_put_value(PADDR, &v_wr, &t_wr, vpiTransportDelay);
 
 
                                        if(FIPS_ENABLE == FIPS)
                                        if(FIPS_ENABLE == FIPS)
                                        {
                                        {
 
 
                                                if(vector_address[counter_write] == ADDR_AES_KEYR3 || vector_address[counter_write] == ADDR_AES_IVR3)
                                                if(vector_address[counter_write] == ADDR_AES_KEYR3 || vector_address[counter_write] == ADDR_AES_IVR3)
                                                {
                                                {
Line 222... Line 232...
 
 
                                        }else if(FIPS_ENABLE == RANDOM_DATA)
                                        }else if(FIPS_ENABLE == RANDOM_DATA)
                                        {
                                        {
                                                v_wr.value.integer = data_in(rd);
                                                v_wr.value.integer = data_in(rd);
                                        }
                                        }
 
 
                                        vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
                                        vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
 
 
 
 
                                        a = 0;
                                        a = 0;
                                        b = 0;
                                        b = 0;
                                        c = 0;
                                        c = 0;
                                        d = 0;
                                        d = 0;
 
 
                                        v_wr.value.integer = 1;
 
                                        vpi_put_value(PSEL, &v_wr, NULL, vpiNoDelay);
 
 
 
 
 
 
                                }else if(counter_write == 9)//ENABLE CR
 
                                {
 
 
 
                                        v_wr.value.integer = vector_address[counter_write];
 
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        v_wr.value.integer = 4094;
 
                                        vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
 
 
 
                                }else if(counter_write > 9  &&  counter_write < 14) //WRITE DINR
 
                                {
 
 
 
                                        v_wr.value.integer = ADDR_AES_DINR;
 
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
 
 
                                        if(FIPS_ENABLE == FIPS)
 
                                        {
 
 
 
                                                if(counter_write == 10)
 
                                                {
 
                                                        a = a | TEXT_FIPS_NOT_DERIVATED[0];
 
                                                        a = a << 8;
 
                                                        a = a | TEXT_FIPS_NOT_DERIVATED[1];
 
                                                        a = a << 8;
 
                                                        a = a | TEXT_FIPS_NOT_DERIVATED[2];
 
                                                        a = a << 8;
 
                                                        a = a | TEXT_FIPS_NOT_DERIVATED[3];
 
                                                        v_wr.value.integer = a;
 
 
 
                                                }else if(counter_write == 11)
 
                                                {
 
                                                        b = b | TEXT_FIPS_NOT_DERIVATED[4];
 
                                                        b = b << 8;
 
                                                        b = b | TEXT_FIPS_NOT_DERIVATED[5];
 
                                                        b = b << 8;
 
                                                        b = b | TEXT_FIPS_NOT_DERIVATED[6];
 
                                                        b = b << 8;
 
                                                        b = b | TEXT_FIPS_NOT_DERIVATED[7];
 
                                                        v_wr.value.integer = b;
 
 
 
                                                }else if(counter_write == 12 )
 
                                                {
 
 
 
                                                        c = c | TEXT_FIPS_NOT_DERIVATED[8];
 
                                                        c = c << 8;
 
                                                        c = c | TEXT_FIPS_NOT_DERIVATED[9];
 
                                                        c = c << 8;
 
                                                        c = c | TEXT_FIPS_NOT_DERIVATED[10];
 
                                                        c = c << 8;
 
                                                        c = c | TEXT_FIPS_NOT_DERIVATED[11];
 
                                                        v_wr.value.integer = c;
 
 
 
                                                }else if(counter_write == 13 )
 
                                                {
 
                                                        d = d | TEXT_FIPS_NOT_DERIVATED[12];
 
                                                        d = d << 8;
 
                                                        d = d | TEXT_FIPS_NOT_DERIVATED[13];
 
                                                        d = d << 8;
 
                                                        d = d | TEXT_FIPS_NOT_DERIVATED[14];
 
                                                        d = d << 8;
 
                                                        d = d | TEXT_FIPS_NOT_DERIVATED[15];
 
                                                        v_wr.value.integer = d;
 
 
 
                                                }
 
 
 
 
 
                                        }else if(FIPS_ENABLE == RANDOM_DATA)
 
                                        {
 
                                                v_wr.value.integer = data_in(rd);
 
                                        }
 
 
 
                                        vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
 
 
 
                                        a = 0;
 
                                        b = 0;
 
                                        c = 0;
 
                                        d = 0;
 
 
 
 
 
                                }
                                        counter=0;
                                        counter=0;
 
 
                                }
                                }
 
 
                                if(counter_write == 12)
 
 
 
 
                                if(counter_write == 14)
                                {
                                {
                                        STATE =WAIT;
 
                                        counter_write = 0;
                                        counter_write = 0;
 
                                        STATE = WAIT;
                                }
                                }
 
 
 
 
 
 
                        break;
                        break;
 
 
                        case WAIT:
                        case WAIT:
 
 
                                v_wr.value.integer = 0;
                                v_wr.value.integer = 0;
                                vpi_put_value(PWRITE, &v_wr, NULL, vpiNoDelay);
                                vpi_put_value(PWRITE, &v_wr, NULL, vpiNoDelay);
 
 
                                vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
                                vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
                                vpi_put_value(PWDATA, &v_wr, &t_wr, vpiTransportDelay);
 
 
                                if(counter_wait == 5)
                                if(counter_wait == 5)
                                {
                                {
 
 
                                        STATE = READ_RESULTS;
                                        STATE = READ_RESULTS;
                                        counter_wait=0;
                                        counter_wait=0;
                                        v_wr.value.integer = vector_address[0];
                                        counter_read = 0;
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
                                        //v_wr.value.integer = ADDR_AES_DOUTR;
 
                                        //vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);        
 
 
 
                                        t_wr.type = vpiScaledRealTime;
 
                                        t_wr.real = 0;
 
                                        v_ecb.value.integer = ADDR_AES_DOUTR;
 
                                        vpi_put_value(PADDR, &v_wr, &t_wr, vpiTransportDelay);
 
 
 
                                        //v_wr.value.integer = 1;
 
                                        //vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);                                      
 
 
 
 
                                }else
                                }else
                                {
                                {
 
 
 
                                        v_wr.value.integer = 0;
 
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
                                        counter_wait++;
                                        counter_wait++;
 
 
                                }
                                }
                        break;
                        break;
 
 
Line 288... Line 392...
                                        counter_read++;
                                        counter_read++;
                                        counter++;
                                        counter++;
 
 
                                }else if(counter == 1)
                                }else if(counter == 1)
                                {
                                {
                                        counter++;
 
 
 
 
 
                                        v_wr.value.integer = 0;
                                        v_wr.value.integer = 0;
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
                                        v_wr.value.integer = vector_address[counter_read];
                                        //v_wr.value.integer = 0;
 
                                        //vpi_put_value(PWDATA, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        //v_wr.value.integer = 1;
 
                                        //vpi_put_value(PSEL, &v_wr, NULL, vpiNoDelay);
 
 
 
 
 
                                        if(counter_read < 4)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_DOUTR;
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
                                        vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
                                        v_wr.value.integer = 0;
                                        }
                                        vpi_put_value(PWDATA, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        v_wr.value.integer = 1;
 
                                        vpi_put_value(PSEL, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        counter=0;
                                        if(counter_read == 4)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_KEYR3;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
                                        if(counter_read == 5)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_KEYR2;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
                                }
                                }
 
 
 
 
 
 
 
                                        if(counter_read == 6)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_KEYR1;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
                                        if(counter_read == 7)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_KEYR0;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
                                        if(counter_read == 8)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_IVR3;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
                                        if(counter_read == 9)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_IVR2;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
 
 
                                        if(counter_read == 10)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_IVR1;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
                                        if(counter_read == 11)
 
                                        {
 
 
 
                                                v_wr.value.integer = ADDR_AES_IVR0;
 
                                                vpi_put_value(PADDR, &v_wr, NULL, vpiNoDelay);
 
 
 
                                        }
 
 
 
 
 
 
 
                                        counter=0;
 
 
                                if(counter_read == 12)
                                if(counter_read == 12)
                                {
                                {
                                        STATE = IDLE;
                                        STATE = IDLE;
                                        counter_read = 0;
                                        counter_read = 0;
                                        PACKETS_GENERATED = PACKETS_GENERATED + 1;
                                        PACKETS_GENERATED = PACKETS_GENERATED + 1;
 
 
                                        v_wr.value.integer = 0;
                                                //v_wr.value.integer = 0;
                                        vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
                                                //vpi_put_value(PENABLE, &v_wr, NULL, vpiNoDelay);
 
 
                                }
                                }
 
 
 
                                }
 
 
 
 
 
 
 
 
                        break;
                        break;
                }
                }
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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