recoba7 发表于 2010-12-2 11:53:32

VHDL 问题

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity counter_1024 is
        port(datain : in std_logic_vector(7 downto 0);
                        clk, clr, en, updn, bcdwr : in std_logic;
                        dataout : out std_logic_vector(7 downto 0) := "00000000";
                        c : out std_logic := '0');
end counter_1024;

architecture beh of counter_1024 is
begin
        process(clk, en)--, clr, bcdwr, updn)
                --variable data : std_logic_vector(8 downto 0) := "000000000";
        begin
                if (en = '1' ) then
                        c <= '1';
                        dataout(7 downto 0) <= "00000000";
                       
                --else c <='0';
                end if;
        end process;
end;       

可时序分析图中似乎不符合if语句,恳请请各位高手指教啊!谢谢

dyeleven 发表于 2010-12-2 12:20:19

回复 1# recoba7


    你程序中没有标明en=0的情况,系统默认在输出加了一个锁存器

weibode01 发表于 2010-12-2 12:25:44

好深奥的VHDL,Verilog好学,呵

recoba7 发表于 2010-12-2 15:37:57

难怪我加了个else语句后能恢复正常。追问下,我初始化c为0,可前面en=0的那一部分c怎么不为0啊?

recoba7 发表于 2010-12-2 15:40:17

刚开始学这语言,先基本弄懂吧,呵呵

nonghero 发表于 2010-12-5 20:09:59

CLK都没用,怎么可能仿真正确。

recoba7 发表于 2010-12-6 10:11:17

看清楚再说。。。

nonghero 发表于 2010-12-6 23:11:14

process(clk, en)--, clr, bcdwr, updn)
                --variable data : std_logic_vector(8 downto 0) := "000000000";
      begin
                if (en = '1' ) then
                        c <= '1';
                        dataout(7 downto 0) <= "00000000";
                     
                --else c <='0';
                end if;
      end process;

楼上的CLK在哪里用到了,请指明。CLK为什么会出现在敏感表中。你的程序太深奥了,难怪我看不懂。

yanxin85085 发表于 2010-12-13 23:25:55

clk没用到啊,还有,现在产生了锁存器,电平敏感。

zhangxiaoshen 发表于 2010-12-13 23:28:36

好深奥的VHDL,Verilog好学,呵
页: [1]
查看完整版本: VHDL 问题