TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops adders and arithm... half-adder a... ripple-carry... BCD adder carry-select... CLA adder (8... CLA adder (1... CLA generator CLA adder block CLA adder, slow adder/subtra... 7485 comparator 7485 comparator 74181 ALU de... 74181 ALU ci... 74181+74182 ... 74182 CLA ge... Hamming-weight Hamming-weig... integer mult... square calcu... square root ... carry-save a... CSA based mu... counters LFSR and selftest memories programmable logic state-machine editor misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... Intel MCS4 (i4004) image processing ... [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | Binary Adder/Subtractor (4 bit)
Circuit Description
A four-bit adder/subtractor demonstration.
While it is perfectly possible to design a custom circuit
for the subtraction operation,
it is much more common to re-use an existing adder and
to replace a subtraction by a two-complement's addition.
The applet shows how this is done. Click the input switches or type the 's' bindkey to control the Sub/nAdd switch, and '1' .. '8' to control the A and B inputs. When the Sub/nAdd input is low (0), the XOR-gates act as non-inverting buffers, and the carry-input to the adder is 0. Therefore, the adder calculates a four-bit sum plus carry-out: (Cout,S3,S2,S1,S0) = (A3,A2,A1,A0) + (B3,B2,B1,B0) If the Sub/nAdd input is high (1), the XOR-gates act as inverting buffers, and the carry-input to the adder is 1. (Cout,S3,S2,S1,S0) = (A3,A2,A1,A0) - (B3,B2,B1,B0) | |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/20-arithmetic/40-addsub/add-sub.html |