180 likes | 307 Views
Java Programming assignment 1. Cheng-Chia Chen. ToDo works. 1. Implement FA1 ( 1-bit full adder) 2. Implement FA8 ( 8-bit full adder) 3. Implement FS1 (1-bit full subtractor ) 4. Implement FS8 (b-bit full subtractor ) 5. Implement Multiplier8 ( 8-bit x 8-bit multiplication)
E N D
Java Programming assignment 1 Cheng-Chia Chen
ToDo works 1. Implement FA1 ( 1-bit full adder) 2. Implement FA8 ( 8-bit full adder) 3. Implement FS1 (1-bit full subtractor ) 4. Implement FS8 (b-bit full subtractor ) 5. Implement Multiplier8 ( 8-bit x 8-bit multiplication) 6. Implement Divider8 (8-bit by 8-bit division + remainder)
0000 A0..A3 0000 A0..A3 0000 A0..A3 0000 A0..A3 B3 B0 B1 B2 FA4 FA4 FA4 DeMUX4 DeMUX4 DeMUX4 DeMUX4 Multiplier4 0 0 0 0 m7 m6 m5 m4 m1 m2 m0 m3
Subtracter • Subtracter circuits take two binary numbers as input and subtract one binary number input with other binary number input. • Similar to to adders it gives out two output, difference and borrow (Carry in the case of Adder). There are two types of subtracters. • Half Subtracter. • Full Subtracter.
Half Substractor IO relations: D = X (~Y) \/ (~X) Y Bout = (~X) Y
Full Subtractor • Symbol: • D = (X xor Y) xor Bin • Bout = X'.Y + X'.Bin + Y.Bin
Divider • How division is computed ? • Ex: 101101 / 000110 = ? | 000111 |-------------- 000110|zzzzz101101 -000110-- 0001010- -000110 0001001 -000110 000011 quotient remainder
A0..A3 / B1..B3 = Q0 ..Q3 -- R0 .. R3 1. T0 = zzzA0 2. if (T0 < B) => Q0 = 0; T1 = T0 A1; else => Q0 = 1; T1 = (T0-B) A1 ; 3. if (T1 < B) => Q1 = 0; T2 = T1 A2; else => Q1 = 1; T2 = (T1-B) A2 ; … if Tk < B => Qk = 0; Tk+1 = Tk Ak+1; else Qk = 1; Tk+1 = (Tk-B) Ak+1; if T3 < B => Q3 = 0; R4 = T3; else Q3 = 1; R4 = (T3-B); The rules for divider4
Tk B B 0000 < 0 Tk – B DeMUX Tk S Tk - S D0 Tk+1 Qk The building block M4 for divider4 Ak+1 Tk B
B[0:3] B[0:3] B[0:3] B[0:3] 000A0 A2 A1 A3 M4 M4 M4 M4 Divider4 X R0..R3 Q0 Q2 Q1 Q3
References: • http://www.asic-world.com/digital/arithmetic.html • http://bwrc.eecs.berkeley.edu/IcBook/slides.htm • chapter 11.