my input in systemverilog is in bits; but I need it to be in uint8_t. is API or library can do it? FYI, Im trying to verify verilog results with .C using "dpi".
system verilog:
//import "DPI-C" function int test_encrypt_ecb();
import "DPI-C" function void compute_bit(input bit i_value, output bit result);
import "DPI-C" function bit get_bit(input bit i_value);
import "DPI-C" function void compute_logic_vector(reg[127:0] i_value, reg[127:0] result, int asize);
c:
void compute_reg_vector(const svLogicVecVal* i_value, svLogicVecVal* result,
int asize) {
log_info("dpi_c.compute_reg_vector(): input %s",
svLogicVecVal2String(i_value, asize));
uint8_t key[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
int j =0;
struct AES_ctx ctx;
j++;
AES_init_ctx(&ctx, key);
f2(&ctx, i_value);
int i;
for(i=0;i<15;i++){
printf("ECB encrypt: ");
memcpy(&result, i_value, 16);
log_info("dpi_c.compute_reg_vector(): result %s",
svLogicVecVal2String(result, asize));
}
void f2(const struct AES_ctx* ctx, uint8_t* buf)
{
Cipher((state_t*)buf, ctx->Ry);
}
error of c compilation
warning: passing argument 2 of \f2\u2019 from incompatible pointer type [enabled by default]
note: expected \u2018uint8_t *\u2019 but argument is of type \u2018const struct svLogicVecVal *\u2019
void f2(const struct AES_ctx* ctx, uint8_t* buf);
warning: \u2018main\u2019 is normally a non-static function [-Wmain]
int main(void)