mirror of
https://github.com/guilhermewerner/tomasulo-simulator
synced 2025-06-15 13:24:20 +00:00
Add clock functions
This commit is contained in:
@ -11,15 +11,11 @@ import { useState } from 'react';
|
|||||||
import Button from 'react-bootstrap/Button';
|
import Button from 'react-bootstrap/Button';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
const [clock, setClock] = useState(0);
|
||||||
const [instructionStatus, setInstructionStatus] = useState([]);
|
const [instructionStatus, setInstructionStatus] = useState([]);
|
||||||
const [reorderBuffer, setReorderBuffer] = useState([]);
|
|
||||||
const [reservationStations, setReservationStations] = useState([]);
|
const [reservationStations, setReservationStations] = useState([]);
|
||||||
const [registerStatus, setRegisterStatus] = useState([]);
|
const [registerStatus, setRegisterStatus] = useState([]);
|
||||||
|
|
||||||
function nextCycle() {
|
|
||||||
console.log("CLOCK")
|
|
||||||
}
|
|
||||||
|
|
||||||
function issueInstruction() {
|
function issueInstruction() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -32,6 +28,13 @@ export default function Home() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextCycle() {
|
||||||
|
setClock(clock + 1);
|
||||||
|
issueInstruction();
|
||||||
|
executeInstruction();
|
||||||
|
writeInstruction();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
@ -58,7 +61,8 @@ export default function Home() {
|
|||||||
<h3>Instruction Status</h3>
|
<h3>Instruction Status</h3>
|
||||||
</Col>
|
</Col>
|
||||||
<Col className="text-end">
|
<Col className="text-end">
|
||||||
<Button variant="primary" onClick={nextCycle}>Próximo</Button>
|
<span>Ciclos: {clock}</span>
|
||||||
|
<Button className="ms-4" variant="primary" onClick={nextCycle}>Próximo</Button>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Table bordered hover>
|
<Table bordered hover>
|
||||||
@ -96,7 +100,7 @@ export default function Home() {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{reorderBuffer.map((instr, index) => (
|
{instructionStatus.map((instr, index) => (
|
||||||
<tr>
|
<tr>
|
||||||
<td>batata</td>
|
<td>batata</td>
|
||||||
<td>batata</td>
|
<td>batata</td>
|
||||||
|
Reference in New Issue
Block a user