void test_incf_given_d_is_0_result_should_store_into_WREG(void)
{
  int fileAddress = 0x49;
  memory [fileAddress] = 0x48;
  int d = DIR_WREG, accessType = AccessRAM;
  
  incf (fileAddress, d, accessType);
  
  TEST_ASSERT_EQUAL_INT8(0x49, WREG); 
}
void test_incf_given_d_is_1_result_should_store_into_WREG(void)
{
  int fileAddress = 0x51;
  memory [fileAddress] = 0xFF;
  int d = DIR_fileRegister, accessType = AccessRAM;
  
  incf (fileAddress, d, accessType);
  int dataMemoryAddr = getFileAddress (fileAddress, accessType);
  
  TEST_ASSERT_EQUAL_INT8(0x00, memory[dataMemoryAddr]); 
}
void test_incf_given_a_is_1_result_should_store_into_general_purpose_register(void)
{
  int fileAddress = 0x251;
  memory [fileAddress] = 0x0F;
  BSR = 0x2;
  int d = DIR_fileRegister, accessType = BankRAM;
  
  incf (fileAddress, d, accessType);
  int dataMemoryAddr = getFileAddress (fileAddress, accessType);
  
  TEST_ASSERT_EQUAL_INT8(0x10, memory[dataMemoryAddr]); 
}
Exemple #4
0
void CTRcry(unsigned char *buf, int len, unsigned char *cbuf, cbuf_inc *incf, f_ectx cx[1])
{   int i, cnt;
    uint8_t ecbuf[AES_BLOCK_SIZE];

    while(len)
    {
        cnt = (len > AES_BLOCK_SIZE) ? AES_BLOCK_SIZE : len;
        f_enc_blk(cx, cbuf, ecbuf);
        if(cnt == AES_BLOCK_SIZE)
            incf(cbuf);

        for(i = 0; i < cnt; i++)
            buf[i] ^= ecbuf[i];

        len -= cnt, buf += cnt;
    }
}