Verilog Code for BCD to Seven Segment Decoder using Dataflow

BCD to Seven Segment Decoder:

Seven segment display is the most common device used for displaying digits and alphabet. The binary information can be displayed in the form of decimal using this Seven segment display. Seven segment display works, by glowing the required respective LEDS in the numeral. The display is controlled using pins that are left freely. In Binary Coded Decimal (BCD) encoding scheme each of the decimal numbers (0-9) is represented by its equivalent binary pattern (which is generally of 4-bits). Whereas, seven segment display is an electronic device which consists of seven Light Emitting Diodes (LEDs) arranged in some definite pattern, which is used to display decimal numbers( as input  BCD i.e., 0-9).  
Seven segment display does not work by directly supplying voltage to different segments of LEDs. First, our decimal number is changed to its BCD equivalent signal then BCD to seven segment decoder converts that signals to the form which is fed to seven segment display. This BCD to seven segment decoder has four input lines (A, B, C and D) and 7 output lines (a, b, c, d, e, f and g), this output is given to seven segment LED display which displays the decimal number depending upon inputs.

Verilog Code for BCD to Seven Segment Decoder using Dataflow:

module bcdtoseven(a,b,c,d,e,f,g,A,B,C,D); 
input A,B,C,D; 
output a,b,c,d,e,f,g; 
wire s1,s2,s3,s4; 
not n1(s1,A); 
not n2(s2,B); 
not n3(s3,C); 
not n4(s4,D); 
assign a=A|C|(B&D)|(s2&s4); 
assign b=s2|(C&D)|(s3&s4); 
assign c=B|(s2&s3)|(C&D); 
assign d=A|(c&s4)|(s2&s4)|(s2&c)|(B&s3&D); 
assign e=(C&s4)|(s2&s4); 
assign f=(s3&s4)|A|(B&s3)|(B&s4); 
assign g=A|(C&s4)|(B&s3)|(s2&C); 
endmodule 

OUTPUT:



Post a Comment

0 Comments