⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 integer.cpp

📁 浙江大学的悟空嵌入式系统模拟器
💻 CPP
字号:
#include "Integer.h"
#include "Global.h"
#include "Utils.h"

CPPUNIT_TEST_SUITE_REGISTRATION (Integer_Test);

void Integer_Test::setUp()
{
	INIT_REGS();
}

void Integer_Test::test_addx()
{
	LOAD_EXE("addx.ppc");

	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();
	
	CHECK_REGS(0x0, 0x41d2, 0x453a, 0x1378,
		0xffffa339,0xfffff5e8, 0x6a9f, 0x5524,
		0xd53e, 0x454a, 0xffff978a, 0xffffaf68,
		0xffff9551, 0x3604, 0x27ae, 0xffffdb6d,
		0x1856, 0xffff917b, 0x934, 0x7c4e,
		0xffffd772, 0xffffa6d3, 0xffffc650, 0xffffb906,
		0xffff9f67, 0x616b, 0x1352, 0xfffff81d,
		0xffffc3fa, 0x2a10, 0xfffff7f3, 0x6093,
		0x80000000, 0x0, 0x0, 0x0);
}

void Integer_Test::test_addcx()
{
	LOAD_EXE("addcx.ppc");

	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0xd7a3, 0x453a, 0x1378,
		0xffff7e52,0xfffff5e8, 0x6a9f, 0xffffa150,
		0xffff95c4, 0x454a, 0xffff978a, 0xffff543c,
		0xffff9551, 0x3604, 0x5da0, 0xffffdb6d,
		0x1856, 0xffff917b, 0xffffceea, 0x7c4e,
		0xbfa, 0xffffa6d3, 0xffff38da, 0xffffb906,
		0xffffa4d4, 0x5b55, 0x6f2d, 0x1171,
		0xffffc3fa, 0xffffaa57, 0xfffff7f3, 0x6093,
		0x40000000, 0x0, 0x0, 0x20000000);
}

void Integer_Test::test_addex()
{
	LOAD_EXE("addex.ppc");

	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0x453a, 0x1378,
		0xffffa339,0xfffff5e8, 0x6a9f, 0x5d90,
		0xffff95c4, 0x454a, 0xffff978a, 0xffffaf68,
		0xffffd773, 0xffffdad8, 0x960, 0xffffb033,
		0x1856, 0xffff917b, 0x4b17, 0x7c4e,
		0xbfa, 0xffffa6d3, 0xffffc650, 0x58b2,
		0xffffa4d4, 0x5b55, 0x1352, 0x1436,
		0xffffc3fa, 0x1d9e, 0x945, 0x6093,
		0x80000000, 0x0, 0x0, 0x0);
}

void Integer_Test::test_addi()
{
	LOAD_EXE("addi.ppc");

	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0x453a, 0x1378,
		0xffffa339,0x1389, 0x1364, 0xffffa150,
		0x4568, 0x3618, 0xffff978a, 0xffffaf68,
		0xffff9551, 0x3604, 0x4d35, 0xffffdb6d,
		0x1856, 0xffff917b, 0xffffceea, 0x7c4e,
		0xbfa, 0xffffc40d, 0x4d3c, 0xffffb906,
		0x18, 0x5b55, 0x1352, 0x1436,
		0xffffc3fa, 0x2a10, 0xffffa33d, 0x6093,
		0x0, 0x0, 0x0, 0x0);
}

void Integer_Test::test_addic()
{
	LOAD_EXE("addic.ppc");
	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0x453a, 0x4151,
		0xffffa339,0x52ad, 0xffffee8a, 0xffffa150,
		0x8663, 0x454a, 0xffffaf19, 0xffffaf68,
		0xffff9551, 0x3604, 0x4d35, 0xffffdb6d,
		0x1856, 0xffff917b, 0x30e8, 0x9118,
		0xffffe159, 0xffffa6d3, 0x1220, 0x80da,
		0xffff87a8, 0x5b55, 0xce1e, 0x99e1,
		0xffffc3fa, 0x2a10, 0xfffff7f3, 0x6093,
		0x0, 0x0, 0x0, 0x20000000);
}

void Integer_Test::test_addic_()
{
	LOAD_EXE("addic_.ppc");
	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0x211b, 0x1378,
		0xffffa339,0xfffff5e8, 0xffff705f, 0xffffa150,
		0xffff93ac, 0x1cfa, 0xffff978a, 0xffffaf68,
		0x732f, 0x3604, 0x5995, 0xffffdb6d,
		0x1856, 0xffffee9e, 0x8a04, 0xffff84d6,
		0xbfa, 0xffffa6d3, 0xffffe4e8, 0xffffb906,
		0xffffa4d4, 0x5b55, 0x1352, 0xa11e,
		0xa10, 0x26f, 0xfffff7f3, 0xffffdefb,
		0x40000000, 0x0, 0x0, 0x0);
}

void Integer_Test::test_addis()
{
	LOAD_EXE("addis.ppc");
	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0xe5396a9f, 0xcfe5ceea, 0xfbf0db6d, 0x1378,
		0xd6984d35,0xfffff5e8, 0x6a9f, 0x4110db6d,
		0xffff95c4, 0x454a, 0xffff978a, 0xffffaf68,
		0xffff9551, 0x3604, 0x4d35, 0x79866093,
		0x1856, 0x6e3d4d35, 0xffffceea, 0x7c4e,
		0xe0eddb6d, 0xffffa6d3, 0xffffc650, 0xffffb906,
		0xffffa4d4, 0x5b55, 0x1352, 0x69dc3604,
		0xffffc3fa, 0xb6043604, 0x72041856, 0xdb163604,
		0x0, 0x0, 0x0, 0x0);
}

void Integer_Test::test_addmex()
{
	LOAD_EXE("addmex.ppc");
	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0xffff917b, 0x41d2, 0x453a, 0x4d35,
		0xffff917b,0x41d2, 0x6a9f, 0xffffa150,
		0x454a, 0x454a, 0xffffa6d3, 0xffffa6d3,
		0xffff9551, 0x3604, 0xffff917b, 0x1436,
		0x454a, 0xffff917b, 0x41d2, 0x7c4e,
		0xfffff7f3, 0x454a, 0xffffdb6d, 0x3604,
		0xffffa4d4, 0x5b55, 0xffff917b, 0x1436,
		0xffffc3fa, 0xffff917b, 0xfffff7f3, 0x6093,
		0x80000000, 0x0, 0x0, 0x20000000);
}

void Integer_Test::test_addzex()
{
	LOAD_EXE("addzex.ppc");
	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0x453a, 0x1856,
		0xffffa339,0x6a9f, 0x6a9f, 0xffff978a,
		0xffff95c4, 0xfffff7f3, 0xffff978a, 0xffffaf68,
		0xffff9551, 0x1856, 0x4d35, 0x41d2,
		0x1856, 0xffffaf68, 0xffffa339, 0xffffa6d3,
		0x1378, 0xffffa6d3, 0xffffc650, 0x3604,
		0xffff9551, 0x3604, 0x1856, 0x1436,
		0x0, 0x2a10, 0xfffff7f3, 0x6093,
		0x80000000, 0x0, 0x0, 0x0);
}

void Integer_Test::test_subfx()
{
	LOAD_EXE("subfx.ppc");

	( (Core::CPU_32Bit  *)Core::Wukong_Get_System().get_cpu() )->run();

	CHECK_REGS(0x0, 0x41d2, 0xffff2ab2, 0x1378,
		0xffffa339,0xfffff5e8, 0x6a9f, 0xffffa150,
		0xffff95c4, 0x454a, 0xffff978a, 0xffffaf68,
		0xffff9551, 0x3604, 0x4d35, 0xffffdb6d,
		0x1856, 0xffff917b, 0xffffceea, 0x7c4e,
		0xbfa, 0xffffa6d3, 0xffffc650, 0xffffb906,
		0xffffa4d4, 0x5b55, 0x1352, 0x1436,
		0xffffc3fa, 0x2a10, 0xfffff7f3, 0x6093,
		0x0, 0x0, 0x0, 0x0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -