Skip to content

Commit

Permalink
highlight current PC on VLIW machine
Browse files Browse the repository at this point in the history
  • Loading branch information
endes0 committed Feb 3, 2024
1 parent bc14701 commit 9715779
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/integration/vliw-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
nextRegistersCycle,
nextMemoryCycle,
nextCycle,
currentPC,
superescalarLoad,
batchActions
} from '../interface/actions';
Expand Down Expand Up @@ -53,6 +54,7 @@ export class VLIWIntegration extends MachineIntegration {
nextRegistersCycle([this.vliw.gpr.content, this.vliw.fpr.content]),
nextMemoryCycle(this.vliw.memory.data),
nextCycle(this.vliw.status.cycle),
currentPC(this.vliw.pc),
nextNatFprCycle(this.vliw.getNaTFP()),
nextNatGprCycle(this.vliw.getNaTGP()),
nextPredicateCycle(this.vliw.getPredReg()),
Expand Down
8 changes: 8 additions & 0 deletions src/interface/actions/cycle-actions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
export const NEXT_CYCLE = 'NEXT_CYCLE';
export const CURRENT_PC = 'CURRENT_PC';

export function nextCycle(data) {
return {
type: NEXT_CYCLE,
value: data
};
}

export function currentPC(data) {
return {
type: CURRENT_PC,
value: data
};
}
2 changes: 1 addition & 1 deletion src/interface/components/VLIW/TableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function TableComponent(props) {
<div className="smd-table-body">
{props.data &&
props.data.map((row, i) => (
<div className="smd-table_row" key={`${'VliwCode' + i}`} >
<div className="smd-table_row" key={`${'VliwCode' + i}`} style={{background: (i === props.pc)? "grey" : ""}} >
<div className="smd-table_cell">
{ i }
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/interface/components/VLIW/tab/GeneralVLIWTabComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class GeneralVLIWTabComponent extends React.Component<any, any> {
title="Instrucciones VLIW"
header={this.props.vliwExecutionHeaderTable}
data={this.props.vliwExecutionTable}
pc={this.props.pc}
onDropInstruction={VLIWIntegration.setOperation}
/>
</div>
Expand Down Expand Up @@ -149,6 +150,7 @@ const mapStateToProps = state => {
natGpr: state.Machine.natGpr,
predicate: state.Machine.predicate,
code: state.Machine.code,
pc: state.Machine.pc,
colorBasicBlocks: state.Machine.colorBasicBlocks,
vliwExecutionTable: state.Machine.vliwExecutionTable,
vliwExecutionHeaderTable: state.Machine.vliwExecutionHeaderTable
Expand Down
7 changes: 7 additions & 0 deletions src/interface/reducers/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
NEXT_REGISTERS_CYCLE,
NEXT_MEMORY_CYCLE,
NEXT_CYCLE,
CURRENT_PC,
SUPERESCALAR_LOAD,
VIEW_BASIC_BLOCKS
} from '../actions';
Expand Down Expand Up @@ -93,6 +94,7 @@ export const initialState = {
visibleRangeValues: generateRangeArray(PREDICATE_SIZE)
},
cycle: 0,
pc: 0,
code: [],
vliwCode: [],
vliwExecutionHeaderTable: [],
Expand Down Expand Up @@ -175,6 +177,11 @@ export function MachineReducers(state = initialState, action) {
...state,
cycle: action.value
});
case CURRENT_PC:
return (state = {
...state,
pc: action.value
});
case SUPERESCALAR_LOAD:
return (state = {
...state,
Expand Down

0 comments on commit 9715779

Please sign in to comment.