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

📄 din.c

📁 RISC处理器仿真分析程序。可以用于研究通用RISC处理器的指令和架构设计。在linux下编译
💻 C
字号:
/************************************************************************* Copyright (C) 1989, 1990, 1991, 1992, 1993                    	**                   Rabin A. Sugumar and Santosh G. Abraham		**									** This software is distributed absolutely without warranty. You are	** free to use and modify the software as you wish.  You are also free	** to distribute the software as long as it is not for commercial gain,	** you retain the above copyright notice, and you make clear what your	** modifications were.							**									** Send comments and bug reports to rabin@eecs.umich.edu			**									*************************************************************************//* Preprocessor to convert traces in DIN format to format accepted      * * by simulator.  (Not very efficient)                                  */#include <stdio.h>extern int trace_type;extern FILE *in;din (ret_buffer)unsigned **ret_buffer;{  int l, indx, type;   unsigned addr;   char s[256], *status;   static unsigned buffer [1000];   indx = 0;   *ret_buffer = buffer;   for (l=0; l<1000; l++) {     if (status = fgets (s, 256, in)) {       sscanf (s, "%d%x", &type, &addr);       switch (type) {       case 0:	 if (trace_type & 0x2) {	   buffer[indx] = addr;	   indx++;	 }	 break;       case 1:	 if (trace_type & 0x4) {	   buffer[indx] = addr;	   indx++;	 }	 break;       case 2:	 if (trace_type & 0x1) {	   buffer[indx] = addr;	   indx++;	 }	 break;       case 3:       case 4:	 break;       default:	 fprintf (stderr, "Unknown access type %d\n", type);       }     }     else {       break;     }   }   return (indx); }

⌨️ 快捷键说明

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