Exemplo n.º 1
0
int main(int argc, char *argv[])
{
	char* filename;
	s32 ret;
	mipsCpu* cpu;
	
	printf("greenLeaf 0.1\n");
	printf("mips emulator by The Lemon Man and SquidMan\n");

	if(argc < 2) {	/* No arguments passed. */
		filename = calloc(5, 1);
		sprintf(filename, "test/mmon");
	}else{
		filename = calloc(strlen(argv[1]) + 1, 1);
		sprintf(filename, argv[1]);
	}

#ifdef DEBUG
	printf("Debug mode enabled\n");
#endif
	printf("Initializing the CPU core...\n");
	cpu = initializeCPU(ENDIANNESS_LE, 0x80000000);
	
	printf("Mapping the ram...\n");
	
	printf("Main memory %d\n",	mapMemory(cpu, 0x80000000, 0x40000, FLAG_RAM));
	printf("Reset vector %d\n",	mapMemory(cpu, 0xBFC00000, 0x40000, FLAG_RAM));
	printf("Additional mem %d\n",	mapMemory(cpu, 0xA0000010, 0x2000, FLAG_RAM));
	
//	ret = openRaw(cpu, filename, 0xBFC00000);
	ret = openElf32(cpu, filename);

	printf("Entry %#x\n",	(u32)ret);
	
	printf("Uart %i\n",	setupUart(cpu, 0xB40003f8));
	
	setPC(cpu, ret);
	
	printf("Press enter to run a tick and print the registers...\n");
	printf("Press enter to continue.\n");
	for(;;) {
#ifdef TICK_AT_A_TIME
		fgetc(stdin);
#endif
		runProcessor(cpu, 1);		/* Run a single cycle at a time */
		//~ printRegisters(cpu);
	}
	
	printf("Execution finished... unmapping the ram\n");
	
	unmapMemory(cpu);
	
	free(filename);
	
	return 1;
}
Exemplo n.º 2
0
Cpu::Cpu(const int& readEndOfPipe, const int& writeEndOfPipe, const int interruptInterval)
        : READ_END_OF_PIPE(readEndOfPipe), WRITE_END_OF_PIPE(writeEndOfPipe) {
    _interruptInterval = interruptInterval;
    _ir = _pc = _ac = _x = _y = 0;
    _sp = USER_STACK_START_ADDRESS;
    _inSystemMode = false;
    _interruptEnabled = true;

    waitForMemReadySignal();
    runProcessor();
    sendEndCommandToMemory();
}
Exemplo n.º 3
0
processMultireads::processMultireads(QWidget *parent) :
    QWidget(parent),
    progressView(new analysisProgressView(this)),
    multireadsView(new processMultireadsView(this))
{
    // set a window title
    setWindowTitle(tr("Rcount-multireads"));

    // initialize all the other widgets
    // get and set the minimal sizes
    int minWidth = multireadsView->sizeHint().width();
    int minHeight = multireadsView->sizeHint().height()+progressView->sizeHint().height()*1.5;
    this->setMinimumHeight(minHeight);
    this->setMinimumWidth(minWidth);

    // layout
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(multireadsView);
    layout->addWidget(progressView);
    setLayout(layout);

    // hide the progressView
    //! progressView->hide();

    // connections
    connect(&processor, SIGNAL(processStatus(QString)), progressView, SLOT(updateStatus(QString)));
    connect(&processor, SIGNAL(processProgress(int)), progressView, SLOT(updateProgress(int)));
    connect(&processor, SIGNAL(errorMessage(QString)), progressView, SLOT(updateStatus(QString)));
    //! connect(&processor, SIGNAL(idleAgain()), this, SLOT(hideProgress()));
    connect(&processor, SIGNAL(workFinished(QString)), multireadsView, SLOT(removeFromQueue(QString)));
    connect(progressView, SIGNAL(analysisCanceled()), &processor, SLOT(cancelProcessing()));
    connect(multireadsView, SIGNAL(closeAll()), &processor, SLOT(cancelProcessing()));
    connect(multireadsView, SIGNAL(closeAll()), this, SLOT(close()));
    connect(multireadsView, SIGNAL(processReads(QString)), this, SLOT(runProcessor(QString)));

}