国产精品免费无遮挡无码永久视频-国产高潮视频在线观看-精品久久国产字幕高潮-国产精品99精品无码视亚

電子工程網

標題: 程序錯誤,求助 [打印本頁]

作者: 淼森    時間: 2011-10-12 15:52
標題: 程序錯誤,求助
六十進制計數器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity counter_60 is
        port(clk,bcd1wr,bcd10wr,cin:in std_logic;
                 co: out std_logic;
                 datain: in std_logic_vector(3 downto 0);
                 bcd1: out std_logic_vector(3 downto 0);
                 bcd10: out std_logic_vector(2 downto 0));
end counter_60;

architecture rtl of counter_60 is
signal bcd1n:std_logic_vector(3 downto 0);
signal bcd10n:std_logic_vector(2 downto 0);
begin
        bcd1<=bcd1n;
        bcd10<=bcd10n;
        process(clk,bcd1wr,datain) is
        begin
                if(bcd1wr='1') then
                        bcd1n<=datain;
                elsif(clk'event and clk='1') then
                        if(cin='1') then
                                if(bcd1n=9) then
                                        bcd1n<="0000";
                                else
                                        bcd1n<=bcd1n+'1';
                                end if;
                        end if;
                end if;
        end process;
        
        process(clk,bcd10wr,datain) is
        begin
                if(bcd10wr='1') then
                        bcd10n<=datain(2 downto 0);
                elsif(clk'event and clk='1') then
                        if(cin='1' and bcd1n=9) then
                                if(bcd10n=5) then
                                        bcd10n<="000";
                                else
                                        bcd10n<=bcd10n+'1';
                                end if;
                        end if;
                end if;
        end process;
        
        process(bcd10n,bcd1n,cin) is
        begin
                if((cin='1') and (bcd1n=9) and (bcd10n=5)) then
                        co<='1';
                else
                        co<='0';
                end if;
        end process;
end rtl;
可以編譯,但是仿真不合適,仿真不計數,請各位老師同仁指正,萬分感謝
作者: penpen    時間: 2011-10-13 20:13
可能你這個程序應該是沒有初始化初始值吧,
作者: uacom    時間: 2011-10-19 14:01
請檢查你的程序邏輯是否有誤?
作者: zhulinxy123    時間: 2011-11-2 13:54
仿真時,輸入信號定義時要給初始值




歡迎光臨 電子工程網 (http://www.4huy16.com/) Powered by Discuz! X3.4