示例#1
0
文件: Device.c 项目: MoochMcGee/cen64
/* ============================================================================
 *  CycleDevice: Advances the state of the device by one MasterClock cycle.
 * ========================================================================= */
void
CycleDevice(struct CEN64Device *device) {
  CycleAIF(device->aif);
  CycleVIF(device->vif);
  CycleRSP(device->rsp);

  CycleVR4300(device->vr4300);

  CycleAIF(device->aif);
  CycleVIF(device->vif);
  CycleRSP(device->rsp);

  CycleVR4300(device->vr4300);
  CycleVR4300(device->vr4300);
}
示例#2
0
文件: TestRSP.c 项目: cmexp/cen64-rsp
/* Entry point. */
int main(int argc, const char *argv[]) {
	FILE *rspUCodeFile;
	struct RSP *rsp;
	size_t total, size;
	long i, cycles;

	if (argc != 3) {
		printf("Usage: %s <uCode> <Cycles>\n", argv[0]);
		return 0;
	}

	/* Open the uCode file, create an RSP instance. */
	if ((rspUCodeFile = fopen(argv[1], "rb")) == NULL) {
		printf("Failed to open RSP uCode.\n");

		return 1;
	}

	if ((rsp = CreateRSP()) == NULL) {
		printf("Failed to initialize the RSP.\n");

		fclose(rspUCodeFile);
		return 2;
	}

	/* Read the uCode into the RSP. */
	for (size = 0, total = 0; total < 4096; total += size) {
		size = fread(rsp->imem + total, 1, 4096 - total, rspUCodeFile);

		if (ferror(rspUCodeFile)) {
			printf("Unable to read the uCode file.\n");

			fclose(rspUCodeFile);
			DestroyRSP(rsp);
			return 3;
		}
	}

	/* Read the uCode into the RSP. */
	for (size = 0, total = 0; total < 4096; total += size) {
		size = fread(rsp->dmem + total, 1, 4096 - total, rspUCodeFile);

		if (ferror(rspUCodeFile)) {
			printf("Unable to read the uCode file.\n");

			fclose(rspUCodeFile);
			DestroyRSP(rsp);
			return 3;
		}
	}

	fclose(rspUCodeFile);
	cycles = strtol(argv[2], NULL, 10);

	printf("Running RSP for %ld cycles.\n", cycles);
  rsp->cp0.regs[SP_STATUS_REG] = 0; /* Unhalt. */

	for (i = 0; i < cycles; i++)
		CycleRSP(rsp);

	RSPDumpRegisters(rsp);
	return 0;
}