Fix simulator 2 a little more, but still not entirely functional.

This commit is contained in:
Charles Descamps 2024-03-10 19:39:57 -07:00
parent a4f9cd88fa
commit 60cc817296
3 changed files with 4 additions and 2 deletions

BIN
ProgramGenerator_Project/proggen Normal file → Executable file

Binary file not shown.

Binary file not shown.

View file

@ -134,7 +134,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
// set the working pointer to the first part of the metadata pointer // set the working pointer to the first part of the metadata pointer
wkgMetaPtr = metadataPtr; wkgMetaPtr = metadataPtr;
wkgInsPtr = metadataPtr; wkgInsPtr = metadataPtr;
currentPCB.nextOpCode = wkgMetaPtr; // currentPCB.nextOpCode = wkgMetaPtr;
// set another working pointer to the first part of the PCB list // set another working pointer to the first part of the PCB list
wkgPCBPtr = headPointer->headPtr; wkgPCBPtr = headPointer->headPtr;
@ -149,6 +149,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
// loop through the process list, until you hit a sys end. // loop through the process list, until you hit a sys end.
while(wkgMetaPtr != NULL && !(compareString(argument, "end") == EQUIV && compareString(command, "sys") == EQUIV)) while(wkgMetaPtr != NULL && !(compareString(argument, "end") == EQUIV && compareString(command, "sys") == EQUIV))
{ {
currentPCB.nextOpCode = wkgInsPtr->nextNode;
integerArgumentOne = wkgMetaPtr->intArg2; integerArgumentOne = wkgMetaPtr->intArg2;
printf("%s command, %s argument, %d\n", command, argument, integerArgumentOne); printf("%s command, %s argument, %d\n", command, argument, integerArgumentOne);
// if app start, // if app start,
@ -161,7 +162,6 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
currentPCB.process_state = PROCESS_STATE_NEW; currentPCB.process_state = PROCESS_STATE_NEW;
// set the nextOpCode as a pointer to the first place metadataPtr started // set the nextOpCode as a pointer to the first place metadataPtr started
// currentPCB.nextOpCode = wkgMetaPtr->nextNode; // broken? // currentPCB.nextOpCode = wkgMetaPtr->nextNode; // broken?
currentPCB.nextOpCode = wkgInsPtr->nextNode;
} }
// count number of io cycles // count number of io cycles
if(compareString(command, "dev") == EQUIV) if(compareString(command, "dev") == EQUIV)
@ -375,11 +375,13 @@ void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr)
if (compareString(command, "cpu") == EQUIV && compareString(argument, "process") == EQUIV) if (compareString(command, "cpu") == EQUIV && compareString(argument, "process") == EQUIV)
{ {
// //
// printf("CPU RUNS\n");
runCPU(workingMeta->command, workingMeta->strArg1, workingMeta->intArg2, configPtr, singlePCB->uniquePid); runCPU(workingMeta->command, workingMeta->strArg1, workingMeta->intArg2, configPtr, singlePCB->uniquePid);
} }
if(compareString(command, "dev") == EQUIV) if(compareString(command, "dev") == EQUIV)
{ {
// //
// printf("IO RUNS\n");
runIO(workingMeta->command, workingMeta->strArg1, workingMeta->intArg2, configPtr, singlePCB->uniquePid); runIO(workingMeta->command, workingMeta->strArg1, workingMeta->intArg2, configPtr, singlePCB->uniquePid);
} }
command = workingMeta->command; command = workingMeta->command;