集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1149|回复: 0

为啥这程序波形实现不了辨向,求解释啊

[复制链接]
xiasitai 发表于 2011-10-10 22:38:49 | 显示全部楼层 |阅读模式
本帖最后由 xiasitai 于 2011-10-10 22:43 编辑

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity time4 is
port(a:in std_logic;
     b:in std_logic;
          clk:in std_logic;
          pp: out std_logic;
          np: out std_logic);
end time4;

architecture Behavioral of time4 is
signal prestate,state: std_logic_vector(1 downto 0);
signal snp,spp:std_logic;
begin
process(a,b,clk)
begin
if(clk'event and clk='1')then
state<=a&b;
if state="00" then
case prestate is
when "01"=>prestate<="00";spp<='1';
when "10"=>prestate<="00";snp<='1';
when others=>prestate<="00";spp<='0';snp<='0';
end case;
elsif state="10" then
case prestate is
when "00"=>prestate<="10";spp<='1';
when "11"=>prestate<="10";snp<='1';
when others=>prestate<="10";spp<='0';snp<='0';
end case;
elsif state="11" then
case prestate is
when "10"=>prestate<="11";spp<='1';
when "01"=>prestate<="11";snp<='1';
when others=>prestate<="11";spp<='0';snp<='0';
end case;
else
case prestate is
when "11"=>prestate<="01";spp<='1';
when "00"=>prestate<="01";snp<='1';
when others=>prestate<="01";spp<='0';snp<='0';
end case;
end if;
end if;
end process;
pp<=spp;
np<=snp;
end Behavioral;
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-4-29 13:45 , Processed in 0.086026 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表