亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cpu.c

?? 一個MIPS虛擬機的源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
	boolean cache_able;
	UINT32 reg_data,mem_data;
	UINT8 word_offset;

	

	offset = get_offset(instruction);
	base_addr = cpu_register[get_rb(instruction)];
	vaddr = base_addr +  offset;
	reg_data = cpu_register[get_rt(instruction)];
	if ((options.debug_mode==true) && (debug.current_mode==STEP))
		printf("%s %s,0x%x(%s)","swl",reg_table[get_rt(instruction)],offset, reg_table[get_rb(instruction)]);
	if ((vaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	phyaddr = vaddr2phyaddr(vaddr,DATA_STORE,&cache_able);
	if ((vaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	if (0xffffffff== phyaddr  ){
			//an exception has occured
	}
	else	{
		if (load_word(vaddr,phyaddr,cache_able,DATA_STORE,&mem_data))
			{
			word_offset = vaddr & 0x00000003;
			store_word(vaddr,phyaddr,  cache_able, DATA_STORE,swl(reg_data, mem_data, word_offset));
			
		}
			
		
	}
	

	
}

/*opcode = 43   sw t,0(b)*/
static void sw_simulate(const UINT32 instruction)
{
	UINT32 base_addr,vaddr,phyaddr;
	INT32 offset;
	boolean cache_able;
	UINT32 reg_data;
	
	
	offset = get_offset(instruction);
	base_addr = cpu_register[get_rb(instruction)];
	vaddr = base_addr +  offset;
	reg_data = cpu_register[get_rt(instruction)];
	if ((options.debug_mode==true) && (debug.current_mode==STEP))
		printf("%s %s,0x%x(%s)","sw",reg_table[get_rt(instruction)],offset, reg_table[get_rb(instruction)]);
	if ((vaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	//
	//
	//printf("vaddr %x\n",vaddr);
	phyaddr = vaddr2phyaddr(vaddr,DATA_STORE,&cache_able);
	//printf("phyaddr %x\n",phyaddr);
	if ((vaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	//printf("phyaddr  %x",phyaddr);
	if (0xffffffff== phyaddr  ){
			//an exception has occured
	}
	else	{
		
		store_word(vaddr,phyaddr,  cache_able, DATA_STORE,reg_data);
			
	}

	

}


/*opcode = 44   sdl t,0(b)   MIPSIII*/
/*opcode = 45   sdr t,0(b)   MIPSIII*/

/*opcode = 46   swr  t,0(b)*/
static void swr_simulate(const UINT32 instruction)
{
	UINT32 base_addr,vaddr,phyaddr;
	INT32 offset;
	boolean cache_able;
	UINT32 reg_data,mem_data;
	UINT8 word_offset;


	offset = get_offset(instruction);
	base_addr = cpu_register[get_rb(instruction)];
	vaddr = base_addr +  offset;
	reg_data = cpu_register[get_rt(instruction)];
	if ((options.debug_mode==true) && (debug.current_mode==STEP))
		printf("%s %s,0x%x(%s)","swr",reg_table[get_rt(instruction)],offset, reg_table[get_rb(instruction)]);

	if ((vaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	phyaddr = vaddr2phyaddr(vaddr,DATA_STORE,&cache_able);
	if ((phyaddr % 4)!=0)
		{
			//fprintf(stderr,"vaddr % 4- !=0---------------------------------!\n");
			//bad address exctiption
			//if ((operation_mode==DATA_LOAD)||(operation_mode==INSTRUCTION_LOAD))
			//	exception(ADEL,-1);
			//else
				exception(ADES,-1);
			return ;
		}
	if (0xffffffff== phyaddr  ){
			//an exception has occured
	}
	else	{
		if (load_word(vaddr,phyaddr,cache_able,DATA_STORE,&mem_data)){
			word_offset = vaddr & 0x00000003;
			store_word(vaddr,phyaddr,  cache_able, DATA_STORE,swr(reg_data, mem_data, word_offset));
			
		}
			
		
	}
	

	
}

static void fp_instruction()
{
	// CU1 CpU instruction . 
	exception(CPU,1);
}
static void cu2_instruction()
{
	// CU2 CpU instruction . 
	exception(CPU,2);
}
static void ri_instruction()
{
	exception(RI,-1);
}



/*all instructions' simualtion---------------------------------  end */
static void opcode0_instruction(const UINT32 instruction)
{
	UINT16 sub_opcode;
	sub_opcode = get_sub_opcode(instruction);
	//printf("sub_opcode %x\n",sub_opcode);
	//printf("sub_opcode %d\n",sub_opcode);
	switch (sub_opcode)
		{
			case 0:
				sll_simulate(instruction);
				break;
			/*1  mips iv*/
			case 2:
				srl_simulate(instruction);
				break;
			case 3:
				sra_simulate(instruction);
				break;
			case 4:
				sllv_simulate(instruction);
				break;
			/*5   mini risc-4010*/
			case 6:
				srlv_simulate(instruction);
				break;
			case 7:
				srav_simulate(instruction);
				break;
			case 8:
				jr_simulate(instruction);
				break;
			case 9:
				jalr_simulate(instruction);
				break;
			/*10 11  MIPS IV*/
			case 12:
				syscall_simulate(instruction);
				break;
			case 13:
				break_simulate(instruction);
				break;
			/*14  MIPS II*/
			/*15 sync */
			case 16:
				mfhi_simulate(instruction);
				break;
			case 17:
				mthi_simulate(instruction);
				break;
			case 18:
				mflo_simulate(instruction);
				break;
			case 19:
				mtlo_simulate(instruction);
				break;
			/* 20 21 22 23 MIPS III*/
			case 24:
				mult_simulate(instruction);
				break;
			case 25:
				multu_simulate(instruction);
				break;
			case 26:
				div_simulate(instruction);
				break;
			case 27:
				divu_simulate(instruction);
				break;
			/*28 29 30 31  MIPS III*/
			case 32:
				add_simulate(instruction);
				break;
			case 33:
				addu_simulate(instruction);
				//printf("return from addu_simulate");
				break;
			case 34:
				sub_simulate(instruction);
				break;
			case 35:
				subu_simulate(instruction);
				break;
			case 36:
				and_simulate(instruction);
				break;
			case 37:
				or_simulate(instruction);
				break;
			case 38:
				xor_simulate(instruction);
				break;
			case 39:
				nor_simulate(instruction);
				break;
			/*40 41 VR4100*/
			case 42:
				slt_simulate(instruction);
				break;
			case 43:
				sltu_simulate(instruction);
				break;
			/*44-63   MIPS III*/
			default:
				ri_instruction();
				break;
			
			
		}
	//printf("return from 0\n");
}

static void opcode1_instruction(const UINT32 instruction)
{
	UINT16 rt_code;
	rt_code = get_rt(instruction);
	//printf("rt_code  %d",rt_code);
	switch(rt_code)
		{
			case 0:
				bltz_simulate(instruction);
				break;
			case 1:
				bgez_simulate(instruction);
				break;
			/*2-15   MIPS II*/
			case 16:
				bltzal_simulate(instruction);
				break;
			case 17:
				bgezal_simulate(instruction);
				break;
			/*18 19 MIPS II*/
			default:
				ri_instruction();
				break;
				
		}
}
static void opcode16_rscode16_instruction(const UINT32 instruction)
{
	UINT16 sub_opcode;
	sub_opcode = get_sub_opcode(instruction);
	switch (sub_opcode)
		{
			case 1:
				tlbr_simulate(instruction);
				break;
			case 2:
				tlbwi_simulate(instruction);
				break;
			case 6:
				tlbwr_simulate(instruction);
				break;
			case 8:
				tlbp_simulate(instruction);
				break;
			case 16:
				rfe_simulate(instruction);
				break;
			default:
				ri_instruction();
				break;
				
			
		}
}
static void opcode16_instruction(const UINT32 instruction)
{
	UINT16 rs_code;
	rs_code = get_rs(instruction);
	switch (rs_code)
		{
			case 0: 
				mfc0_simulate( instruction);
				break;
			/*1  MIPS III*/
			/* 2 cfc0  not implemented*/
			/*3 not defined*/
			case 4:
				mtc0_simulate(instruction);
				break;
			/*5 MIPSIII*/
			/*6 ctc0 not implemented*/
			case 16:
				opcode16_rscode16_instruction(instruction);
				break;
			default:
				ri_instruction();
				break;
				
		}
	
}
static void opcode17_instruction(const UINT32 instruction)
{
	 fp_instruction();
}
static void opcode18_instruction(const UINT32 instruction)
{
	cu2_instruction();
}
static void opcode19_instruction(const UINT32 instruction)
{
	 fp_instruction();
}


static boolean cpu_step(UINT32 phyaddr,boolean cache_able)
{
	UINT32 instruction;
	UINT16 op_code;
	int adsf;
	
	exception_padding==false;
	if (!cpu_fetch_instruction(&instruction,phyaddr,cache_able))
		{
			//an exception occured.
			fprintf(stderr,"Error cpu_fetch_instruction(),aborting\n ");
		}
	
	//printf("instruction %x\n",instruction);
	op_code = get_op_code(instruction);
	//printf("op_code %x\n",op_code);
	if ((options.debug_mode==true) && (debug.current_mode==STEP))
		printf("PC = 0x%x   [",PC);
	switch (op_code)
		{
			case 0:
				opcode0_instruction(instruction);
				break;
			case 1:
				opcode1_instruction( instruction);
				break;
			case 2:
				j_simulate(instruction);
				break;
			case 3:
				jal_simulate(instruction);
				break;
			case 4:
				beq_simulate(instruction);
				break;
			case 5:
				bne_simulate(instruction);
				break;
			case 6:
				blez_simulate(instruction);
				break;
			case 7:
				bgtz_simulate(instruction);
				break;
			case 8:
				addi_simulate(instruction);
				break;
			case 9:
				addiu_simulate(instruction);
				break;
			case 10:
				slti_simulate(instruction);
				break;
			case 11:
				sltiu_simulate(instruction);
				break;	
			case 12:
				andi_simulate(instruction);
				break;	
			case 13:
				ori_simulate(instruction);
				break;	
			case 14:
				xori_simulate( instruction);
				break;	
			case 15:
				lui_simulate(instruction);
				break;
			case 16:
				opcode16_instruction(instruction);
				break;
			case 17:
				opcode17_instruction(instruction);
				break;
			case 18:
				opcode18_instructio

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区乱码在线| 婷婷开心激情综合| 亚洲人成7777| 日本美女视频一区二区| 99久久精品国产网站| 欧美一卡在线观看| 亚洲欧美视频在线观看| 久久www免费人成看片高清| 色综合久久久久综合体桃花网| 欧美精品一二三区| 中文字幕一区二区三区四区 | 日本欧洲一区二区| 成人小视频免费在线观看| 欧美日产在线观看| 国产精品久久久久久久久搜平片 | 欧美日韩成人综合| 中文字幕五月欧美| 国产毛片一区二区| 日韩一区二区三区电影在线观看| 亚洲视频1区2区| 国产精华液一区二区三区| 91精品国产综合久久蜜臀| 一区二区三区小说| 成人免费av在线| 久久久久久久久久久久久女国产乱| 亚洲香肠在线观看| 91亚洲国产成人精品一区二三 | 久久超碰97中文字幕| 欧美日韩1234| 亚洲妇女屁股眼交7| 在线中文字幕一区二区| 中文在线一区二区| 成人精品视频一区二区三区| 国产欧美日韩综合精品一区二区| 久久不见久久见中文字幕免费| 日韩精品专区在线影院观看| 天天色天天操综合| 91精品欧美久久久久久动漫 | 亚洲女同一区二区| 91女神在线视频| 亚洲免费看黄网站| 色婷婷久久综合| 一区二区在线观看免费| 欧洲一区在线电影| 日韩精品高清不卡| 日韩欧美一区二区视频| 久久99精品久久久久久国产越南| 精品美女在线观看| 国产乱一区二区| 中文字幕第一区二区| av午夜一区麻豆| 亚洲欧美激情视频在线观看一区二区三区| 91在线视频免费观看| 亚洲精品综合在线| 欧美日韩国产综合视频在线观看 | 美女www一区二区| 精品免费日韩av| 成人高清在线视频| 亚洲乱码一区二区三区在线观看| 欧美午夜免费电影| 麻豆91精品91久久久的内涵| 国产午夜亚洲精品不卡| 色综合av在线| 七七婷婷婷婷精品国产| 欧美激情一区二区三区蜜桃视频| 色诱亚洲精品久久久久久| 亚瑟在线精品视频| 久久久久久亚洲综合影院红桃| 99视频在线观看一区三区| 亚洲国产中文字幕| 久久久久久一二三区| 欧美在线色视频| 国内一区二区在线| 亚洲三级电影全部在线观看高清| 欧美日本在线播放| 高清视频一区二区| 天堂久久一区二区三区| 国产欧美在线观看一区| 欧美日韩国产色站一区二区三区| 国内外成人在线视频| 一区二区三区在线不卡| 久久综合丝袜日本网| 欧洲av一区二区嗯嗯嗯啊| 国产一区二区美女| 午夜日韩在线观看| 亚洲人吸女人奶水| 久久蜜桃一区二区| 欧美日韩1区2区| 色综合久久88色综合天天| 国产美女一区二区| 天天亚洲美女在线视频| 最新不卡av在线| 精品国产露脸精彩对白| 欧美久久久一区| 91在线国产福利| 国产99久久精品| 裸体一区二区三区| 亚洲成人一二三| 亚洲永久精品国产| 国产精品久久久久一区二区三区| 精品久久久久久久久久久久包黑料 | 韩国女主播成人在线| 五月婷婷久久综合| 一区二区免费视频| 亚洲人快播电影网| 国产精品乱码人人做人人爱| 国产亚洲成aⅴ人片在线观看 | 欧美大片一区二区| 欧美精品在线一区二区三区| 在线观看免费亚洲| 色偷偷成人一区二区三区91| 北岛玲一区二区三区四区| 国产乱淫av一区二区三区| 国产一区高清在线| 国产专区综合网| 精品一区二区在线播放| 美女免费视频一区| 精品综合久久久久久8888| 六月丁香婷婷久久| 韩国成人在线视频| 国产91在线|亚洲| 成人一级片网址| 成人动漫中文字幕| 99在线精品观看| 91精品福利视频| 一本一道综合狠狠老| 色哟哟国产精品| 一本色道**综合亚洲精品蜜桃冫| 91久久国产最好的精华液| 91福利在线导航| 欧美日本一区二区| 精品精品国产高清a毛片牛牛| 日韩精品一区二区三区蜜臀| 精品美女一区二区| 中文字幕av一区 二区| 亚洲人成网站色在线观看| 亚洲国产精品综合小说图片区| 午夜av一区二区三区| 蜜臀a∨国产成人精品| 国产一区二区三区精品视频| 不卡大黄网站免费看| 欧美色爱综合网| 欧美va亚洲va国产综合| 日本一区二区免费在线观看视频| 亚洲青青青在线视频| 日韩国产精品91| 国产精品一区二区三区网站| eeuss影院一区二区三区| 色老综合老女人久久久| 5858s免费视频成人| 国产色一区二区| 亚洲精品中文在线观看| 美女视频免费一区| 97超碰欧美中文字幕| 91精品国产手机| 国产欧美精品一区二区三区四区| 亚洲精品一卡二卡| 激情文学综合丁香| 一本大道久久a久久精二百| 日韩精品一区二区三区中文精品| 中文字幕 久热精品 视频在线| 亚洲一区二区在线观看视频| 狠狠色综合播放一区二区| 91免费视频网址| 欧美成人性战久久| 一区二区三区四区蜜桃| 国产一区 二区 三区一级| 91国产视频在线观看| 精品av久久707| 一区二区三区在线观看视频 | 91在线观看美女| 日韩欧美一卡二卡| 亚洲自拍偷拍av| 成人中文字幕电影| 日韩精品一区在线| 亚洲成人av一区二区| jlzzjlzz亚洲日本少妇| 欧美精品一区二区在线播放| 一区二区三区电影在线播| 国产精品一区二区黑丝| 欧美日韩aaa| 一区二区三区久久| 94-欧美-setu| 国产精品美女久久久久久2018| 奇米精品一区二区三区在线观看| 91久久人澡人人添人人爽欧美| 久久久99精品久久| 蜜臂av日日欢夜夜爽一区| 欧美视频三区在线播放| 中文字幕日韩av资源站| 国产精品一区二区三区四区| 精品伦理精品一区| 麻豆精品在线观看| 5858s免费视频成人| 婷婷久久综合九色综合伊人色| 欧洲精品在线观看| 一区二区三区成人在线视频| 在线视频国内一区二区| 亚洲男人的天堂网| proumb性欧美在线观看|