Download presentation
Presentation is loading. Please wait.
1
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp. 101-106
2
Shift and Add-3 Algorithm S1. Shift the binary number left one bit. 22. If 8 shifts have taken place, the BCD number is in the Hundreds, Tens, and Units column. 33. If the binary value in any of the BCD columns is 5 or greater, add 3 to that value in that BCD column. 44. Go to 1.
3
Steps to convert an 8-bit binary number to BCD
4
Example of converting hex E to BCD
5
Truth table for Add-3 Module C A3 A2 A1 A0 S3 S2 S1 S0
6
K-Map for S3 A3 A2 A1 A0 00011110 00 01 11 10 11 11 1 X S3 = A3 # A2 & A0 # A2 & A1 XXX X X
7
Binary-to-BCD Converter
8
Binary-to-BCD Converter
9
MODULE binbcd interface([B7..B0] -> [P9..P0]); TITLE 'binary-bcd converter' DECLARATIONS Cadd3 interface([A3..A0] -> [S3..S0]); C1 FUNCTIONAL_BLOCK Cadd3; C2 FUNCTIONAL_BLOCK Cadd3; C3 FUNCTIONAL_BLOCK Cadd3; C4 FUNCTIONAL_BLOCK Cadd3; C5 FUNCTIONAL_BLOCK Cadd3; C6 FUNCTIONAL_BLOCK Cadd3; C7 FUNCTIONAL_BLOCK Cadd3;
10
" INPUT PINS " B7..B0 PIN; B = [B7..B0]; " 8-bit binary input " OUTPUT PINS " P9..P0 PIN ISTYPE 'com'; P = [P9..P0]; " 10-bit BCD output
11
EQUATIONS C1.A3 = 0; C1.[A2..A0] = [B7..B5]; C2.[A3..A1] = C1.[S2..S0]; C2.A0 = B4; C3.[A3..A1] = C2.[S2..S0]; C3.A0 = ___; C4.[A3..A1] = ___________; C4.A0 = ___; C5.[A3..A1] = ___________; C5.A0 = ___; C6.A3 = ___; C6.A2 = ______; C6.A1 = ______; C6.A0 = ______; C7.[A3..A1] = ___________; C7.A0 = ______;
12
P9 = C6.S3; [P8..P5]= ___________; [P4..P1]= ___________; P0 = ___; @radix 16; test_vectors (B -> P) 0FF -> 255; 35 -> 53; 0B9 -> 185; 0D5 -> 213; 0E7 -> ____; 94 -> ____; 51 -> ____; END binbcd
13
6-Bit Binary-to-BCD Converter C1.A3 = 0; C1.[A2..A0] = [B5..B3]; C2.[A3..A1] = C1.[S2..S0]; C2.A0 = B2; C3.[A3..A1] = C2.[S2..S0]; C3.A0 = B1; P6 = C1.S3; P5 = C2.S3; [P4..P1]= C3.[S3..S0]; P0 = B0;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.