Ejemplo n.º 1
0
main ()
{
  test_fetch_add ();
  test_fetch_sub ();
  test_fetch_and ();
  test_fetch_nand ();
  test_fetch_xor ();
  test_fetch_or ();

  test_add_fetch ();
  test_sub_fetch ();
  test_and_fetch ();
  test_nand_fetch ();
  test_xor_fetch ();
  test_or_fetch ();

  test_add ();
  test_sub ();
  test_and ();
  test_nand ();
  test_xor ();
  test_or ();

  return 0;
}
Ejemplo n.º 2
0
/*
 * A single random test
 * - pick two existing bits x and y
 * - select between OR and XOR randomly
 */
static void random_test(void) {
  bit_t x, y;

  x = random_bit();
  y = random_bit();
  if (random() & 0x8000) {
    test_or(x, y);
  } else {
    test_xor(x, y);
  }
}
Ejemplo n.º 3
0
int main()
{

    try
    {
        test_xor();
        //test_multilayer();
    }
    catch(const char* err)
    {
        std::cerr << err << std::endl;
    }
    //getchar();
    return 0;
}
Ejemplo n.º 4
0
/*
 * Test all pairwise combinations of existing terms
 */
static void test_all_pairs(void) {
  uint32_t n;
  bit_t x, y;

  n = max+1;
  for (x = 0; x<n; x++) {
    if (! fresh[x]) {
      for (y=0; y<n; y++) {
	if (! fresh[y]) {
	  test_or(x, y);
	  test_xor(x, y);
	}
      }
    }
  }
}
Ejemplo n.º 5
0
int
main ()
{
  test_fetch_add ();
  test_fetch_sub ();
  test_fetch_and ();
  test_fetch_xor ();
  test_fetch_or ();

  test_add ();
  test_sub ();
  test_and ();
  test_xor ();
  test_or ();

  return 0;
}
Ejemplo n.º 6
0
int main(int argc, char **argv) {
	printf("-- TEST BEGIN\n");

	test_addu();
	test_addiu();
	test_and();
	test_andi();
	test_daddu();
	test_daddiu();
	test_dsll();
	test_dsll32();
	test_dsllv();
	test_dsra();
	test_dsra32();
	test_dsrav();
	test_dsrl();
	test_dsrl32();
	test_dsrlv();
	test_dsubu();
	test_lui();
	test_movn();
	test_movz();
	test_nor();
	test_or();
	test_ori();
	test_sll();
	test_sllv();
	test_slt();
	test_slti();
	test_sltiu();
	test_sltu();
	test_sra();
	test_srav();
	test_srl();
	test_srlv();
	test_subu();
	test_xor();
	test_xori();

	printf("-- TEST END\n");

	return 0;
}
Ejemplo n.º 7
0
Archivo: main.c Proyecto: handgod/soma
int main(int argc, char *argv[])
{
    printf("test_init...\n");
    test_init();

    printf("test_bits...\n");
    test_bits();

    printf("test_clear...\n");
    test_clear();

    printf("test_modify...\n");
    test_modify();

    printf("test_xor...\n");
    test_xor();

    printf("done.\n");
    return 0;
}
Ejemplo n.º 8
0
int main()
{
	union mips_instruction inst;
	struct virtual_mem_region* memory = NULL;
	struct context ctx;

	// I-type
	test_addi(inst, memory, ctx);
	test_addiu(inst, memory, ctx);
	test_andi(inst, memory, ctx);
	test_ori(inst, memory, ctx);
	test_xori(inst, memory, ctx);
	test_lui(inst, memory, ctx);
	test_slti(inst, memory, ctx);
	test_sltiu(inst, memory, ctx);
	test_sw(inst, memory, ctx);
	test_lw(inst, memory, ctx);
	test_sb(inst, memory, ctx);
	test_lb(inst, memory, ctx);
	test_beq(inst, memory, ctx);
	test_bne(inst, memory, ctx);
	test_bgez(inst, memory, ctx);
	test_bgtz(inst, memory, ctx);
	test_blez(inst, memory, ctx);
	test_bltz(inst, memory, ctx);

	// R-type
	test_add(inst, memory, ctx);
	test_addu(inst, memory, ctx);
	test_sub(inst, memory, ctx);
	test_subu(inst, memory, ctx);
	test_and(inst, memory, ctx);
	test_or(inst, memory, ctx);
	test_xor(inst, memory, ctx);
	test_slt(inst, memory, ctx);
	test_sltu(inst, memory, ctx);

	printf("\nAll tests completed successfully!\n");
	return 0;
}
Ejemplo n.º 9
-1
/*
 * Test all combinations of x and y
 */
static void multi_test(bit_t x, bit_t y) {
  test_or(x, y);
  test_or(bit_not(x), y);
  test_or(x, bit_not(y));
  test_or(bit_not(x), bit_not(y));

  test_or(y, x);
  test_or(y, bit_not(x));
  test_or(bit_not(y), x);
  test_or(bit_not(y), bit_not(x));

  test_xor(x, y);
  test_xor(bit_not(x), y);
  test_xor(x, bit_not(y));
  test_xor(bit_not(x), bit_not(y));

  test_xor(y, x);
  test_xor(bit_not(y), x);
  test_xor(y, bit_not(x));
  test_xor(bit_not(y), bit_not(x));
}