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;
-
2\$\begingroup\$ What are the errors? \$\endgroup\$Dean– Dean2013年02月19日 09:41:15 +00:00Commented 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\$Philippe– Philippe2013年02月19日 12:21:50 +00:00Commented Feb 19, 2013 at 12:21
2 Answers 2
In the second last line:
(and and not b and c and d);
you have and
repeated.
-
\$\begingroup\$ Thanks, that got rid of one error, however, there are still others \$\endgroup\$audiFanatic– audiFanatic2013年02月19日 02:13:49 +00:00Commented 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\$audiFanatic– audiFanatic2013年02月19日 02:17:59 +00:00Commented Feb 19, 2013 at 2:17
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.
-
\$\begingroup\$ I would've done that, but that's the way we were asked to do it. \$\endgroup\$audiFanatic– audiFanatic2013年02月25日 15:14:37 +00:00Commented Feb 25, 2013 at 15:14
-
\$\begingroup\$ @audiFanatic: ahh. Painful! I love it when people are "taught" to fight the tools :) \$\endgroup\$Martin Thompson– Martin Thompson2013年02月25日 15:35:19 +00:00Commented Feb 25, 2013 at 15:35