decoder (bcd to 7segments)

#2717240
Does it work, if you make the last assignment unconditional? And, of 
course no semicolons between the elses.
1
...
2
else HEX0 <= "0000000" when a="1000"
3
else HEX0 <= "0010000"; --when a="1001"
Moderator (Company: Titel) #2717254
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:
1
...
2
else HEX0 <= "0000000" when a="1000"  --  8
3
else HEX0 <= "0010000" when a="1001"  --  9
4
else HEX0 <= "0111111";               --  -

Reply

A question of your own? This thread is over 14 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.