interige 发表于 2010-6-26 01:51:25

为什么VHDL程序总是出错?

本帖最后由 fpgaw 于 2010-7-16 10:28 编辑

我是刚开始学习VHDL语言,用的是Quartus II 4.0WEB版软件,我编写了很简单的一段程序却总是运行 Analysis & Synthesis时出错。请各位大虾指点:
源程序:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL

ENTITY and2 IS
    PORT (a : IN STD_LOGIC;
      b : IN STD_LOGIC;
      y : OUT STD_LOGIC);
END and2;

ARCHITECTURE behave OF and2 IS
BEGIN
    y <= a AND b;
END behave;
出错信息为:
Error: Verilog HDL syntax error at 11.vhd(4) near text "ENTITY";expecting "(", or "'", or "."
Error: VHDL error at 11.vhd(10): entity "and2" is used but not declared
Error: VHDL error at 11.vhd(12): object "y" is used but not declared
Info: Found 0 design units, including 0 entities, in source file 11.vhd
Error: Quartus II Analysis & Synthesis was unsuccessful. 3 errors, 0 warnings
    Error: Processing ended: Wed Mar 14 11:11:28 2007
    Error: Elapsed time: 00:00:05

usb 发表于 2010-6-26 03:06:13

抱歉,把VHDL写成了VHDA,在此声明

inter 发表于 2010-6-26 04:18:42

建议多看看书上的格式<br>
VHDL的格式是比较繁的

VVIC 发表于 2010-6-26 04:46:09

VHDL 的编译器使用说明吗

ngtim 发表于 2010-6-26 05:12:15

在这个USE ieee.std_logic_1164.ALL语句加个分号;

inter 发表于 2010-6-26 06:36:31

非常感谢大家给我的建议,5楼的看的很仔细,我加了&ldquo;;&rdquo;后,错误少了,就是有一个错误:<br>
Error: Top-level design entity "11" is undefined

ups 发表于 2010-6-26 07:35:52

我LZ一样也是用的QUARTUS WEB版,现在也在学习中

longt 发表于 2010-6-26 08:07:29

加上下面的库试一试,有时一个加号都得引库:<br>
USE&nbsp;&nbsp;IEEE.STD_LOGIC_ARITH.ALL;<br>
USE&nbsp;&nbsp;IEEE.STD_LOGIC_UNSIGNED.ALL;

interige 发表于 2010-6-26 08:49:31

原帖由 tyclr 于 2007-3-14 22:28 发表
       
        http://www.edacn.net/bbs/images/common/back.gif

<br>
非常感谢大家给我的建议,5楼的看的很仔细,我加了&ldquo;;&rdquo;后,错误少了,就是有一个错误:<br>
Error: Top-level design entity "11" is undefined 你在保存你的&nbsp;&nbsp;.vhd&nbsp;&nbsp;文件时没有保存为 and2.vhd,而是&nbsp;&nbsp;11.vhd&nbsp;&nbsp;。<br>
你把你的程序另存为&nbsp;&nbsp;and2.vhd就好了。

CHA 发表于 2010-6-26 09:26:04

应该在格式方面检查 初学者都是这样的吧
页: [1] 2
查看完整版本: 为什么VHDL程序总是出错?