Message from discussion
bcd-7segment decoder
Received: by 10.68.223.40 with SMTP id qr8mr4608088pbc.0.1339730105663;
Thu, 14 Jun 2012 20:15:05 -0700 (PDT)
Path: l9ni52126pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: KJ <kkjenni...@sbcglobal.net>
Newsgroups: comp.lang.vhdl
Subject: Re: bcd-7segment decoder
Date: Thu, 14 Jun 2012 20:15:05 -0700 (PDT)
Organization: http://groups.google.com
Lines: 52
Message-ID: <b49166d9-bbe5-4112-ac56-1d5864669000@googlegroups.com>
References: <6aff81ad-a99b-47e5-91aa-e651bd59f904@b21g2000yqn.googlegroups.com>
NNTP-Posting-Host: 99.184.242.197
Mime-Version: 1.0
X-Trace: posting.google.com 1339730105 27658 127.0.0.1 (15 Jun 2012 03:15:05 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 15 Jun 2012 03:15:05 +0000 (UTC)
In-Reply-To: <6aff81ad-a99b-47e5-91aa-e651bd59f904@b21g2000yqn.googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=99.184.242.197;
posting-account=TJOePQoAAADr-f6dDt_fMmacSJMCG-pd
User-Agent: G2/1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Thursday, June 14, 2012 8:19:31 PM UTC-4, Arthur Merlo wrote:
> 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
>=20
> LIBRARY ieee;
> USE ieee.std_logic_1164.all;
> ENTITY decod_7seg IS
> PORT (
> a : IN STD_LOGIC_VECTOR(17 DOWNTO 0);
> HEX0 : OUT STD_LOGIC_VECTOR(6 DOWNTO 0)
> );
> END decod_7seg;
> ARCHITECTURE behaviour OF decod_7seg IS
> BEGIN
>=20
>=20
> HEX0 <=3D "1000000";
> when a=3D"0000"
> else
> HEX0 <=3D "1111001";
> when a=3D"0001"
<snip>
> else
> HEX0 <=3D "0010000";
> when a=3D"1001"
>=20
>=20
The correct form is
HEX0 <=3D "1000000"
when a=3D"0000"=20
else=20
"1111001"
when a=3D"0001"=20
else=20
...
Also, if you're planning on turning this into hardware, you need to end the=
statement without the final condition like this...
"0000000" when a=3D"1000"=20
else "0010000"; -- when a=3D"1001"
Get rid of the last conditional check. If you don't you'll be defining som=
ething that gets implemented as a form of latch which in programmable devic=
es is generally a 'no-no'. Just from a logic perspective, ask yourself wha=
t should be the output if the input does not match any of the expected inpu=
ts? You have to output something, so choose it. That is the value to use =
on the final 'else' without any additional 'when a=3D ...' conditions.
Kevin Jennings