Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

EED206 L2 Digital Electronics Spring2021

Experiment 2 Code Converters


Various codes are used to represent information, particularly numerical values.In this experiment, you
will become familiar with some of these codes, and learn how digital circuits are used to convert one
code to another. All the codes are expressed in terms of ‘0’s and ‘1’s, as explained below.
a. Binary Coded Decimal (BCD) code – Each of the 10 decimal digits is represented by 4 bits having
the value of the digit in binary number system, as listed below:
0 0000, 1  0001, 2  0010, 3 = 0011, 4  0100, 5  0101, 6  0110, 7  0111, 8  1000, 9  1001.
b. Thermometric Code – Any number is coded by the concatenation of‘1’s, the number of ‘1’s being
equal to the value of the number, as illustrated below for the decimal digits0-9coded by 9bits:
0 000000000, 1 000000001, 2 000000011, 3 00000 0111,4 000001111,
5 000011111,6 000111111, 7001111111, 80 1111 1111, 9  11111 1111.
c. 7-segment Code – This code is used very commonly to display decimal digits, as shown below.
The scopea of the Decimal 9
0 1 2 3 4 5 6 7 8
7-segment
f display
b digit
has g been Lighted a b c bc abd a b c bc acd acd a abc abc
e
extended cto Segments d e f eg dg fg fg efg b c de fg d f g
display the 16
d
Hexadecimal characters including A, b, C, d, E, F in addition to the decimal digits.
HEX digit A (1010) b (1011) C (1100) d(1101) E (1100) F (1111)
Lighted abc cd ad bcdeg ad a
Segments efg efg ef efg ef g
d. Priority Code – Priority coding represents the binary-coded numbers by the position of the most
significant ‘1’ bit among the non-zero bits, as shown below for 8-bit numbers coded to 3-bit plus a
VALID bit (the last bit on the right)╥:
Binary 0000000 0000001 001xxxx 01xxxxx
00000000 00001xx 00001xxx 0001xxxx 1xxxxxxx
Code 1 x x x
Priority
000 0 000 1 001 1 010 1 011 1 100 1 101 1 110 1 111 1
Code
1. Download the Verilog filesExp_02a.sv, Exp_02b.sv, Exp_02c.sv and Exp_02d.svfrom Blackboard (lab
support) and save them in theDigikit3.1 folder that you had created in the C Drive of your PC. These
Verilog files are simulations of the Code Converters corresponding to the codes described above:
(a) BCD to 10-line Decimal, (b) BCD to Thermometric Code, (c) Hexadecimal to 7-segment Code
and(d) Priority Encoder for 8-bit Binary numbers.
2. Open the PyveriInterfacefileyou had placed in the Digikit folder with Notepad and edit it to replace
the previous Verilog file name (Exp_01.sv) by Exp_02a.sv.Obtain the Truth Tableof theresultingCode
Converter by applying all the appropriate combinations of the inputsand verify its operation.
3. Repeat step 2 with the Verilog file Exp_02b.svas the “test” fileinPyveriInterface.
4. Repeat step 2 with the Verilog file Exp_02c.svas the “test” fileinPyveri Interface.Sketch the 7-
segment displays for the 16 different values of the 4-bit inputaccording to the lighted segments.
5. Repeat step 2 with the Verilog file Exp_02d.svas the “test” fileinPyveri Interface.

You might also like