Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Commit 1edc97d

Browse files
committed
perfected
1 parent 2d2146b commit 1edc97d

4 files changed

Lines changed: 87 additions & 84 deletions

File tree

src/pages/SequentialCircuits/SeqIntro.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SeqGridData from "./data/SeqGridData";
88
import SeqBoxData from "./data/SeqBoxData";
99
import SeqBoxInfo from "./components/SeqBoxInfo";
1010
import SeqBoxSuccess from "./components/SeqBoxSuccess";
11+
import SeqTableData from "./data/SeqTableData";
1112

1213
const SeqIntro = () => (
1314
<SeqLayout
@@ -24,7 +25,7 @@ const SeqIntro = () => (
2425
allow the circuit to "remember" previous states.
2526
</p>
2627

27-
<SeqTable />
28+
<SeqTable data={SeqTableData.sequentialcircuit} />
2829

2930
<h2>General Model</h2>
3031
<p>Every sequential circuit has three fundamental parts:</p>

src/pages/SequentialCircuits/SeqLatches.jsx

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React, { useState } from "react";
22
import SeqLayout from "./SeqLayout";
33
import SeqBox from "./components/SeqBox";
44
import SeqBoxData from "./data/SeqBoxData";
5+
import SeqTable from "./components/SeqTable";
6+
import SeqTableData from "./data/SeqTableData";
57

68
const SRLatchSim = () => {
79
const [S, setS] = useState(0);
@@ -135,49 +137,7 @@ const SeqLatches = () => (
135137
<strong>Q</strong> and <strong></strong>.
136138
</p>
137139

138-
<div className="seq-table-wrap">
139-
<table className="seq-table">
140-
<thead>
141-
<tr>
142-
<th>S</th>
143-
<th>R</th>
144-
<th>Q (next)</th>
145-
<th>Q̄ (next)</th>
146-
<th>Action</th>
147-
</tr>
148-
</thead>
149-
<tbody>
150-
<tr>
151-
<td>0</td>
152-
<td>0</td>
153-
<td>Q</td>
154-
<td></td>
155-
<td>No change (memory)</td>
156-
</tr>
157-
<tr>
158-
<td>1</td>
159-
<td>0</td>
160-
<td>1</td>
161-
<td>0</td>
162-
<td>Set</td>
163-
</tr>
164-
<tr>
165-
<td>0</td>
166-
<td>1</td>
167-
<td>0</td>
168-
<td>1</td>
169-
<td>Reset</td>
170-
</tr>
171-
<tr>
172-
<td>1</td>
173-
<td>1</td>
174-
<td>?</td>
175-
<td>?</td>
176-
<td>⚠ Forbidden</td>
177-
</tr>
178-
</tbody>
179-
</table>
180-
</div>
140+
<SeqTable data={SeqTableData.SRLatch} />
181141

182142
<SRLatchSim />
183143

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
1-
export default function SeqTable() {
1+
import React from "react";
2+
3+
export default function SeqTable({ data }) {
4+
if (!data) return null; // Handle empty data gracefully
5+
const { headers, rows } = data;
6+
const keys = headers.map((header) => header.toLowerCase());
7+
28
return (
3-
<>
4-
<div className="seq-table-wrap">
5-
<table className="seq-table">
6-
<thead>
7-
<tr>
8-
<th>Property</th>
9-
<th>Combinational</th>
10-
<th>Sequential</th>
9+
<div className="seq-table-wrap">
10+
<table className="seq-table">
11+
<thead>
12+
<tr>
13+
{headers.map((header, index) => (
14+
<th key={index}>{header}</th>
15+
))}
16+
</tr>
17+
</thead>
18+
<tbody>
19+
{rows.map((row, index) => (
20+
<tr key={index}>
21+
{keys.map((key, i) => (
22+
<td key={i}>{row[key]}</td>
23+
))}
1124
</tr>
12-
</thead>
13-
<tbody>
14-
<tr>
15-
<td>Output depends on</td>
16-
<td>Current inputs only</td>
17-
<td>Inputs + stored state</td>
18-
</tr>
19-
<tr>
20-
<td>Memory elements</td>
21-
<td>None</td>
22-
<td>Flip-flops / Latches</td>
23-
</tr>
24-
<tr>
25-
<td>Feedback paths</td>
26-
<td>No</td>
27-
<td>Yes</td>
28-
</tr>
29-
<tr>
30-
<td>Clock required</td>
31-
<td>No (usually)</td>
32-
<td>Yes (synchronous)</td>
33-
</tr>
34-
<tr>
35-
<td>Examples</td>
36-
<td>Adder, Mux, Decoder</td>
37-
<td>Counter, Register, FSM</td>
38-
</tr>
39-
</tbody>
40-
</table>
41-
</div>
42-
</>
25+
))}
26+
</tbody>
27+
</table>
28+
</div>
4329
);
4430
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// SeqTableData.js
2+
const SeqTableData = {
3+
sequentialcircuit: {
4+
headers: ["Property", "Combinational", "Sequential"],
5+
rows: [
6+
{
7+
property: "Output depends on",
8+
combinational: "Current inputs only",
9+
sequential: "Inputs + stored state",
10+
},
11+
{
12+
property: "Memory elements",
13+
combinational: "None",
14+
sequential: "Flip-flops / Latches",
15+
},
16+
{
17+
property: "Feedback paths",
18+
combinational: "No",
19+
sequential: "Yes",
20+
},
21+
{
22+
property: "Clock required",
23+
combinational: "No (usually)",
24+
sequential: "Yes (synchronous)",
25+
},
26+
{
27+
property: "Examples",
28+
combinational: "Adder, Mux, Decoder",
29+
sequential: "Counter, Register, FSM",
30+
},
31+
],
32+
},
33+
SRLatch: {
34+
headers: ["S", "R", "Q (next)", "Q̄ (next)", "Action"],
35+
rows: [
36+
{
37+
S: "0",
38+
R: "0",
39+
"Q (next)": "Q",
40+
"Q̄ (next)": "Q̄",
41+
Action: "No change (memory)",
42+
},
43+
{ S: "1", R: "0", "Q (next)": "1", "Q̄ (next)": "0", Action: "Set" },
44+
{ S: "0", R: "1", "Q (next)": "0", "Q̄ (next)": "1", Action: "Reset" },
45+
{
46+
S: "1",
47+
R: "1",
48+
"Q (next)": "?",
49+
"Q̄ (next)": "?",
50+
Action: "⚠ Forbidden",
51+
},
52+
],
53+
},
54+
};
55+
56+
export default SeqTableData;

0 commit comments

Comments
 (0)