Download presentation
Presentation is loading. Please wait.
1
Virtual Wallet Design of BCD Binary Converters To create a handheld device which will save money and time through budget assistance and improve the shopping experience. Gates Winkler Jordan Samuel Fei Yin Shen October 19, 2009
2
Status Finished Flow Chart Behavioral Verilog Transistor Estimate Floor Plan Structure Proposal Structural Verilog Schematic To Do Layout Testing
3
Introduction Binary – Representing numbers on a “2” scale. –Ex. 19 = 10011 BCD – Representing numbers on a “10” scale using a “2” scale. –Each set of 4 bits stores 1 base 10 digit. Called a nibble. –Ex. 19 = 0001 1001 (2 nibbles) 0001 = 1; 1001 = 9
4
When Converting It is important to remember that though both are represented with 0 and 1s they will have different lengths when converted. BCD bit length will always be a multiple of 4 Number Number of Bits BinaryBCD 0-114 16-2058 100712 100001420 10e62028
5
Binary To BCD Algorithm Assumes the necessary number of bits to store the nibbles are all initialized to 0. Ex. Binary 51 = 110011 Needs 2 nibbles all set to 0 => 0000 0000
6
Step 1 – Check For >=5 Check all nibbles to see if any are >= 5. –0000 < 5 If none are >= do nothing.
7
Step 2 – Shift Left Shift all bits left shifting the MSB of the binary number into the LSB of the BCD number. Anything can be shifted in. Initial: 0000 0000 : 110011 After Shift: 0000 0001: 10011X
8
Step 3 – Repeat Repeat x times where x = length of binary number. 1 Run: 0000 0001: 10011X 2 Run: 0000 0011: 0011XX 3 Run: 0000 0110: 011XXX Wait… After 3 runs there is a nibble that that is >= 5.
9
Step 1b – Greater or Equal 5 If any nibbles are >= 5 then add 3 (0011) to that nibble. No nibble can ever be >9 so overflow is impossible. 0000 < 5 0110 >5 thus –0110 + 0011 = 1001 After adding continue with step 2 –Initial: 0000 0110: 011XXX –After Increasing Nibbles: 0000 1001: 011XXX –After Shift: 0001 0010: 11XXXX
10
Step 3 – Repeat (Again) Finish repeating. 4 Run: 0001 0010: 11XXXX 5 Run: 0010 0101: 1XXXXX 6 Run After Adding: 0010 1000: 1XXXXX –6 After Shifting: 0101 0001: XXXXXX Final answer: 51 0101 = 5 0001 = 1
11
BCD To Binary Algorithm Practically identical but reversed. Here are the changes. Step 1 Shift –Shifts right instead of left –LSB of BCD is shifted into MSB of Binary –Must Shift in 0s Step 2 Greater than/equal to 8 –Compares each BCD nibble to 8 instead. If less than do nothing. If greater than/equal subtract 3 from the nibble. Step 3 Repeat (again) Repeat x times where x = length of binary number.
12
Structural Binary To BCD –Needs 48 Flip Flops –7 4-bit adders (28 1-bit adders) –7 compare blocks. BCD To Binary –Needs 48 Flip Flops –7 4-bit subtracters (28 1-bit subtracters) –7 compare blocks.
13
Flip Flops – Output The Output Flip Flops can be regular Sequential Flip Flops.
14
Flip Flops – Input The Input Flip Flops will be parallel Flip-Flops which allows us to chose whether we want to shift or write. The nand gates allow for the flip flops to be written to on low write while it acts as a shifter on high write.
15
Compare to 5 Assumes 4 bit input B[3:0]. Use a Truth table to figure out block configuration
16
Binary – BCD 1 Nibble
17
Compare to 8 Easy, if Cin = 1 then the nibble will become 8 or greater. Don’t need a compare.
18
BCD – Binary 1 Nibble
19
Note In a BCD – Binary converter the BCD is the input. Thus the Flip Flops are actually the ones shown on slide 13. Binary Just Shifts without anything fancy. Just Needs respective Flip Flops.
20
Schematics Binary - BCD
21
BCD - Binary
22
Binary – BCD: Binary
23
Parallel Flip Flop
24
Flip Flop
25
Nand Block
26
Binary – BCD: BCD
27
Binary – BCD: 1 nibble
28
Compare to 5
29
BCD – Binary: Binary
30
BCD – Binary: BCD
31
BCD – Binary: BCD 1 nibble
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.