2
\$\begingroup\$

I'm new to VHDL and I cannot seem to get my code to compile. I've looked over the code to the best of my ability, but I do not see anything wrong with it from my current basic understanding of how it works and I am wondering if anybody could help. The code is supposed to model a NLX1G99 configurable multi-function gate (minus the enable bit)

library ieee;
use ieee.std_logic_1164.all;
entity multifun_gate is
port(
 d,c,b,a: in std_logic;
 y: out std_logic
 );
end multifun_gate;
architecture dataflow of multifun_gate is
begin
 y <= (a and not b and not c and not d) or
 (a and b and not c and not d) or
 (not a and b and c and not d) or
 (a and b and c and not d) or
 (not a and not b and not c and d) or
 (not a and b and not c and d) or
 (not a and not b and c and d) or
 (and and not b and c and d);
end dataflow;
asked Feb 19, 2013 at 2:09
\$\endgroup\$
2
  • 2
    \$\begingroup\$ What are the errors? \$\endgroup\$ Commented Feb 19, 2013 at 9:41
  • 2
    \$\begingroup\$ This is a good example of total incomprehensible and undebugable code. Can't you write what you mean so that people can understand, and the synthesizer can create the gates? \$\endgroup\$ Commented Feb 19, 2013 at 12:21

2 Answers 2

3
\$\begingroup\$

In the second last line:

(and and not b and c and d);

you have and repeated.

answered Feb 19, 2013 at 2:11
\$\endgroup\$
2
  • \$\begingroup\$ Thanks, that got rid of one error, however, there are still others \$\endgroup\$ Commented Feb 19, 2013 at 2:13
  • \$\begingroup\$ nevermind, that did it. I meant to write "a and not b" rather than "and and not b" and I forgot to replace the and with a after fixing it. \$\endgroup\$ Commented Feb 19, 2013 at 2:17
1
\$\begingroup\$

Judging from the picture in the datasheet, I'd write:

sig1 <= a and not c;
sig2 <= b and c;
sig3 <= sig1 or sig2;
y <= d xor sig3;

Much easier to check I reckon.

answered Feb 19, 2013 at 14:03
\$\endgroup\$
2
  • \$\begingroup\$ I would've done that, but that's the way we were asked to do it. \$\endgroup\$ Commented Feb 25, 2013 at 15:14
  • \$\begingroup\$ @audiFanatic: ahh. Painful! I love it when people are "taught" to fight the tools :) \$\endgroup\$ Commented Feb 25, 2013 at 15:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.