Line 341... |
Line 341... |
|
|
v_ecb.value.integer = 1;
|
v_ecb.value.integer = 1;
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
|
|
|
|
}else if(counter == 1)
|
|
{
|
|
v_ecb.value.integer = 0;
|
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
|
|
|
counter=0;
|
|
}
|
|
|
|
v_ecb.value.integer = 0;
|
v_ecb.value.integer = 0;
|
vpi_get_value(PRDATA,&v_ecb);
|
vpi_get_value(PRDATA,&v_ecb);
|
|
|
if(v_ecb.value.integer == 1)
|
if(v_ecb.value.integer == 1)
|
{
|
{
|
STATE = READ_KEY_GEN;
|
STATE = READ_KEY_GEN;
|
|
|
t_ecb.type = vpiScaledRealTime;
|
//t_ecb.type = vpiScaledRealTime;
|
t_ecb.real = 10;
|
//t_ecb.real = 10;
|
v_ecb.format=vpiIntVal;
|
//v_ecb.format=vpiIntVal;
|
v_ecb.value.integer = ADDR_AES_KEYR3;
|
//v_ecb.value.integer = ADDR_AES_KEYR3;
|
vpi_put_value(PADDR, &v_ecb, &t_ecb, vpiTransportDelay);
|
//vpi_put_value(PADDR, &v_ecb, &t_ecb, vpiTransportDelay);
|
|
}
|
|
|
|
|
|
}else if(counter == 1)
|
|
{
|
|
v_ecb.value.integer = 0;
|
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
|
|
|
counter=0;
|
}
|
}
|
|
|
|
|
|
|
break;
|
break;
|
|
|
|
|
case READ_KEY_GEN:
|
case READ_KEY_GEN:
|
|
|
Line 385... |
Line 387... |
|
|
|
|
}else if(counter == 1)
|
}else if(counter == 1)
|
{
|
{
|
|
|
if(counter_read == 0)
|
v_ecb.value.integer = 0;
|
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
|
|
|
if(counter_read < 4)
|
{
|
{
|
v_ecb.value.integer = ADDR_AES_KEYR3;
|
v_ecb.value.integer = ADDR_AES_DOUTR;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
|
if(counter_read == 4)
|
|
{
|
|
v_ecb.value.integer = ADDR_AES_KEYR3;
|
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
}
|
|
|
if(counter_read == 1)
|
if(counter_read == 5)
|
{
|
{
|
v_ecb.value.integer = ADDR_AES_KEYR2;
|
v_ecb.value.integer = ADDR_AES_KEYR2;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
|
|
if(counter_read == 2)
|
if(counter_read == 6)
|
{
|
{
|
v_ecb.value.integer = ADDR_AES_KEYR1;
|
v_ecb.value.integer = ADDR_AES_KEYR1;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
if(counter_read == 3)
|
if(counter_read == 7)
|
{
|
{
|
v_ecb.value.integer = ADDR_AES_KEYR0;
|
v_ecb.value.integer = ADDR_AES_KEYR0;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
if(counter_read == 4)
|
if(counter_read == 8)
|
{
|
{
|
|
|
v_ecb.value.integer = ADDR_AES_IVR3;
|
v_ecb.value.integer = ADDR_AES_IVR3;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
|
if(counter_read == 9)
|
if(counter_read == 5)
|
|
{
|
{
|
|
|
v_ecb.value.integer = ADDR_AES_IVR2;
|
v_ecb.value.integer = ADDR_AES_IVR2;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
|
if(counter_read == 10)
|
|
|
if(counter_read == 6)
|
|
{
|
{
|
|
|
v_ecb.value.integer = ADDR_AES_IVR1;
|
v_ecb.value.integer = ADDR_AES_IVR1;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
|
if(counter_read == 11)
|
if(counter_read == 7)
|
|
{
|
{
|
|
|
v_ecb.value.integer = ADDR_AES_IVR0;
|
v_ecb.value.integer = ADDR_AES_IVR0;
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
vpi_put_value(PADDR, &v_ecb, NULL, vpiNoDelay);
|
|
|
}
|
}
|
|
|
v_ecb.value.integer = 0;
|
|
vpi_put_value(PENABLE, &v_ecb, NULL, vpiNoDelay);
|
|
|
|
counter = 0;
|
counter = 0;
|
}
|
}
|
|
|
if(counter_read == 8)
|
if(counter_read == 12)
|
{
|
{
|
STATE = RESET_SR;
|
STATE = RESET_SR;
|
counter_write = 0;
|
counter_write = 0;
|
counter_read = 0;
|
counter_read = 0;
|
}
|
}
|