WEBVTT

1
00:00:00.000 --> 00:00:03.040
Two sensors send four bits each.

2
00:00:03.920 --> 00:00:07.640
One sends fifteen and the other sends one.

3
00:00:08.540 --> 00:00:12.100
The full sum is sixteen and needs five
bits.

4
00:00:13.100 --> 00:00:18.540
With modulo sixteen, keep the low four
bits and report zero.

5
00:00:19.420 --> 00:00:22.660
The interface policy tells you which
result to expect.

6
00:00:23.220 --> 00:00:27.120
Zero extend both inputs before adding.

7
00:00:28.000 --> 00:00:35.060
At bit zero, one plus one writes zero and
sends a carry to the next column.

8
00:00:35.960 --> 00:00:38.660
That carry reaches the fifth bit.

9
00:00:39.600 --> 00:00:43.200
The full sum is one followed by four
zeros.

10
00:00:44.040 --> 00:00:49.200
A four bit destination can store only the
four zeros on the right.

11
00:00:49.660 --> 00:00:56.460
On the left, the addition inside braces
uses four bits and produces four zeros.

12
00:00:57.440 --> 00:01:00.980
The wider destination adds a zero above
them.

13
00:01:02.140 --> 00:01:06.180
On the right, each operand has already
been zero

14
00:01:06.180 --> 00:01:09.580
extended to five bits when the addition
runs.

15
00:01:10.380 --> 00:01:12.740
Now the result has room for the carry.

16
00:01:13.140 --> 00:01:19.820
The four bit offset is minus three,
written one one zero one.

17
00:01:20.660 --> 00:01:28.560
To preserve minus three at six bits, copy
the sign bit into the two new positions.

18
00:01:29.760 --> 00:01:34.280
Filling those positions with zeros gives
positive thirteen.

19
00:01:35.240 --> 00:01:41.380
The same four low bits produce different
values because the extension differs.

20
00:01:42.140 --> 00:01:45.812
Zero extend the unsigned sample, two.

21
00:01:46.440 --> 00:01:49.420
Sign extend the offset, minus three.

22
00:01:49.420 --> 00:01:55.900
Add both as signed six bit values to get
minus one, below zero.

23
00:01:55.900 --> 00:02:01.920
In the mixed expression, the offset is
extended as thirteen.

24
00:02:01.920 --> 00:02:06.520
The result becomes fifteen, and the below
zero test flips.

25
00:02:07.070 --> 00:02:12.250
A fixed right shift reconnects bits one
position to the right.

26
00:02:13.030 --> 00:02:18.710
The rightmost bit drops out and the vacant
left position takes the sign bit.

27
00:02:19.470 --> 00:02:23.310
Shifting signed minus three gives minus
two.

28
00:02:24.070 --> 00:02:29.630
Dividing minus three by two truncates
toward zero and gives minus one.

29
00:02:30.080 --> 00:02:31.580
Check two inputs.

30
00:02:32.480 --> 00:02:39.140
Fifteen plus one must give sixteen for
full precision and zero for modulo.

31
00:02:40.020 --> 00:02:44.580
Two plus minus three must compare below
zero.

32
00:02:45.440 --> 00:02:49.560
Use width warnings to trace any failure
back to the first

33
00:02:49.560 --> 00:02:54.180
step that drops a bit or fills the new
high bits incorrectly.

