新手求答案:仿真和最后实现的现象不一样 急!
本帖最后由 li054755 于 2011-2-18 09:05 编辑我在用CPLD 时 打算在某一信号的上升沿另一信号有某个动作 可是现在在该信号的下降沿到来时另一信号也有同样动作但是在仿真时 没有这种情况 仿真时 是符合我的目的的
请问 为什么 如何解决???????????????
PS: 我用的是XILINX 的 CPLDVHDL 语言 ! 把程序发上来让大家看看啊 好 初学 见笑了: entity new823572 is
PORT( clk2,wr,clk1 ,start: INSTD_LOGIC;
din : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
g1,g2,g3:out std_logic );
end new823572;
architecture Behavioral of new823572 is
signalcount : integer range 0 to 4096 ; -- 取得数值164000--
signalmt1,mt2,mt3: integer RANGE 0 TO 1000:=0;
signalsen1,sen2,sen3 :std_logic :='0' ;
signalsenb1,senb2,senb3:std_logic :='0';
begin
p0: process(wr)
begin
if (wr'EVENT) and (wr ='0') then
count <= conv_integer(din)-1;
end if;
end process p0;
x: process(clk1)
variable clkcount1 : integer range 0 to 6:=0;
begin
if (clk1'EVENT) and (clk1 ='1') then
--if(start='0') then
clkcount1 :=clkcount1+1;
if(clkcount1=1) then
senb1<='1';
senb2<='0';
elsif(clkcount1=3)then
senb2<='1';
senb3<='0';
elsif(clkcount1=5)then
senb3<='1';
senb1<='0';
elsif(clkcount1=6)then
clkcount1:=0;
end if;
-- else
-- senb1<='0';
-- senb2<='0';
-- senb3<='0';
-- clkcount1:=0;
-- end if ;
end if;
end process x;
p1: process(clk2)
begin
if (clk2'EVENT) and (clk2 = '1') then
--if(start='0') then
if (senb1='1') and (sen1='0')then
if(mt1=count) then
mt1<=0;
g1<='1';
sen1<='1';
sen2<='0';
else
-- g1<='0';
mt1<=mt1+1;
end if ;
else
g1<='0';
end if;
if (senb2='1') and (sen2='0') then
if(mt2=count) then
mt2<=0;
g2<='1';
sen2<='1';
sen3<='0';
else
-- g2<='0';
mt2<=mt2+1;
end if ;
else
g2<='0' ;
end if;
if (senb3='1') and (sen3='0')then
if(mt3=count) then
mt3<=0;
g3<='1';
sen3<='1';
sen1<='0';
else
-- g3<='0';
mt3<=mt3+1;
end if ;
else
g3<='0';
end if;
-- else
-- mt1<=0;
-- mt2<=0;
-- mt3<=0;
-- sen1<='0';
-- sen2<='1';
-- sen3<='1';
--end if ;
end if ;
end process p1;
end Behavioral;
我的本意如上图 在CLK1 的第一个上升沿 到来延时一段时间后 g1 有一个脉冲但是现在仿真是对的 但是实际 在CLK1的下降沿 也出现了脉冲 仿真 如上图 可是实际不是这样 下降沿也出现了脉冲
页:
[1]