From 96ce7c9f8006ccc146e9790e71436315930b939f Mon Sep 17 00:00:00 2001 From: endes Date: Fri, 8 Mar 2024 16:41:09 +0000 Subject: [PATCH] misspells and names fixes, style and minor fixes --- public/locales/en/common.json | 4 +- public/locales/es/common.json | 2 +- src/core/Common/FunctionalUnit.ts | 12 +- src/core/Common/Instruction.ts | 6 +- src/core/Superescalar/PrefetchUnit.ts | 6 +- src/core/Superescalar/ReorderBuffer.ts | 67 +++++------ src/core/Superescalar/ReserveStation.ts | 80 ++++++------- src/core/Superescalar/Superescalar.ts | 94 +++++++-------- src/integration/superescalar-integration.ts | 32 ++--- src/integration/vliw-integration.ts | 8 +- .../actions/functional-unit-actions.ts | 4 +- .../actions/reorder-buffer-actions.ts | 4 +- .../actions/reserve-station-actions.ts | 6 +- src/interface/actions/stats-actions.ts | 74 ++++++------ .../Superescalar/FunctionalUnitComponent.tsx | 2 +- .../Superescalar/PrefetchDecoderComponent.tsx | 2 +- .../Superescalar/ReorderBufferComponent.tsx | 12 +- .../Superescalar/ReserveStationComponent.tsx | 2 +- .../Superescalar/navbar/FileBarComponent.tsx | 4 + .../Superescalar/tab/StatsTabComponent.tsx | 10 +- .../VLIW/navbar/VLIWFileBarComponent.tsx | 4 + .../components/VLIW/tab/StatsTabComponent.tsx | 10 +- src/interface/reducers/color.ts | 6 +- src/interface/reducers/machine.ts | 4 +- src/stats/aggregator.ts | 8 +- src/stats/stats.ts | 110 +++++++++--------- 26 files changed, 289 insertions(+), 284 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 12dae571..e3cd4225 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -6,7 +6,7 @@ "downloadMemory": "Download Memory(JSON)", "downloadContent": "Download content Memory - Registers", "downloadCode": "Download Code", - "downloadStats": "Descargar stats events(JSON)" + "downloadStats": "Download stats events(JSON)" }, "view": { "name": "View", @@ -228,7 +228,7 @@ "writeBackNumber": "On Write Back", "commitNumber": "Commiting" }, - "unitsOcupation": "Units ocupation per cycle", + "unitsUsage": "Units usage per cycle", "instrStatuses": "Instructions statuses per cycle", "cycles": "Cycles per iteration", "commitDiscard": "Commited vs Discarded instructions", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 1cd1507b..900c756e 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -226,7 +226,7 @@ "writeBackNumber": "En escritura", "commitNumber": "En commit" }, - "unitsOcupation": "OcupaciĆ³n de cada unidad por ciclo", + "unitsUsage": "OcupaciĆ³n de cada unidad por ciclo", "instrStatuses": "Instrucciones en cada etapa por ciclo", "cycles": "Ciclos por replica", "commitDiscard": "Instrucciones commiteadas VS descartadas", diff --git a/src/core/Common/FunctionalUnit.ts b/src/core/Common/FunctionalUnit.ts index 35b61d60..91494441 100644 --- a/src/core/Common/FunctionalUnit.ts +++ b/src/core/Common/FunctionalUnit.ts @@ -25,7 +25,7 @@ export const FUNCTIONALUNITTYPESQUANTITY = export interface FunctionalUntitVisualEntry { id: number; value: string; - uuid: number; + uid: number; } const FunctionalUnitLantencies: Record = { @@ -74,7 +74,7 @@ export class FunctionalUnit { return this._latency; } - public get ocupation(): number { + public get usage(): number { return this._instructions.length / this._latency; } @@ -133,10 +133,10 @@ export class FunctionalUnit { return this._stalled > 0; } - public getReadyInstructionUuid(): number { + public getReadyInstructionUid(): number { return this._instructions.length > 0 && this._instructions[0].blankTimeUnitsAhead == 0 - ? this._instructions[0].instruction.uuid + ? this._instructions[0].instruction.uid : -1; } @@ -245,12 +245,12 @@ export class FunctionalUnit { list.push({ id: this._instructions[j].instruction.id, value: this._instructions[j].instruction.toString(), - uuid: this._instructions[j].instruction.uuid, + uid: this._instructions[j].instruction.uid, }); j++; lastPos = i + 1; } else { - list.push({ id: -1, value: "", uuid: -1 }); + list.push({ id: -1, value: "", uid: -1 }); } } diff --git a/src/core/Common/Instruction.ts b/src/core/Common/Instruction.ts index 0d413cad..db016911 100644 --- a/src/core/Common/Instruction.ts +++ b/src/core/Common/Instruction.ts @@ -11,8 +11,8 @@ export class Instruction { protected _label: string; protected _breakPoint: boolean = false; - public get uuid(): number { - return this._uuid; + public get uid(): number { + return this._uid; } public get breakPoint(): boolean { @@ -35,7 +35,7 @@ export class Instruction { return this._operandsString; } - constructor(from?: Instruction, protected _uuid?: number) { + constructor(from?: Instruction, protected _uid?: number) { if (from) { this.id = from.id; this.basicBlock = from.basicBlock; diff --git a/src/core/Superescalar/PrefetchUnit.ts b/src/core/Superescalar/PrefetchUnit.ts index 4fb969db..606201cb 100644 --- a/src/core/Superescalar/PrefetchUnit.ts +++ b/src/core/Superescalar/PrefetchUnit.ts @@ -3,7 +3,7 @@ import { Instruction } from "../Common/Instruction"; export interface PrefetchUnitVisualEntry { id: number; value: string; - uuid: number; + uid: number; } export class PrefetchUnit { @@ -13,7 +13,7 @@ export class PrefetchUnit { return this._size; } - public get ocupation() { + public get usage() { return this._entries.length / this._size; } @@ -45,7 +45,7 @@ export class PrefetchUnit { public getVisualData(): PrefetchUnitVisualEntry[] { return this._entries.map((inst) => { - return { id: inst.id, value: inst.toString(), uuid: inst.uuid }; + return { id: inst.id, value: inst.toString(), uid: inst.uid }; }); } } diff --git a/src/core/Superescalar/ReorderBuffer.ts b/src/core/Superescalar/ReorderBuffer.ts index dd1cb669..a33cac3b 100644 --- a/src/core/Superescalar/ReorderBuffer.ts +++ b/src/core/Superescalar/ReorderBuffer.ts @@ -4,7 +4,7 @@ import { Instruction } from "../Common/Instruction"; export interface VisualReorderBufferEntry { instruction: { id: string; - uuid: number; + uid: number; value: string; }; destinyRegister: string; @@ -32,7 +32,7 @@ export class ReorderBuffer { return this._size; } - public get ocupation() { + public get usage() { return this._queue.length / this._size; } @@ -82,7 +82,7 @@ export class ReorderBuffer { } /** - * getRegisterMapping - this method returns the rob instr uuid wich will write in that register. + * getRegisterMapping - this method returns the rob instr uid wich will write in that register. */ public getRegisterMapping( register: number, @@ -131,14 +131,11 @@ export class ReorderBuffer { } /** - * commitInstruction - this method commits an instruction from the reorder buffer, returning their uuid + * commitInstruction - this method commits an instruction from the reorder buffer, returning their uid */ public commitInstruction(): number { - let e = this._queue.shift(); - if (e == undefined) { - return -1; - } - return e.instruction.uuid; + const e = this._queue.shift(); + return e ? e.instruction.uid : -1; } /** @@ -149,9 +146,9 @@ export class ReorderBuffer { ? this._FprMapping : this._GprMapping; let register = this._queue[0].destinyRegister; - let uuid = this._queue[0].instruction.uuid; + let uid = this._queue[0].instruction.uid; - if (mapping[register] === uuid) { + if (mapping[register] === uid) { delete mapping[register]; return true; } @@ -174,16 +171,16 @@ export class ReorderBuffer { if (instruction.getDestinyRegister() !== -1) { if (instruction.isDestinyRegisterFloat()) { - this._FprMapping[instruction.getDestinyRegister()] = instruction.uuid; + this._FprMapping[instruction.getDestinyRegister()] = instruction.uid; } else { - this._GprMapping[instruction.getDestinyRegister()] = instruction.uuid; + this._GprMapping[instruction.getDestinyRegister()] = instruction.uid; } } } - public getInstructionPos(uuid: number): number { + public getInstructionPos(uid: number): number { for (let i = 0; i < this._queue.length; i++) { - if (this._queue[i].instruction.uuid === uuid) { + if (this._queue[i].instruction.uid === uid) { return i; } } @@ -193,39 +190,39 @@ export class ReorderBuffer { /** * executeInstruction - this method executes an instruction from the reorder buffer */ - public executeInstruction(uuid: number) { - this._queue[this.getInstructionPos(uuid)].superStage = + public executeInstruction(uid: number) { + this._queue[this.getInstructionPos(uid)].superStage = SuperStage.SUPER_EXECUTE; } /** * writeResultValue - this method writes the result value of an instruction to the reorder buffer */ - public writeResultValue(uuid: number, value: number) { - let pos = this.getInstructionPos(uuid); + public writeResultValue(uid: number, value: number) { + let pos = this.getInstructionPos(uid); this._queue[pos].value = value; this._queue[pos].ready = true; this._queue[pos].superStage = SuperStage.SUPER_WRITERESULT; } - public getInstruction(uuid: number = -1): Instruction { - let pos = uuid === -1 ? 0 : this.getInstructionPos(uuid); + public getInstruction(uid: number = -1): Instruction { + let pos = uid === -1 ? 0 : this.getInstructionPos(uid); return this._queue[pos].instruction; } /** * writeResultAddress - this method writes the result address of an instruction to the reorder buffer */ - public writeResultAddress(uuid: number, address: number) { - let pos = this.getInstructionPos(uuid); + public writeResultAddress(uid: number, address: number) { + let pos = this.getInstructionPos(uid); this._queue[pos].address = address; } /** * hasResultValue - this method checks if an instruction has already the result value */ - public hasResultValue(uuid: number): boolean { - let pos = this.getInstructionPos(uuid); + public hasResultValue(uid: number): boolean { + let pos = this.getInstructionPos(uid); return this._queue[pos].ready; } @@ -239,8 +236,8 @@ export class ReorderBuffer { /** * hasResultAddress - this method checks if an instruction has already the result address */ - public hasResultAddress(uuid: number): boolean { - let pos = this.getInstructionPos(uuid); + public hasResultAddress(uid: number): boolean { + let pos = this.getInstructionPos(uid); return this._queue[pos].address !== -1; } @@ -254,8 +251,8 @@ export class ReorderBuffer { /** * hasPreviousStores - this method checks if there are previous store instructions that write to the same address */ - public hasPreviousStores(uuid: number): boolean { - let pos = this.getInstructionPos(uuid); + public hasPreviousStores(uid: number): boolean { + let pos = this.getInstructionPos(uid); let address = this._queue[pos].address; for (let i = 0; i < pos; i++) { // check if it is a store instruction and if it the address is the same or if it doesn't have a result address yet @@ -273,7 +270,7 @@ export class ReorderBuffer { return this._queue.map((entry) => { if (entry != null) { let aux = { - instruction: { id: "", uuid: -1, value: "" }, + instruction: { id: "", uid: -1, value: "" }, destinyRegister: entry.destinyRegister !== -1 ? "" + entry.destinyRegister : "-", value: "" + entry.value, @@ -289,13 +286,13 @@ export class ReorderBuffer { } } aux.instruction.id = "" + entry.instruction.id; - aux.instruction.uuid = entry.instruction.uuid; + aux.instruction.uid = entry.instruction.uid; aux.instruction.value = entry.instruction.toString(); } return aux; } return { - instruction: { id: "", uuid: -1, value: "" }, + instruction: { id: "", uid: -1, value: "" }, destinyRegister: "", value: "", address: "", @@ -316,10 +313,10 @@ export class ReorderBuffer { return visualMap; } - public getVisualInstructionMap(): { [uuid: number]: number } { - let visualMap: { [uuid: string]: number } = {}; + public getVisualInstructionMap(): { [uid: number]: number } { + let visualMap: { [uid: string]: number } = {}; for (let i = 0; i < this._queue.length; i++) { - visualMap[this._queue[i].instruction.uuid] = i; + visualMap[this._queue[i].instruction.uid] = i; } return visualMap; } diff --git a/src/core/Superescalar/ReserveStation.ts b/src/core/Superescalar/ReserveStation.ts index 1b191dc3..6b9814c3 100644 --- a/src/core/Superescalar/ReserveStation.ts +++ b/src/core/Superescalar/ReserveStation.ts @@ -1,7 +1,7 @@ import { Instruction } from "../Common/Instruction"; export interface VisualReserveStationEntry { - instruction: { id: string; uuid: number; value: string }; + instruction: { id: string; uid: number; value: string }; Qj: string; Vj: string; Qk: string; @@ -28,15 +28,15 @@ export class ReserveStation { return this._size; } - public get ocupation() { + public get usage() { return this._entries.length / this._size; } constructor(private _size: number) {} - private getInstrPos(uuid: number): number { + private getInstrPos(uid: number): number { for (let i = 0; i < this._entries.length; i++) { - if (this._entries[i].instruction.uuid === uuid) { + if (this._entries[i].instruction.uid === uid) { return i; } } @@ -70,16 +70,16 @@ export class ReserveStation { /** * removeInstruction - removes an instruction from the reservation station */ - public removeInstruction(uuid: number) { - let pos = this.getInstrPos(uuid); + public removeInstruction(uid: number) { + let pos = this.getInstrPos(uid); this._entries.splice(pos, 1); } /** * setFirstOperandValue - sets the value of the first operand of the instruction, this will remove the ROB reference to the value (Qj) and idicates that the value is ready */ - public setFirstOperandValue(uuid: number, value: number) { - let pos = this.getInstrPos(uuid); + public setFirstOperandValue(uid: number, value: number) { + let pos = this.getInstrPos(uid); this._entries[pos].Vj = value; this._entries[pos].Qj = -1; } @@ -87,8 +87,8 @@ export class ReserveStation { /** * setSecondOperandValue - sets the value of the second operand of the instruction, this will remove the ROB reference to the value (Qk) and idicates that the value is ready */ - public setSecondOperandValue(uuid: number, value: number) { - let pos = this.getInstrPos(uuid); + public setSecondOperandValue(uid: number, value: number) { + let pos = this.getInstrPos(uid); this._entries[pos].Vk = value; this._entries[pos].Qk = -1; } @@ -96,42 +96,42 @@ export class ReserveStation { /** * getFirstOperandValue - returns the value of the first operand of the instruction */ - public getFirstOperandValue(uuid: number): number { - let pos = this.getInstrPos(uuid); + public getFirstOperandValue(uid: number): number { + let pos = this.getInstrPos(uid); return this._entries[pos].Vj; } /** * getSecondOperandValue - returns the value of the second operand of the instruction */ - public getSecondOperandValue(uuid: number): number { - let pos = this.getInstrPos(uuid); + public getSecondOperandValue(uid: number): number { + let pos = this.getInstrPos(uid); return this._entries[pos].Vk; } /** - * setFirstOperandReference - sets the ROB instruction uuid that will provide the value of the first operand, this will remove the value of the operand (Vj) and indicates that the value is not ready + * setFirstOperandReference - sets the ROB instruction uid that will provide the value of the first operand, this will remove the value of the operand (Vj) and indicates that the value is not ready */ - public setFirstOperandReference(uuid: number, robInstrUuid: number) { - let pos = this.getInstrPos(uuid); - this._entries[pos].Qj = robInstrUuid; + public setFirstOperandReference(uid: number, robInstrUid: number) { + let pos = this.getInstrPos(uid); + this._entries[pos].Qj = robInstrUid; this._entries[pos].Vj = -1; } /** - * setSecondOperandReference - sets the ROB instruction uuid that will provide the value of the second operand, this will remove the value of the operand (Vk) and indicates that the value is not ready + * setSecondOperandReference - sets the ROB instruction uid that will provide the value of the second operand, this will remove the value of the operand (Vk) and indicates that the value is not ready */ - public setSecondOperandReference(uuid: number, robInstrUuid: number) { - let pos = this.getInstrPos(uuid); - this._entries[pos].Qk = robInstrUuid; + public setSecondOperandReference(uid: number, robInstrUid: number) { + let pos = this.getInstrPos(uid); + this._entries[pos].Qk = robInstrUid; this._entries[pos].Vk = -1; } /** * setAddressOperand - sets the address operand of the instruction, this will deasociate it from an Address ALU if it was associated */ - public setAddressOperand(uuid: number, address: number) { - let pos = this.getInstrPos(uuid); + public setAddressOperand(uid: number, address: number) { + let pos = this.getInstrPos(uid); this._entries[pos].A = address; if (this._entries[pos].FUIsAddALU) { @@ -143,22 +143,22 @@ export class ReserveStation { /** * getAddressOperand - returns the address operand of the instruction */ - public getAddressOperand(uuid: number): number { - let pos = this.getInstrPos(uuid); + public getAddressOperand(uid: number): number { + let pos = this.getInstrPos(uid); return this._entries[pos].A; } /** * setROBValue - sets the value of the operands associated to the ROB reference */ - public setROBValue(robInstrUuid: number, value: number) { + public setROBValue(robInstrUid: number, value: number) { for (let i = 0; i < this._entries.length; i++) { - if (this._entries[i].Qj === robInstrUuid) { + if (this._entries[i].Qj === robInstrUid) { this._entries[i].Vj = value; this._entries[i].Qj = -1; } - if (this._entries[i].Qk === robInstrUuid) { + if (this._entries[i].Qk === robInstrUid) { this._entries[i].Vk = value; this._entries[i].Qk = -1; } @@ -177,8 +177,8 @@ export class ReserveStation { this._entries[i].Qk === -1 && this._entries[i].FUNum === -1 ) { - let uuid = this._entries[i].instruction.uuid; - readyInstructions.push(uuid); + let uid = this._entries[i].instruction.uid; + readyInstructions.push(uid); } } return readyInstructions; @@ -187,26 +187,26 @@ export class ReserveStation { /** * associateFU - associates a FU to the instruction */ - public associateFU(uuid: number, fuNum: number) { - let pos = this.getInstrPos(uuid); + public associateFU(uid: number, fuNum: number) { + let pos = this.getInstrPos(uid); this._entries[pos].FUNum = fuNum; } /** * associateAddressALU - associates a FU to the instruction */ - public associateAddressALU(uuid: number, fuNum: number) { - let pos = this.getInstrPos(uuid); + public associateAddressALU(uid: number, fuNum: number) { + let pos = this.getInstrPos(uid); this._entries[pos].FUNum = fuNum; this._entries[pos].FUIsAddALU = true; } public getVisualData(robMap: { - [uuid: number]: number; + [uid: number]: number; }): VisualReserveStationEntry[] { return this._entries.map((entry) => { let toReturn: VisualReserveStationEntry = { - instruction: { id: "", uuid: -1, value: "" }, + instruction: { id: "", uid: -1, value: "" }, Qj: "", Vj: "", Qk: "", @@ -217,17 +217,17 @@ export class ReserveStation { if (entry != null) { toReturn = { - instruction: { id: "", uuid: -1, value: "" }, + instruction: { id: "", uid: -1, value: "" }, Qj: entry.Qj !== -1 ? "[" + robMap[entry.Qj] + "]" : "-", Vj: entry.Vj !== -1 ? "" + entry.Vj : "-", Qk: entry.Qk !== -1 ? "[" + robMap[entry.Qk] + "]" : "-", Vk: entry.Vk !== -1 ? "" + entry.Vk : "-", A: entry.A !== -1 ? "@" + entry.A : "-", - ROB: "[" + robMap[entry.instruction.uuid] + "]", + ROB: "[" + robMap[entry.instruction.uid] + "]", }; if (entry.instruction != null) { toReturn.instruction.id = "" + entry.instruction.id; - toReturn.instruction.uuid = entry.instruction.uuid; + toReturn.instruction.uid = entry.instruction.uid; toReturn.instruction.value = entry.instruction.toString(); } } diff --git a/src/core/Superescalar/Superescalar.ts b/src/core/Superescalar/Superescalar.ts index 3c998e66..23b21fe4 100644 --- a/src/core/Superescalar/Superescalar.ts +++ b/src/core/Superescalar/Superescalar.ts @@ -286,7 +286,7 @@ export class Superescalar extends Machine { } issueInstructionToReserveStation(instruction: Instruction, type: number) { - let instrUuid = instruction.uuid; + let instrUid = instruction.uid; this._reserveStations[type].issueInstruction(instruction); // check were the value of the first operand is @@ -297,19 +297,19 @@ export class Superescalar extends Machine { instruction.isFirstOperandFloat() ); if (isROBRef) { - this._reserveStations[type].setFirstOperandReference(instrUuid, value); + this._reserveStations[type].setFirstOperandReference(instrUid, value); } else { - this._reserveStations[type].setFirstOperandValue(instrUuid, value); + this._reserveStations[type].setFirstOperandValue(instrUid, value); } } else if (instruction.hasImmediateOperand()) { // move the value of the immediate to the reserve station, if it has one this._reserveStations[type].setFirstOperandValue( - instrUuid, + instrUid, instruction.getImmediateOperand() ); } else { // set the value of the first operand to 0 - this._reserveStations[type].setFirstOperandValue(instrUuid, 0); + this._reserveStations[type].setFirstOperandValue(instrUid, 0); } // check were the value of the second operand is @@ -320,25 +320,25 @@ export class Superescalar extends Machine { instruction.isSecondOperandFloat() ); if (isROBRef) { - this._reserveStations[type].setSecondOperandReference(instrUuid, value); + this._reserveStations[type].setSecondOperandReference(instrUid, value); } else { - this._reserveStations[type].setSecondOperandValue(instrUuid, value); + this._reserveStations[type].setSecondOperandValue(instrUid, value); } } else if (instruction.hasImmediateOperand()) { // move the value of the immediate to the reserve station, if it has one this._reserveStations[type].setSecondOperandValue( - instrUuid, + instrUid, instruction.getImmediateOperand() ); } else { // set the value of the second operand to 0 - this._reserveStations[type].setSecondOperandValue(instrUuid, 0); + this._reserveStations[type].setSecondOperandValue(instrUid, 0); } // move the value of the address to the reserve station, if it has one if (instruction.getAddressOperand() !== -1) { this._reserveStations[type].setAddressOperand( - instrUuid, + instrUid, instruction.getAddressOperand() ); } @@ -379,8 +379,8 @@ export class Superescalar extends Machine { executeInstruction(type: FunctionalUnitType, num: number) { let readyInstsRefs = this._reserveStations[type].getReadyInstructions(); - for (let instrUUID of readyInstsRefs) { - let instruction = this._reorderBuffer.getInstruction(instrUUID); + for (let instrUID of readyInstsRefs) { + let instruction = this._reorderBuffer.getInstruction(instrUID); // Check if the instruction is a store and skip it // TODO: dont do this? @@ -392,10 +392,10 @@ export class Superescalar extends Machine { // this is because the load can be ready but the memory address is not calculated yet // or there is an store pending on that address if (instruction.isLoadInstruction()) { - if (!this._reorderBuffer.hasResultAddress(instrUUID)) { + if (!this._reorderBuffer.hasResultAddress(instrUID)) { continue; } - if (this._reorderBuffer.hasPreviousStores(instrUUID)) { + if (this._reorderBuffer.hasPreviousStores(instrUID)) { continue; } } @@ -404,8 +404,8 @@ export class Superescalar extends Machine { // associate it with the reserve station entry // and set the instruction as executing in the reorder buffer this.functionalUnit[type][num].addInstruction(instruction); - this._reserveStations[type].associateFU(instrUUID, num); - this._reorderBuffer.executeInstruction(instrUUID); + this._reserveStations[type].associateFU(instrUID, num); + this._reorderBuffer.executeInstruction(instrUID); break; // only execute one instruction per cycle } } @@ -425,20 +425,20 @@ export class Superescalar extends Machine { let execution = this.aluMem[i].executeReadyInstruction(); if (execution != null) { // if an instruction is ready, write the result address to the reorder buffer and reserve station - let instrUuid = execution.instruction.uuid; + let instrUid = execution.instruction.uid; let baseAddress = this._reserveStations[FunctionalUnitType.MEMORY].getAddressOperand( - instrUuid + instrUid ); let offset = this._reserveStations[ FunctionalUnitType.MEMORY - ].getSecondOperandValue(instrUuid); + ].getSecondOperandValue(instrUid); let address = baseAddress + offset; - this._reorderBuffer.writeResultAddress(instrUuid, address); + this._reorderBuffer.writeResultAddress(instrUid, address); this._reserveStations[FunctionalUnitType.MEMORY].setAddressOperand( - instrUuid, + instrUid, address ); } @@ -452,21 +452,21 @@ export class Superescalar extends Machine { this._reserveStations[FunctionalUnitType.MEMORY].getReadyInstructions( true ); // we dont need the first operand ready, as we are only calculating the address - for (let instrUUID of readyInstsRefs) { - let instruction = this._reorderBuffer.getInstruction(instrUUID); + for (let instrUID of readyInstsRefs) { + let instruction = this._reorderBuffer.getInstruction(instrUID); if ( instruction.isStoreInstruction() || instruction.isLoadInstruction() ) { - if (!this._reorderBuffer.hasResultAddress(instrUUID)) { + if (!this._reorderBuffer.hasResultAddress(instrUID)) { // assosiate the instruction with the address ALU, // so their address can be calculated this.aluMem[i].addInstruction(instruction); this._reserveStations[ FunctionalUnitType.MEMORY - ].associateAddressALU(instrUUID, i); - this._reorderBuffer.executeInstruction(instrUUID); + ].associateAddressALU(instrUID, i); + this._reorderBuffer.executeInstruction(instrUID); break; } } @@ -476,13 +476,13 @@ export class Superescalar extends Machine { writeInstruction(type: FunctionalUnitType, num: number) { let resul; - let instUuid = this.functionalUnit[type][num].getReadyInstructionUuid(); - if (instUuid !== -1) { - let inst = this._reorderBuffer.getInstruction(instUuid); + let instUid = this.functionalUnit[type][num].getReadyInstructionUid(); + if (instUid !== -1) { + let inst = this._reorderBuffer.getInstruction(instUid); let firstValue = - this._reserveStations[type].getFirstOperandValue(instUuid); + this._reserveStations[type].getFirstOperandValue(instUid); let secondValue = - this._reserveStations[type].getSecondOperandValue(instUuid); + this._reserveStations[type].getSecondOperandValue(instUid); // execute it let execution = this.functionalUnit[type][num].executeReadyInstruction( @@ -493,7 +493,7 @@ export class Superescalar extends Machine { // load and stores are a special cases, because they need to access the memory if (inst.isLoadInstruction()) { let a = this.memory.getFaultyDatum( - this._reserveStations[type].getAddressOperand(instUuid) + this._reserveStations[type].getAddressOperand(instUid) ); //hack: as we dont have a well made error handling, intercept the error and just throw it @@ -520,15 +520,15 @@ export class Superescalar extends Machine { // (jumps dont return a value for instructions, so we skip them) if (!inst.isJumpInstruction()) { for (let j = 0; j < FUNCTIONALUNITTYPESQUANTITY; j++) { - this._reserveStations[j].setROBValue(instUuid, resul); + this._reserveStations[j].setROBValue(instUid, resul); } } // update the reorder buffer with the result - this._reorderBuffer.writeResultValue(instUuid, resul); + this._reorderBuffer.writeResultValue(instUid, resul); // Remove the instruction entry from the reserve station - this._reserveStations[type].removeInstruction(instUuid); + this._reserveStations[type].removeInstruction(instUid); } } @@ -540,24 +540,24 @@ export class Superescalar extends Machine { let readyLoadsRefs = this._reserveStations[FunctionalUnitType.MEMORY].getReadyInstructions(); let refsToRemove = new Array(); - for (let instrUUID of readyLoadsRefs) { - let instruction = this._reorderBuffer.getInstruction(instrUUID); + for (let instrUID of readyLoadsRefs) { + let instruction = this._reorderBuffer.getInstruction(instrUID); if (instruction.isStoreInstruction()) { // check that is really ready, as the memory address can be not calculated yet - if (!this._reorderBuffer.hasResultAddress(instrUUID)) { + if (!this._reorderBuffer.hasResultAddress(instrUID)) { continue; } // write the result to the ROB and remove the instruction from the reserve station this._reorderBuffer.writeResultValue( - instrUUID, + instrUID, this._reserveStations[FunctionalUnitType.MEMORY].getFirstOperandValue( - instrUUID + instrUID ) ); //this._reserveStations[FunctionalUnitType.MEMORY].removeInstruction(instrRef); - refsToRemove.push(instrUUID); + refsToRemove.push(instrUID); } } for (let instrRef of refsToRemove) { @@ -592,9 +592,9 @@ export class Superescalar extends Machine { this._reorderBuffer.getResultValue() ) ) { - let instUuid = this._reorderBuffer.commitInstruction(); - if (instUuid !== -1) { - this._currentCommitedInstrs.push(instUuid); + let instUid = this._reorderBuffer.commitInstruction(); + if (instUid !== -1) { + this._currentCommitedInstrs.push(instUid); } // the jump was mispredicted return CommitStatus.SUPER_COMMITMISS; @@ -629,9 +629,9 @@ export class Superescalar extends Machine { return CommitStatus.SUPER_COMMITNO; } - let instUuid = this._reorderBuffer.commitInstruction(); - if (instUuid !== -1) { - this._currentCommitedInstrs.push(instUuid); + let instUid = this._reorderBuffer.commitInstruction(); + if (instUid !== -1) { + this._currentCommitedInstrs.push(instUid); } } return CommitStatus.SUPER_COMMITOK; diff --git a/src/integration/superescalar-integration.ts b/src/integration/superescalar-integration.ts index d79e0c90..f18d0d1e 100644 --- a/src/integration/superescalar-integration.ts +++ b/src/integration/superescalar-integration.ts @@ -16,7 +16,7 @@ import { batchActions, nextTotalCommited, nextInstructionsCommited, - nextUnitsOcupation, + nextUnitsUsage, nextInstructionsStatusesAverageCycles, nextStatusesCount, setCyclesPerReplication, @@ -102,7 +102,7 @@ export class SuperescalarIntegration extends MachineIntegration { nextCycle(this.superescalar.status.cycle), nextTotalCommited(this.stats.getCommitedAndDiscarded()), nextInstructionsCommited(this.stats.getCommitedPercentagePerInstruction()), - nextUnitsOcupation(this.stats.getUnitsOcupation()), + nextUnitsUsage(this.stats.getUnitsUsage()), nextStatusesCount(this.stats.getPerStatusCountAtCycle()), nextInstructionsStatusesAverageCycles(this.stats.getInstructionsStatusesAverage()), pushHistory() @@ -112,26 +112,26 @@ export class SuperescalarIntegration extends MachineIntegration { collectStats = () => { let prefetchInstrs = this.superescalar.prefetchUnit.getVisualData(); - this.stats.collectPrefetchUuids(prefetchInstrs.map((data) => data.uuid)); - this.stats.collectDecodeUuids(this.superescalar.decoder.getVisualData().map((data) => data.uuid)); - this.stats.collectIssuedUuids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "ISSUE").map((data) => data.instruction.uuid)); - this.stats.collectExecutingUuids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "EXECUTE").map((data) => data.instruction.uuid)); - this.stats.collectWriteBackUuids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "WRITE").map((data) => data.instruction.uuid)); - this.stats.collectCommitUuids(this.superescalar.currentCommitedInstrs); - - this.stats.collectUnitOcupation('prefetch', this.superescalar.prefetchUnit.ocupation); - this.stats.collectUnitOcupation('decode', this.superescalar.decoder.ocupation); - this.stats.collectUnitOcupation('rob', this.superescalar.reorderBuffer.ocupation); + this.stats.collectPrefetchUids(prefetchInstrs.map((data) => data.uid)); + this.stats.collectDecodeUids(this.superescalar.decoder.getVisualData().map((data) => data.uid)); + this.stats.collectIssuedUids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "ISSUE").map((data) => data.instruction.uid)); + this.stats.collectExecutingUids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "EXECUTE").map((data) => data.instruction.uid)); + this.stats.collectWriteBackUids(this.superescalar.reorderBuffer.getVisualData().filter((data) => data.superStage === "WRITE").map((data) => data.instruction.uid)); + this.stats.collectCommitUids(this.superescalar.currentCommitedInstrs); + + this.stats.collectUnitUsage('prefetch', this.superescalar.prefetchUnit.usage); + this.stats.collectUnitUsage('decode', this.superescalar.decoder.usage); + this.stats.collectUnitUsage('rob', this.superescalar.reorderBuffer.usage); for (let i = 0; i < 6; i++) { - this.stats.collectUnitOcupation(`rs${i}`, this.superescalar.getReserveStation(i).ocupation); + this.stats.collectUnitUsage(`rs${i}`, this.superescalar.getReserveStation(i).usage); } for (let i = 0; i < 6; i++) { - this.stats.collectMultipleUnitOcupation(`fu${i}`, this.superescalar.functionalUnit[i].map((fu) => fu.ocupation)); + this.stats.collectMultipleUnitUsage(`fu${i}`, this.superescalar.functionalUnit[i].map((fu) => fu.usage)); } for (let instr of prefetchInstrs) { - this.stats.associateUuidWithInstruction(instr.uuid, instr.id); + this.stats.associateUidWithInstruction(instr.uid, instr.id); } this.stats.advanceCycle(); @@ -260,7 +260,7 @@ export class SuperescalarIntegration extends MachineIntegration { batchActions( setCyclesPerReplication(results), nextTotalCommited(this.batchStats.getAvgCommitedAndDiscarded()), - nextUnitsOcupation(this.batchStats.getAvgUnitsOcupation()), + nextUnitsUsage(this.batchStats.getAvgUnitsUsage()), nextInstructionsCommited(this.batchStats.getAvgCommitedPercentagePerInstruction()), nextStatusesCount(this.batchStats.getPerStatusCountAtCycle()), nextInstructionsStatusesAverageCycles(this.batchStats.getAvgInstructionsStatusesAverage()), diff --git a/src/integration/vliw-integration.ts b/src/integration/vliw-integration.ts index e68446a8..ac5f72e4 100644 --- a/src/integration/vliw-integration.ts +++ b/src/integration/vliw-integration.ts @@ -10,7 +10,7 @@ import { currentPC, superescalarLoad, batchActions, - nextUnitsOcupation, + nextUnitsUsage, setCyclesPerReplication } from '../interface/actions'; @@ -66,7 +66,7 @@ export class VLIWIntegration extends MachineIntegration { nextNatFprCycle(this.vliw.getNaTFP()), nextNatGprCycle(this.vliw.getNaTGP()), nextPredicateCycle(this.vliw.getPredReg()), - nextUnitsOcupation(this.stats.getUnitsOcupation()), + nextUnitsUsage(this.stats.getUnitsUsage()), pushHistory() ) ); @@ -74,7 +74,7 @@ export class VLIWIntegration extends MachineIntegration { collectStats = () => { for (let i = 0; i < 6; i++) { - this.stats.collectMultipleUnitOcupation(`fu${i}`, this.vliw.functionalUnit[i].map((fu) => fu.ocupation)); + this.stats.collectMultipleUnitUsage(`fu${i}`, this.vliw.functionalUnit[i].map((fu) => fu.usage)); } this.stats.advanceCycle(); @@ -260,7 +260,7 @@ export class VLIWIntegration extends MachineIntegration { store.dispatch( batchActions( setCyclesPerReplication(results), - nextUnitsOcupation(this.batchStats.getAvgUnitsOcupation()), + nextUnitsUsage(this.batchStats.getAvgUnitsUsage()), displayBatchResults(this.batchStats.export()) )); } diff --git a/src/interface/actions/functional-unit-actions.ts b/src/interface/actions/functional-unit-actions.ts index ffdc5be2..e7c00a98 100644 --- a/src/interface/actions/functional-unit-actions.ts +++ b/src/interface/actions/functional-unit-actions.ts @@ -24,14 +24,14 @@ function mapFunctionalUnitData(data): any { aux.push({ id: entry.id, value: entry.value, - uuid: entry.uuid, + uid: entry.uid, color: '' }); } else { aux.push({ id: '-', value: '', - uuid: -1, + uid: -1, color: '' }); } diff --git a/src/interface/actions/reorder-buffer-actions.ts b/src/interface/actions/reorder-buffer-actions.ts index 68dc7f72..d1cc8e0c 100644 --- a/src/interface/actions/reorder-buffer-actions.ts +++ b/src/interface/actions/reorder-buffer-actions.ts @@ -15,9 +15,9 @@ export function mapReorderBufferData(unit: ReorderBuffer) { return unit.getVisualData(); } -export function colorCell(instructionUuid, color) { +export function colorCell(instructionUid, color) { return { type: COLOR_CELL, - value: [instructionUuid, color] + value: [instructionUid, color] }; } diff --git a/src/interface/actions/reserve-station-actions.ts b/src/interface/actions/reserve-station-actions.ts index 4f7c83c3..e6d03518 100644 --- a/src/interface/actions/reserve-station-actions.ts +++ b/src/interface/actions/reserve-station-actions.ts @@ -13,7 +13,7 @@ function mapReserveStationEntry(content: { data: any, size: number }): any { let i; const defaultObject = { - instruction: { id: '', value: '', uuid: '' }, + instruction: { id: '', value: '', uid: '' }, Qj: '', Vj: '', Qk: '', @@ -25,7 +25,7 @@ function mapReserveStationEntry(content: { data: any, size: number }): any { let aux = { ...defaultObject }; if (data[i] != null) { aux = { - instruction: { id: '', value: '', uuid: '' }, + instruction: { id: '', value: '', uid: '' }, Qj: data[i].Qj, Vj: data[i].Vj, Qk: data[i].Qk, @@ -36,7 +36,7 @@ function mapReserveStationEntry(content: { data: any, size: number }): any { if (data[i].instruction != null) { aux.instruction.id = data[i].instruction.id; aux.instruction.value = data[i].instruction.value; - aux.instruction.uuid = data[i].instruction.uuid; + aux.instruction.uid = data[i].instruction.uid; } } diff --git a/src/interface/actions/stats-actions.ts b/src/interface/actions/stats-actions.ts index 75464014..a085a780 100644 --- a/src/interface/actions/stats-actions.ts +++ b/src/interface/actions/stats-actions.ts @@ -1,56 +1,56 @@ -export const NEXT_TOTAL_COMMITED = 'NEXT_TOTAL_COMMITED'; -export const NEXT_INSTRUCTIONS_COMMITED = 'NEXT_INSTRUCTIONS_COMMITED'; -export const NEXT_UNITS_OCUPATION = 'NEXT_UNITS_OCUPATION'; -export const NEXT_STATUSES_COUNT = 'NEXT_STATUSES_COUNT'; -export const NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES = 'NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES'; -export const SET_CYCLES_PER_REPLICATION = 'SET_CYCLES_PER_REPLICATION'; - +export const NEXT_TOTAL_COMMITED = "NEXT_TOTAL_COMMITED"; +export const NEXT_INSTRUCTIONS_COMMITED = "NEXT_INSTRUCTIONS_COMMITED"; +export const NEXT_UNITS_OCUPATION = "NEXT_UNITS_OCUPATION"; +export const NEXT_STATUSES_COUNT = "NEXT_STATUSES_COUNT"; +export const NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES = + "NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES"; +export const SET_CYCLES_PER_REPLICATION = "SET_CYCLES_PER_REPLICATION"; export function nextInstructionsStatusesAverageCycles(data) { - return { - type: NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES, - value: data - }; + return { + type: NEXT_INSTRUCTIONS_STATUSES_AVERAGE_CYCLES, + value: data, + }; } export function nextStatusesCount(data) { - return { - type: NEXT_STATUSES_COUNT, - value: data - }; + return { + type: NEXT_STATUSES_COUNT, + value: data, + }; } -export function nextUnitsOcupation(data) { - return { - type: NEXT_UNITS_OCUPATION, - value: data - }; +export function nextUnitsUsage(data) { + return { + type: NEXT_UNITS_OCUPATION, + value: data, + }; } export function nextTotalCommited(data) { - return { - type: NEXT_TOTAL_COMMITED, - value: data - }; + return { + type: NEXT_TOTAL_COMMITED, + value: data, + }; } export function nextInstructionsCommited(data) { - return { - type: NEXT_INSTRUCTIONS_COMMITED, - value: data - }; + return { + type: NEXT_INSTRUCTIONS_COMMITED, + value: data, + }; } export function setCyclesPerReplication(data) { - return { - type: SET_CYCLES_PER_REPLICATION, - value: data - }; + return { + type: SET_CYCLES_PER_REPLICATION, + value: data, + }; } export function clearCyclesPerReplication() { - return { - type: SET_CYCLES_PER_REPLICATION, - value: [] - }; -} \ No newline at end of file + return { + type: SET_CYCLES_PER_REPLICATION, + value: [], + }; +} diff --git a/src/interface/components/Superescalar/FunctionalUnitComponent.tsx b/src/interface/components/Superescalar/FunctionalUnitComponent.tsx index b487af49..cad65cd5 100644 --- a/src/interface/components/Superescalar/FunctionalUnitComponent.tsx +++ b/src/interface/components/Superescalar/FunctionalUnitComponent.tsx @@ -35,7 +35,7 @@ export function FunctionalUnitComponent(props) { title={content.value} key={props.title + 'FU' + i + j} style={{ - background: props.colors.uuidColors[content.uuid] + background: props.colors.uidColors[content.uid] }} > {content.id} diff --git a/src/interface/components/Superescalar/PrefetchDecoderComponent.tsx b/src/interface/components/Superescalar/PrefetchDecoderComponent.tsx index 2dd32e63..a84a4b44 100644 --- a/src/interface/components/Superescalar/PrefetchDecoderComponent.tsx +++ b/src/interface/components/Superescalar/PrefetchDecoderComponent.tsx @@ -13,7 +13,7 @@ export function PrefetchDecoderComponent(props) { { props.data && props.data.map((element, i) =>
-
{element != null ? element.id : ` `}
+
{element != null ? element.id : ` `}
) } diff --git a/src/interface/components/Superescalar/ReorderBufferComponent.tsx b/src/interface/components/Superescalar/ReorderBufferComponent.tsx index a7a634c5..bfc412c0 100644 --- a/src/interface/components/Superescalar/ReorderBufferComponent.tsx +++ b/src/interface/components/Superescalar/ReorderBufferComponent.tsx @@ -22,17 +22,17 @@ class ReorderBufferComponent extends React.Component { } handleClick(instructionId, instructionColor) { - this.setState({...this.state, displayColorPicker: true, instructionUuid: instructionId, selectedColor: instructionColor}); + this.setState({...this.state, displayColorPicker: true, instructionUid: instructionId, selectedColor: instructionColor}); } onColorAccept(value) { - this.props.actions.colorCell(this.state.instructionUuid, this.state.selectedColor.hex); - this.setState({...this.state, displayColorPicker: false, selectedColor: '', instructionUuid: null}); + this.props.actions.colorCell(this.state.instructionUid, this.state.selectedColor.hex); + this.setState({...this.state, displayColorPicker: false, selectedColor: '', instructionUid: null}); } onColorCancel() { - this.setState({...this.state, displayColorPicker: false, selectedColor: '', instructionUuid: null}); + this.setState({...this.state, displayColorPicker: false, selectedColor: '', instructionUid: null}); } handleChangeComplete(color) { @@ -82,8 +82,8 @@ class ReorderBufferComponent extends React.Component { .map(e => (
this.handleClick(e.row.instruction.uuid, e.row.instruction.color) as any} + style={{background: this.props.colors.uidColors[e.row.instruction.uid]}} + onClick={() => this.handleClick(e.row.instruction.uid, e.row.instruction.color) as any} title={e.row.instruction.value} key={'ReorderBuffer' + e.i} > diff --git a/src/interface/components/Superescalar/ReserveStationComponent.tsx b/src/interface/components/Superescalar/ReserveStationComponent.tsx index 9275cdc3..63474dca 100644 --- a/src/interface/components/Superescalar/ReserveStationComponent.tsx +++ b/src/interface/components/Superescalar/ReserveStationComponent.tsx @@ -27,7 +27,7 @@ export function ReserveStationComponent(props) { title={row.instruction.value} key={`${props.title + i}`} style={{ - background: props.colors.uuidColors[row.instruction.uuid] + background: props.colors.uidColors[row.instruction.uid] }} >
diff --git a/src/interface/components/Superescalar/navbar/FileBarComponent.tsx b/src/interface/components/Superescalar/navbar/FileBarComponent.tsx index 14ebabd0..edaad140 100644 --- a/src/interface/components/Superescalar/navbar/FileBarComponent.tsx +++ b/src/interface/components/Superescalar/navbar/FileBarComponent.tsx @@ -25,12 +25,16 @@ class FileBarComponent extends React.Component { downloadContentFile() { if (SuperescalarIntegration.contentIntegration) { downloadTextFile('content.txt', SuperescalarIntegration.contentIntegration.deparse()); + } else { + downloadTextFile('content.txt', ''); } } downloadCodeFile() { if (SuperescalarIntegration.superescalar.code) { downloadTextFile('code.txt', SuperescalarIntegration.superescalar.code.save()); + } else { + downloadTextFile('code.txt', ''); } } diff --git a/src/interface/components/Superescalar/tab/StatsTabComponent.tsx b/src/interface/components/Superescalar/tab/StatsTabComponent.tsx index 957fb13a..3c6b6b15 100644 --- a/src/interface/components/Superescalar/tab/StatsTabComponent.tsx +++ b/src/interface/components/Superescalar/tab/StatsTabComponent.tsx @@ -12,7 +12,7 @@ const mapStateToProps = (state: GlobalState) => { commited: state.Machine.stats.commited, discarded: state.Machine.stats.discarded, instrCommitPercentage: state.Machine.stats.commitedPerInstr, - unitsOcupation: state.Machine.stats.unitsOcupation, + unitsUsage: state.Machine.stats.unitsUsage, statusesCount: state.Machine.stats.statusesCount, instrStatuses: state.Machine.stats.instructionsStatusesAverageCycles, cyclesPerReplication: state.Ui.batchResults, @@ -110,7 +110,7 @@ export const StatsTabComponent: React.FC = ( }} option={{ title: { - text: props.t("stats.unitsOcupation"), + text: props.t("stats.unitsUsage"), left: "center", }, @@ -166,12 +166,12 @@ export const StatsTabComponent: React.FC = ( }, series: - props.unitsOcupation && - Array.from(props.unitsOcupation.keys()).map((unitName: string) => { + props.unitsUsage && + Array.from(props.unitsUsage.keys()).map((unitName: string) => { return { name: props.t("stats.units." + unitName), type: "line", - data: props.unitsOcupation + data: props.unitsUsage .get(unitName) .map((value: number) => value * 100), }; diff --git a/src/interface/components/VLIW/navbar/VLIWFileBarComponent.tsx b/src/interface/components/VLIW/navbar/VLIWFileBarComponent.tsx index ed328bab..a51248d8 100644 --- a/src/interface/components/VLIW/navbar/VLIWFileBarComponent.tsx +++ b/src/interface/components/VLIW/navbar/VLIWFileBarComponent.tsx @@ -23,12 +23,16 @@ class VLIWFileBarComponent extends React.Component { downloadContentFile() { if (vliwIntegration.contentIntegration) { downloadTextFile('content.txt', vliwIntegration.contentIntegration.deparse()); + } else { + downloadTextFile('content.txt', ''); } } downloadCodeFile() { if (vliwIntegration.vliw.code) { downloadTextFile('code.txt', vliwIntegration.vliw.code.save()); + } else { + downloadTextFile('code.txt', ''); } } diff --git a/src/interface/components/VLIW/tab/StatsTabComponent.tsx b/src/interface/components/VLIW/tab/StatsTabComponent.tsx index 87f83d40..92f97a21 100644 --- a/src/interface/components/VLIW/tab/StatsTabComponent.tsx +++ b/src/interface/components/VLIW/tab/StatsTabComponent.tsx @@ -24,7 +24,7 @@ export const StatsTabComponent: React.FC = ( }} option={{ title: { - text: props.t("stats.unitsOcupation"), + text: props.t("stats.unitsUsage"), left: "center", }, @@ -66,12 +66,12 @@ export const StatsTabComponent: React.FC = ( }, series: - props.unitsOcupation && - Array.from(props.unitsOcupation.keys()).map((unitName) => { + props.unitsUsage && + Array.from(props.unitsUsage.keys()).map((unitName) => { return { name: props.t("stats.units." + unitName), type: "line", - data: props.unitsOcupation + data: props.unitsUsage .get(unitName) .map((value: number) => value * 100), }; @@ -142,7 +142,7 @@ const mapStateToProps = (state) => { commited: state.Machine.stats.commited, discarded: state.Machine.stats.discarded, instrCommitPercentage: state.Machine.stats.commitedPerInstr, - unitsOcupation: state.Machine.stats.unitsOcupation, + unitsUsage: state.Machine.stats.unitsUsage, statusesCount: state.Machine.stats.statusesCount, instrStatuses: state.Machine.stats.instructionsStatusesAverageCycles, cyclesPerReplication: state.Ui.batchResults, diff --git a/src/interface/reducers/color.ts b/src/interface/reducers/color.ts index 66b6f95e..6122e0de 100644 --- a/src/interface/reducers/color.ts +++ b/src/interface/reducers/color.ts @@ -1,7 +1,7 @@ import { COLOR_CELL } from "../actions"; export const initialState = { - uuidColors: {}, + uidColors: {}, IidColors: {} } @@ -10,8 +10,8 @@ export function ColorReducers(state = initialState, action) { case COLOR_CELL: return (state = { ...state, - uuidColors: { - ...state.uuidColors, + uidColors: { + ...state.uidColors, [action.value[0]]: action.value[1] } }); diff --git a/src/interface/reducers/machine.ts b/src/interface/reducers/machine.ts index 4a3268c8..288b5812 100644 --- a/src/interface/reducers/machine.ts +++ b/src/interface/reducers/machine.ts @@ -102,7 +102,7 @@ export const initialState = { commited: 0, discarded: 0, commitedPerInstr: [], - unitsOcupation: new Map(), + unitsUsage: new Map(), statusesCount: new Map(), instructionsStatusesAverageCycles: new Map() }, @@ -217,7 +217,7 @@ export function MachineReducers(state = initialState, action): typeof initialSta ...state, stats: { ...state.stats, - unitsOcupation: action.value + unitsUsage: action.value } }); case NEXT_STATUSES_COUNT: diff --git a/src/stats/aggregator.ts b/src/stats/aggregator.ts index 9e32732d..aa69a645 100644 --- a/src/stats/aggregator.ts +++ b/src/stats/aggregator.ts @@ -28,16 +28,16 @@ export class StatsAgregator { return result; } - public getAvgUnitsOcupation(): Map { + public getAvgUnitsUsage(): Map { let result = new Map(); for (let stat of this._stats) { - let ocupations = stat.getUnitsOcupation(); - for (let key of ocupations.keys()) { + let usages = stat.getUnitsUsage(); + for (let key of usages.keys()) { if (!result.has(key)) { result.set(key, []); } - result.get(key).push(ocupations.get(key)); + result.get(key).push(usages.get(key)); } } diff --git a/src/stats/stats.ts b/src/stats/stats.ts index 7aa4ef2a..ec3115ca 100644 --- a/src/stats/stats.ts +++ b/src/stats/stats.ts @@ -22,100 +22,100 @@ interface StatusesStats { export class Stats { private _instrEntries: Map = new Map(); private _statusesAtCycle: Map = new Map(); - private _unitOcupationAtCycle: Map> = new Map(); + private _unitUsageAtCycle: Map> = new Map(); private _currentCycle: number = 0; - public collectMultipleUnitOcupation(unitName: string, ocupations: number[]) { - let ocupation = - ocupations.reduce((acc, val) => acc + val, 0) / ocupations.length; - this.collectUnitOcupation(unitName, ocupation); + public collectMultipleUnitUsage(unitName: string, usages: number[]) { + let usage = + usages.reduce((acc, val) => acc + val, 0) / usages.length; + this.collectUnitUsage(unitName, usage); } - public collectUnitOcupation(unitName: string, ocupation: number) { - if (!this._unitOcupationAtCycle.has(unitName)) { - this._unitOcupationAtCycle.set(unitName, new Map()); + public collectUnitUsage(unitName: string, usage: number) { + if (!this._unitUsageAtCycle.has(unitName)) { + this._unitUsageAtCycle.set(unitName, new Map()); } - this._unitOcupationAtCycle.get(unitName).set(this._currentCycle, ocupation); + this._unitUsageAtCycle.get(unitName).set(this._currentCycle, usage); } - public collectDecodeUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).decodeCycles++; + public collectDecodeUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).decodeCycles++; } this.createStatusesIfNotExists(); - this._statusesAtCycle.get(this._currentCycle).decodeNumber += uuids.length; + this._statusesAtCycle.get(this._currentCycle).decodeNumber += uids.length; } - public collectPrefetchUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).prefetchCycles++; + public collectPrefetchUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).prefetchCycles++; } this.createStatusesIfNotExists(); this._statusesAtCycle.get(this._currentCycle).prefetchNumber += - uuids.length; + uids.length; } - public collectIssuedUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).issueCycles++; + public collectIssuedUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).issueCycles++; } this.createStatusesIfNotExists(); - this._statusesAtCycle.get(this._currentCycle).issueNumber += uuids.length; + this._statusesAtCycle.get(this._currentCycle).issueNumber += uids.length; } - public collectExecutingUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).executeCycles++; + public collectExecutingUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).executeCycles++; } this.createStatusesIfNotExists(); - this._statusesAtCycle.get(this._currentCycle).executeNumber += uuids.length; + this._statusesAtCycle.get(this._currentCycle).executeNumber += uids.length; } - public collectWriteBackUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).writeBackCycles++; + public collectWriteBackUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).writeBackCycles++; } this.createStatusesIfNotExists(); this._statusesAtCycle.get(this._currentCycle).writeBackNumber += - uuids.length; + uids.length; } - public collectCommitUuids(uuids: number[]) { - for (let uuid of uuids) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).commited = true; + public collectCommitUids(uids: number[]) { + for (let uid of uids) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).commited = true; } this.createStatusesIfNotExists(); - this._statusesAtCycle.get(this._currentCycle).commitNumber += uuids.length; + this._statusesAtCycle.get(this._currentCycle).commitNumber += uids.length; } - public associateUuidWithInstruction(uuid: number, instructionId: number) { - this.createEntryIfNotExists(uuid); - this._instrEntries.get(uuid).instructionId = instructionId; + public associateUidWithInstruction(uid: number, instructionId: number) { + this.createEntryIfNotExists(uid); + this._instrEntries.get(uid).instructionId = instructionId; } public advanceCycle() { this._currentCycle++; } - public getUnitsOcupation(): Map { - let ocupation = new Map(); - for (let [unitName, ocupationAtCycle] of this._unitOcupationAtCycle) { - ocupation.set(unitName, Array.from(ocupationAtCycle.values())); + public getUnitsUsage(): Map { + let usage = new Map(); + for (let [unitName, usageAtCycle] of this._unitUsageAtCycle) { + usage.set(unitName, Array.from(usageAtCycle.values())); } - return ocupation; + return usage; } public getCommitedAndDiscarded(): { commited: number; discarded: number } { @@ -156,7 +156,7 @@ export class Stats { public getInstructionsStatusesAverage(): Map { let average = new Map(); let count = new Map(); - for (let [uuid, entry] of this._instrEntries) { + for (let [uid, entry] of this._instrEntries) { if (!count.has(entry.instructionId)) { count.set(entry.instructionId, 0); average.set(entry.instructionId, { @@ -205,14 +205,14 @@ export class Stats { } public exportStats(): object { - let unitOcupation = {}; - for (let [unitName, ocupationAtCycle] of this._unitOcupationAtCycle) { - unitOcupation[unitName] = Object.fromEntries(ocupationAtCycle); + let unitUsage = {}; + for (let [unitName, usageAtCycle] of this._unitUsageAtCycle) { + unitUsage[unitName] = Object.fromEntries(usageAtCycle); } return { instances: Object.fromEntries(this._instrEntries), statuses: Object.fromEntries(this._statusesAtCycle), - unitOcupation, + unitUsage, }; } @@ -229,9 +229,9 @@ export class Stats { } } - private createEntryIfNotExists(uuid: number) { - if (!this._instrEntries.has(uuid)) { - this._instrEntries.set(uuid, { + private createEntryIfNotExists(uid: number) { + if (!this._instrEntries.has(uid)) { + this._instrEntries.set(uid, { instructionId: -1, prefetchCycles: 0, decodeCycles: 0,