Build a four-bit adder and find two different boundary conditions in its output. First add 0111 + 0001. Then add 1111 + 0001. Read the five output pins in each case and interpret the four sum bits both as an unsigned number and as a signed number. The same wiring supports both interpretations.
The Texas Instruments CD74HC283E is an integrated circuit (IC), a set of electronic devices fabricated on one chip. It adds two four-bit words and a carry input. A bit is one binary digit, represented here by a settled low or high voltage. A word groups four bits with weights 1, 2, 4 and 8. Five light-emitting diodes (LEDs) make the output visible. A digital multimeter (DMM) supplies the voltage observations used by the worksheet checker.
For unsigned arithmetic, each word represents 0 through 15. With carry input CIN equal to either 0 or 1, the mathematical total is at most 31. The sum pins S3 through S0 keep the low four bits. COUT carries the weight 16.
T = A + B + CIN
S = T mod 16
COUT = floor(T / 16)
T = 16 × COUT + S
For signed arithmetic, use two’s complement, an encoding in which words 0 through 7 represent 0 through +7 and words 8 through 15 represent −8 through −1. Decode a word by subtracting 16 when its most significant bit, bit 3, is high. Thus 0111 means +7 and 1111 means −1.
Signed overflow means the mathematical signed total falls outside −8 through +7. Compute it from the measured input and sum signs. When both input sign bits agree and the sum sign differs, overflow is present. This sign rule also handles the extra positive unit from CIN. COUT is a physical output at pin 9. The checker derives signed overflow from the observed words.
| A + B | S | COUT | Signed overflow |
|---|---|---|---|
| 1 + 0 | 0001 | 0 | 0 |
| 7 + 1 | 1000 | 0 | 1 |
| 15 + 1 | 0000 | 1 | 0 |
| 8 + 8 | 0000 | 1 | 1 |
In signed terms, the second row adds +7 and +1. Its mathematical +8 exceeds the signed range, and the retained word decodes as −8. The third row adds −1 and +1, producing zero. The fourth adds −8 and −8, whose mathematical −16 also exceeds the signed range. All entries in this table are calculated predictions.
This fixture uses TI CD74HC283E in the 16-pin plastic dual in-line package (PDIP), TI package N. The E ordering suffix selects this through-hole package. Read the top view with the notch at the top, pin 1 at the upper left and pin numbers running counterclockwise. The drawing below shows functional nets with pin numbers, while the manufacturer drawing defines the physical package orientation.
TI’s current main sheet is SCHS176E, revised July 2022. The HC family uses high-speed complementary metal-oxide-semiconductor logic. Its recommended supply range is 2 to 6 V. This experiment uses 4.50 V to match the sheet’s 4.5 V input and loaded-output conditions. At that supply, specified input low and high boundaries are 1.35 V and 3.15 V. The worksheet adopts narrower acceptance regions to leave measurement margin. The HCT family uses different input thresholds and requires its own design review.
At 4.5 V and 25 °C, the sheet specifies output high of at least 3.98 V at −4 mA and output low of at most 0.26 V at +4 mA. Every output here has its own 4.7 kΩ resistor and red LED to G0, the common zero-volt reference. With the supply at the worksheet’s 4.53 V upper bound and a 1% low resistor, even a zero-volt LED approximation bounds the branch at 0.974 mA. A red LED with an illustrative 2 V forward drop gives roughly 0.53 mA. Visibility at that small current depends on the actual LED and ambient light.
Nine 2.2 kΩ pull-down resistors define every input when its contact is open. Closing a contact connects its node to +4.50 V. With all nine closed, their worst-case total at 4.53 V and −1% resistance is 18.72 mA. Five worst-case LED branches add less than 4.87 mA. Set the supply current limit to 50 mA and require constant-voltage operation throughout. The resistor power bounds are below 10 mW each. MRS25 resistors have ample rating margin under their documented 0.6 W rating at 70 °C under the documented mounting conditions.
The data sheet’s supply absolute maximum of 7 V, output-current limits and package-current limits describe stress boundaries. Keep operation inside the recommended supply and the stated loaded-output conditions. Use the exact package, defined inputs and short supply decoupling path for this build.

Before connecting any input or output cables, connect the RIGOL DHO804's rear Ground Terminal to earth ground using the supplied ground cable, as required by the DHO800 User Guide. Its Type-C power input does not ground the instrument through the power cord. Use the supplied power adapter. Keep the SPD3303X's protective earth connected. The probe ground clips and any signal cable shields share G0 as described below; they do not replace this required chassis earth lead.
Use one CD74HC283E, nine 2.2 kΩ ±1% resistors, five 4.7 kΩ ±1% resistors, five Kingbright WP7113ID red LEDs, one nonpolar 100 nF capacitor and nine short make/open contacts. Vishay MKT1820410015 is a 100 nF ±10% film capacitor suitable for the bypass shown. Keep its connection directly between supply pins 16 and 8. Short soldered wiring or a compact inspected prototype keeps input capacitance and return paths controlled.
| Weight | A pin | B pin |
|---|---|---|
| 1, bit 0 | 5 | 6 |
| 2, bit 1 | 3 | 2 |
| 4, bit 2 | 14 | 15 |
| 8, bit 3 | 12 | 11 |
| Pin | Connection |
|---|---|
| 16, 8 | VCC to +4.50 V, GND to G0. Bypass directly with 100 nF. |
| 7 | CIN input. Use the ninth pull-down and high contact. |
| 4, 1, 13, 10 | S0, S1, S2, S3. Each drives its own 4.7 kΩ resistor, then the LED anode. |
| 9 | COUT. Use the fifth separate resistor and LED. |
| LED cathodes | G0. Confirm the package cathode mark against Kingbright’s drawing. |
Configure SIGLENT SPD3303X channel 1 in independent mode at 4.50 V and 50 mA, initially output off. Use channel 1 negative as G0 and positive as the named rail. Check wiring and LED polarity with power off. Set the Fluke 87V MAX to direct-current (DC) voltage, 6 V range, with its red lead in the voltage jack and black lead in COM. Keep COM on G0 and move only the insulated red probe between named pins. The instrument’s 1 mV resolution and specified voltage accuracy are small relative to the worksheet’s logic margins.
Inspect input edge shape before collecting the arithmetic rows. TI recommends input rise and fall times no longer than 500 ns at 4.5 V. A 2.2 kΩ resistor and the chip’s 10 pF maximum input capacitance alone give an illustrative 10–90% resistance–capacitance (RC) transition of about 48 ns, using 2.2 × R × C. Actual contact wiring and a probe add capacitance. A RIGOL DHO804 with a PVP2350 in 10× mode can check each input route against the recommendation. Put its ground spring on G0, use DC coupling and verify actual time scale and transition shape. Inspect both directions, including reopening the contact. Contact bounce and slow transitions are separate effects. Establish clean bounded edges with short wiring before proceeding, and keep intentional RC debounce components out of these HC input nodes.
cv=1 only after confirming that state. Current-limit operation gives cv=0 and an unresolved worksheet.clear row, record VCC, all nine input pin voltages and all five output pin voltages. Leave the state unchanged while taking these fifteen readings. The worksheet uses volts throughout.restore by returning all contacts open and re-reading every pin. Keep the supply, output loads, meter reference and wiring intact across the sequence. This return checks for a loose connection or a changed low-level state.| Case | A | B | CIN |
|---|---|---|---|
| clear | 0 | 0 | 0 |
| a-low | 1 | 0 | 0 |
| a-weight | 4 | 0 | 0 |
| b-low | 0 | 1 | 0 |
| b-weight | 0 | 8 | 0 |
| overflow | 7 | 1 | 0 |
| carry | 15 | 1 | 0 |
| both | 8 | 8 | 0 |
| opposite-sign | 8 | 7 | 0 |
| cin-overflow | 7 | 0 | 1 |
| cin-carry | 15 | 0 | 1 |
| cin-cancel | 8 | 7 | 1 |
| restore | 0 | 0 | 0 |
The case names label observations, including deliberate boundary cases. A sequence of static voltage readings supports settled truth-table checks. Transition delays, hazards and contact bounce require their own time-domain acquisition. The CD74HC283 uses lookahead carry internally. The independent software test’s ripple-carry oracle is a mathematical cross-check of the result.
The checker accepts low levels up to 0.50 V, input high levels from 3.60 V and output high levels from 3.70 V. Intermediate readings produce UNRESOLVED. It also requires every pin within −0.05 V through measured VCC + 0.05 V, each supply reading within 4.47–4.53 V and total supply spread at most 0.04 V. First-to-last differences must be at most 0.25 V for every recorded pin. These are declared fixture screens with a 1 nV computational rounding allowance, separate from instrument uncertainty and manufacturer limits.
After decoding the actual input pins, the program checks that they match the intended case. It then computes the expected sum and carry independently of the measured outputs. The signed result comes from the observed sum word, and signed overflow comes from the observed input and output sign bits. An entered input-encoding mismatch, uncertain voltage or incorrect result prevents the final success message. The thirteen cases sample the physical truth table. Exhaustive arithmetic coverage belongs to the separate host test.
Run the full worksheet checker with Python 3.10 or newer. The experiment archive contains the program, tests, blank worksheet, circuit contract, editable diagram, PNG and a clearly labeled synthetic example. Each file can also be inspected from this article.
python3 adder_flags.py observations.csv
python3 -m unittest -v test_adder_flags.py
python3 adder_flags.py synthetic/example.csv
Exit 0 qualifies all thirteen entered cases. Exit 1 reports an unresolved electrical or arithmetic screen. Exit 2 reports malformed input or command usage. A complete worksheet produces one line for each case and a final success line after all checks. Inspect the first failing case and its pin voltages before changing wiring with the supply output off.
"""Check settled CD74HC283E pin voltages and distinguish carry from signed overflow."""
import argparse
import csv
import math
from dataclasses import dataclass
from pathlib import Path
CASES = (
("clear", 0, 0, 0),
("a-low", 1, 0, 0),
("a-weight", 4, 0, 0),
("b-low", 0, 1, 0),
("b-weight", 0, 8, 0),
("overflow", 7, 1, 0),
("carry", 15, 1, 0),
("both", 8, 8, 0),
("opposite-sign", 8, 7, 0),
("cin-overflow", 7, 0, 1),
("cin-carry", 15, 0, 1),
("cin-cancel", 8, 7, 1),
("restore", 0, 0, 0),
)
INPUTS = ("a0_v", "a1_v", "a2_v", "a3_v",
"b0_v", "b1_v", "b2_v", "b3_v", "cin_v")
OUTPUTS = ("s0_v", "s1_v", "s2_v", "s3_v", "cout_v")
HEADER = ("case", "vcc_v", *INPUTS, *OUTPUTS, "cv")
ROUNDING = 1e-9
class BadInput(ValueError):
pass
class Unresolved(ValueError):
pass
@dataclass(frozen=True)
class Addition:
word: int
carry: int
overflow: bool
signed_total: int
def signed4(word):
return word if word < 8 else word - 16
def add(a, b, cin):
total = a + b + cin
signed_total = signed4(a) + signed4(b) + cin
return Addition(total & 15, total >> 4,
not -8 <= signed_total <= 7, signed_total)
def bounded(value, low, high, label):
if not low - ROUNDING <= value <= high + ROUNDING:
raise Unresolved(f"{label} is {value:.6g}; expected {low:g}–{high:g}")
return value
def decode(voltage, name, supply, output):
if voltage < -.05 - ROUNDING or voltage > supply + .05 + ROUNDING:
raise Unresolved(f"{name} is outside rail allowance")
high_limit = 3.70 if output else 3.60
if voltage <= .50 + ROUNDING:
return 0
if voltage >= high_limit - ROUNDING:
return 1
raise Unresolved(f"{name} is between the declared low/high limits")
def word(bits):
return sum(value << index for index, value in enumerate(bits))
def read_worksheet(path):
try:
if path.stat().st_size > 24000:
raise BadInput("worksheet exceeds the 24000-byte limit")
with path.open(encoding="utf-8-sig", newline="") as file:
reader = csv.reader(file, strict=True)
if tuple(next(reader, ())) != HEADER:
raise BadInput("header must be " + ",".join(HEADER))
records = list(reader)
except (OSError, UnicodeError, csv.Error) as error:
raise BadInput(str(error)) from error
if len(records) != len(CASES):
raise BadInput("expected 13 case rows in the supplied sequence")
rows = []
for record, (name, _, _, _) in zip(records, CASES):
if len(record) != len(HEADER) or record[0] != name:
raise BadInput("case sequence or column count does not match the template")
try:
values = tuple(float(value) for value in record[1:-1])
except ValueError as error:
raise BadInput(f"{name}: expected numeric pin readings") from error
if not all(map(math.isfinite, values)):
raise BadInput(f"{name}: pin readings must be finite")
if record[-1] not in ("0", "1"):
raise BadInput(f"{name}: cv must be 0 or 1")
rows.append((name, values, record[-1]))
return rows
def verify(name, values, cv, intended):
if cv != "1":
raise Unresolved("source must stay in constant voltage while reading")
supply, *pins = values
bounded(supply, 4.47, 4.53, "supply (V)")
input_bits = [
decode(v, label, supply, False) for v, label in zip(pins[:9], INPUTS)
]
observed = word(input_bits[:4]), word(input_bits[4:8]), input_bits[8]
if observed != intended:
raise Unresolved(f"input pins encode {observed}; intended case is {intended}")
output_bits = [
decode(v, label, supply, True) for v, label in zip(pins[9:], OUTPUTS)
]
actual_sum, actual_carry = word(output_bits[:4]), output_bits[4]
expected = add(*observed)
if actual_sum != expected.word:
raise Unresolved(f"sum output is {actual_sum:04b}; expected {expected.word:04b}")
if actual_carry != expected.carry:
raise Unresolved(f"carry output is {actual_carry}; expected {expected.carry}")
# Infer signed overflow from measured signs, rather than a nonexistent output pin.
a, b, cin = observed
overflow = bool(((~(a ^ b) & (a ^ actual_sum)) >> 3) & 1)
if overflow != expected.overflow:
raise Unresolved("observed signs disagree with signed arithmetic")
return observed, actual_sum, actual_carry, overflow, expected.signed_total
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("worksheet", type=Path, help="13 settled measured-voltage rows")
args = parser.parse_args()
try:
rows = read_worksheet(args.worksheet)
checked = []
for (name, values, cv), (_, a, b, cin) in zip(rows, CASES):
try:
checked.append((name, *verify(name, values, cv, (a, b, cin))))
except Unresolved as error:
raise Unresolved(f"{name}: {error}") from error
supplies = [row[1][0] for row in rows]
bounded(max(supplies) - min(supplies), 0, .04, "supply spread (V)")
for label, initial, final in zip(("vcc_v", *INPUTS, *OUTPUTS),
rows[0][1], rows[-1][1]):
bounded(abs(initial - final), 0, .25, "restored " + label + " difference (V)")
except BadInput as error:
parser.exit(2, f"INPUT: {error}\n")
except Unresolved as error:
parser.exit(1, f"UNRESOLVED: {error}\n")
for name, (a, b, cin), result, carry, overflow, signed_total in checked:
print(f"{name:13} | unsigned {a} + {b} + {cin} = {a+b+cin} | "
f"S={result:04b} C={carry} | signed {signed4(a)} + {signed4(b)} + {cin} = {signed_total} | "
f"decoded S={signed4(result)} | carry={carry} overflow={int(overflow)}")
combinations = {(entry[3], entry[4]) for entry in checked}
if len(combinations) != 4:
parser.exit(1, "UNRESOLVED: intended flag combinations were not covered\n")
print("PASS: measured pin states match the adder, including all four carry/overflow combinations.")
return 0
if __name__ == "__main__":
raise SystemExit(main())
In a copy of the synthetic example, change the a0_v reading in the overflow row from its high value to 0.02 V. The program should reject the physical input encoding. Restore that value, then change cout_v in the carry row to 0.02 V. This should reject the carry output. An input reading of 2 V exercises the uncertainty screen. Keep these altered files separate from measurements.
The host tests enumerate all 512 combinations of A, B and CIN using a separate bitwise full-adder oracle. Every combination also passes through the voltage decoder and result verifier with constructed pin voltages. Additional tests cover wrong measured bits, undefined levels, rail and CV limits, restoration, malformed rows and inclusive voltage boundaries. This is host validation of arithmetic and parsing. The supplied synthetic CSV contains constructed voltages, and the blank worksheet awaits the reader’s hardware observations.
Set A = 0110, B = 0001 and CIN = 1. Predict the four output bits, COUT and signed overflow.
Answer. The unsigned total is 6 + 1 + 1 = 8, so S = 1000 and COUT = 0. The mathematical signed total is also +8, beyond +7. Signed overflow is 1 and the retained word decodes as −8.
A wider unsigned adder can use COUT as the next stage’s CIN. Signed arithmetic still needs a range-overflow decision for the chosen word width. This fixture suits static teaching and small logic experiments. A design requiring arithmetic status flags, clocked results or debounced user controls needs explicit circuitry for those tasks and a timing review.
The CD74HC85 magnitude-comparator experiment explores ordering two binary words and defining cascade inputs. The SN74HC86 parity experiment uses an exclusive-OR network to check bit parity. Together they make useful comparisons between arithmetic, ordering and bit checking.