Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Asif Mahmud

2016-2-60-116
CSE345, SEC 03

Project Title : BCD to Excess-3 Code Generator

Submitted to:
Musharrat Khan
Senior Lecturer
Department of Computer Science &
Engineering
Problem Statement : BCD to Excess-3 Code Generator.
BCD is a 4-bit code and the conversion of 4 bit input BCD
code (A, B, C, D) into excess 3 code output is (W, X, Y, Z).

Truth Table :
K-map for each output:

K map for w
K map for X
K map for Y
K map for Z

Expression:
By analyzing each k map we can get four ( 4 )
expression for 4 output.

W = A + BC + BD
X = B’C + B’D + BC’D’
Y = CD + C’D’
Z = D’

Circuit diagram :
Verilog Code:

module try(BCD, EXC);


input [3:0] BCD;
output [3:0] EXC;

not(w1,BCD[3]);
not(w2,BCD[2]);
not(w3,BCD[1]);
not(w4,BCD[0]);

and(w5,w1,BCD[2],w3,BCD[0]);
and(w6,BCD[3],w2,BCD[1]);
and(w7,BCD[1],BCD[2]);
and(w8,BCD[3],w3);
or(EXC[3],w5,w6,w7,w8);
and(w9,w1,BCD[2],w3,w4);
and(w10,w2,w3,BCD[0]);
and(w11,w2,BCD[1]);
and(w12,BCD[3],BCD[2]);
or(EXC[2],w9,w10,w11,w12);

and(w13,w3,w4);
and(w14,BCD[1],BCD[0]);
or(EXC[1],w13,w14);

and(w15,BCD[1],w4);
or(EXC[0],w13,w15);

You might also like