示例#1
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;
}
示例#2
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;
}