- 2073 Bhadra · 8 marks
Largest of four integers processor
Short answer
The algorithm initializes max = a, then sequentially compares b, c, d, updating max if larger. The datapath uses a 4:1 mux, comparator, and max register; the controller is a 6-state FSM with inputs start and gt, outputs sel, load, out_en.
Develop algorithm; draw the state diagram and design the datapath of a custom single purpose processor that determines the largest of four integers. Propose the block diagram of its controller also.
Assumption: four 8-bit integers a, b, c, d are available on input ports; the processor outputs the largest value when start is given.
Algorithm
max = a
if (b > max) max = b
if (c > max) max = c
if (d > max) max = d
output max
State diagram (FSMD)
S0 --start--> S1 (MAX=a) --> S2 (if b>MAX: MAX=b)
^ |
| v
S5 (out=MAX, done) <-- S4 (if d>MAX: MAX=d) <-- S3 (if c>MAX: MAX=c)
| State | Actions | Condition / next |
|---|---|---|
| S0 wait | done = 0 | start = 0: stay in S0; start = 1: S1 |
| S1 | MAX = a | S2 |
| S2 | if gt then MAX = b | S3 |
| S3 | if gt then MAX = c | S4 |
| S4 | if gt then MAX = d | S5 |
| S5 | out = MAX, done = 1 | S0 |
(gt = comparator output "selected input > MAX".)
Datapath
a --+
b --+--> [4:1 mux] --+--> [ > comparator ] --> gt
c --+ (sel 2b) | ^
d --+ | |
v |
[ MAX register ]-+
|
v
out
Components: a 4:1 multiplexer selecting the input (sel = 00 a, 01 b, 10 c, 11 d), an 8-bit comparator (selected input > MAX), an 8-bit register MAX with load enable (load = gt, or unconditional in S1), and an output buffer. Control signals: sel[1:0], load, out_en.
Controller block diagram
start, status flags --> +-------------+ +-----------+
(from datapath) | Next-state |-->| State |
| logic | | register |
+------^------+ +-----+-----+
| current state |
+-----------------+
v
+-------------+
| Output logic|--> control
+-------------+ signals
6 states, 3-bit state register. Output logic: S1: sel = 00, ld = 1; S2: sel = 01, ld = gt; S3: sel = 10, ld = gt; S4: sel = 11, ld = gt; S5: out_en = 1, done = 1. The controller's inputs are start and the status signal gt from the datapath.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Single-purpose processor for power · Embedded System, chapter 2 · asked 2×
- Fibonacci single-purpose processor · Embedded System, chapter 2 · asked 2×
- Factorial single-purpose processor · Embedded System, chapter 2
- Design LCM single-purpose processor · Embedded System, chapter 2
- Prime number checking processor · Embedded System, chapter 2
- GPP operation: datapath and controller · Embedded System, chapter 2 · asked 4×
- DMA controller block diagram and transfer · Computer Organization and Architecture, chapter 7 · asked 6×
- Derivative feedback controller: block diagram and effect · Control Systems, chapter 7 · asked 2×
- PID controller block diagram, transfer function, characteristics · Control Systems, chapter 7
- Algorithm and flowchart for largest · Computer Programming, chapter 2