BCD to 7-segment decoder?? what correct result

Thread Starter

noor22

Joined Oct 11, 2012
19
hi everyone :)

i made same project on this thread but with differnce code my code like this :p
http://forum.allaboutcircuits.com/showthread.php?t=30141

Rich (BB code):
module Seven_Seg_Display_V2001 (
output  [0: 6] Display,
input [3: 0] BCD
);
// abc_defg
parameter BLANK = 7'b000_0000;
parameter ZERO = 7'b111_1110; // h7e
parameter ONE = 7'b011_0000; // h30
parameter TWO = 7'b110_1101; // h6d
parameter THREE = 7'b111_1001; // h79
parameter FOUR = 7'b011_0011; // h33
parameter FIVE = 7'b101_1011; // h5b
parameter SIX = 7'b101_1111; // h5f
parameter SEVEN = 7'b111_0000; // h70
parameter EIGHT = 7'b111_1111; // h7f
parameter NINE = 7'b111_1011; // h7b
/*always @ (BCD)
case (BCD)
0: Display = ZERO;
1: Display = ONE;
2: Display = TWO;
3: Display = THREE;
4: Display = FOUR;
5: Display = FIVE;
6: Display = SIX;
7: Display = SEVEN;
8: Display = EIGHT;
9: Display = NINE;
default: Display = BLANK;
endcase*/
endmodule
module t_Seven_Seg_Display_V2001 ();
wire [6: 0] Display;
reg [3: 0] BCD;
parameter BLANK = 7'b000_0000;
parameter ZERO = 7'b111_1110; // h7e
parameter ONE = 7'b011_0000; // h30
parameter TWO = 7'b110_1101; // h6d
parameter THREE = 7'b111_1001; // h79
parameter FOUR = 7'b011_0011; // h33
parameter FIVE = 7'b101_1011; // h5b
parameter SIX = 7'b001_1111; // h1f
parameter SEVEN = 7'b111_0000; // h70
parameter EIGHT = 7'b111_1111; // h7f
parameter NINE = 7'b111_1011; // h7b
initial #120 $finish;
initial fork
#10 BCD = 0;
#20 BCD = 1;
#30 BCD = 2;
#40 BCD = 3;
#50 BCD = 4;
#60 BCD = 5;
#70 BCD = 6;
#80 BCD = 7;
#90 BCD = 8;
#100 BCD = 9;
join
Seven_Seg_Display_V2001 M0 (Display, BCD);

initial begin
$monitor("  BLANK=%b, ZERO=%b,ONE=%b,TWO=%b, THREE=%b,FOUR=%b,FIVE=%b, SIX=%b,SEVEN=%b, EIGHT=%b,NINE=%b",BLANK,ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE);
end
endmodule

Here is the result of the simulation
[/url][/IMG]
http://im33.gulfup.com/LbmSF.png

i want to check it is correct or not :confused::(
can u tell me if it not correct answer what is the right answer?
i hope to get any reply before 24 hour bec. it must be sumitted twm.:mad:

thankx
w8 w8 w8
 

WBahn

Joined Mar 31, 2012
30,077
Since this is homework, it really should be in the Homework Help section.

Also, you need to show what work YOU have done to solve YOUR homework problem. We won't just do it for you.

What is preventing you from being able to determine whether your code is producing the correct results?
 

Thread Starter

noor22

Joined Oct 11, 2012
19
thank u for reply,:)
bec. this is first time to use verilog
i do not study it before but my teacher requirement to do it by using verilog:confused:
 

Thread Starter

noor22

Joined Oct 11, 2012
19
it convert bcd to 7 segment
4 binry input 7 decoder output than it show on 7 segment like decimal number
0,1,2,3,4,5,6,7,8,9

+-a-+
f b
|-g-|
e c
+-d-+
 

WBahn

Joined Mar 31, 2012
30,077
Well, how are WE supposed to know how YOUR simulation is supposed to show something?

If we came to you and said that we were putting together a simulation to test whether a BCD-to-7SEG encoder was working properly, what signals would YOU tell US should be in the simulation?
 

Thread Starter

noor22

Joined Oct 11, 2012
19
it show decimal nu. from 0 to 9
each signal one line
--0
----1
-------2
---------3
-------------4
----------------5
---------------------6
so on
^^
 

WBahn

Joined Mar 31, 2012
30,077
Do you have ten different signals?

You have a 4-bit input (the BCD value) and a 7-bit output (the signals to the 7SEG display).

Let's call the bits of the input V[3:0] wher V[3] is the msb and V[0] is the lsb.

Let's call the bits of the output Y[6:0] where Y[6] is the 'g' segment and Y[0] is the 'a' segment.

For the decoder you are trying to implement, is the output HI or LO for a segment that is supposed to be lit?

Can you prepare a truth table for what your input/output relationships should be?

DEC||V[3]|V[2]|V[1]|V[0]||g|f|e|d|c|b|a
0|||||||||||||
1|||||||||||||
2|||||||||||||
3|||||||||||||
4|||||||||||||
5|||||||||||||
6|||||||||||||
7|||||||||||||
8|||||||||||||
9|||||||||||||
 

Thread Starter

noor22

Joined Oct 11, 2012
19
it must change this part of my code ?



$monitor(" BLANK=%b, ZERO=%b,ONE=%b,TWO=%b, THREE=%b,FOUR=%b,FIVE=%b, SIX=%b,SEVEN=%b, EIGHT=%b,NINE=%b",BLANK,ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE
 

WBahn

Joined Mar 31, 2012
30,077
How can we possibly tell you how to set up your simulation when we don't even know what simulator you are using? There are dozens of simulators out there. If you tell us exactly which simulation environment you are using, then MAYBE someone here might be familiar with it. But you best bet is to go through the tutorials that usually come with the simulator for Getting Started. They usually aren't very thorough, but should cover the basics that you need for this.
 
Top