multest.c

来自「sun公司的sparc v8处理器的配置代码。」· C语言 代码 · 共 50 行

C
50
字号
#include "testmod.h"#ifdef LEON2#include "leon2.h"#endifstruct mulcase {	int	fac1;	int	fac2;	int	res;};volatile struct mulcase mula[] = { { 2, 3, 6}, { 2, -3, -6}, { 0,  1, 0},	{ 0, -1, 0}, {  1, -1, -1}, { -1,  1, -1}, { -2,  3, -6},	{ -2, -3, 6}, {  0,  0, 9}};int mulscctmp = 0xfffff000;multest(){#ifdef LEON2	struct l2regs *lr = (struct l2regs *) 0x80000000;#endif	int i = 0;	report_subtest(MUL_TEST+(get_pid()<<4));	if (mulscc_test() != 0x123) fail(1);	/* skip test if multiplier disabled */#ifdef LEON2	if (!((lr->leonconf >> MUL_CONF_BIT) & 1)) return(0);#else	if (!((get_asr17() >> 8) & 1)) return(0);	#endif		while (mula[i].res != 9) {	    if ((mula[i].fac1 * mula[i].fac2) - mula[i].res) fail(2);	    i++;	}	if (!mulpipe()) fail(3);#ifdef LEON2	if (!((lr->leonconf >> MAC_CONF_BIT) & 1)) return(0);	#else	if (!((get_asr17() >> 9) & 1)) return(0);	#endif	if (!macpipe()) fail(4);	return(0);}int ddd[8] = {0,0,0,0,0,0,0,0};

⌨️ 快捷键说明

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