EmbDev.net

Forum: FPGA, VHDL & Verilog decoder (bcd to 7segments)


Author: bonildo (Guest)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hi guys, I'm new in VHDL and would be glad if anyone could help me with 
my bcd-7segments decoder. I dont know why its not compiling

Author: P. K. (pek)
Posted on:

Rate this post
0 useful
not useful
Does it work, if you make the last assignment unconditional? And, of 
course no semicolons between the elses.
...
else HEX0 <= "0000000" when a="1000"
else HEX0 <= "0010000"; --when a="1001"

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
bonildo wrote:
> I dont know why its not compiling
What error message do you get?

Peter K. wrote:
> And, of course no semicolons between the elses.
I also assume the semicolons to be the problem.

> Does it work, if you make the last assignment unconditional?
Thats not the actual problem, but not doing this will cause the 
synthesizer to generate a latch, because only 10 out of the 6561 
possible values of a 4 bit std_logic_vector are used (4 digit with each 
9 values {UX01ZWLH-} = 9*9*9*9 = 6561). This vast amount of values is of 
interest mainly for simulation, but also in real hardware a 4 bit vector 
can have 16 values, and therefore there must be a kind of "memory" for 
the "last valid" value, if a is greater than 9.

I would change the code so, that if there is a input value greater than 
9 a "-" is displayed:
...
else HEX0 <= "0000000" when a="1000"  --  8
else HEX0 <= "0010000" when a="1001"  --  9
else HEX0 <= "0111111";               --  -

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.