سلام. من برای انجام یک پروژه نیاز به پیاده سازی یک مولتی ویبراتور مونواستابل با یک پالس تریگر هستیم بصورتی که وقتی لبه بالارونده تریگر به مدار اعمال شود خروجی یک شود و مدت 6 میکروثانیه یک بماند و سپس صفر شود. برای این منظور از پالس کلاک 80mhz استفاده کردیم و روی cpld xc95144xl پیاده سازی کردیم. این کد را با isim شبیه سازی کردیم و اوکی است منتها روی برد پیاده سازی نمی شود و خروجی نوسانی است. کد نوشته شده بصورت زیر است:
[left]در این مورد کسی از دوستان تجربه ایی دارد؟
[left]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity monoVHDL is
Port ( Trig : in STD_LOGIC;
Q : out STD_LOGIC;
Qnot : out STD_LOGIC;
clk : in STD_LOGIC);
end monoVHDL;
architecture Behavioral of monoVHDL is
type sreg0_type is(s0,s1,s2,s3);
signal sreg0:sreg0_type;
-----------------------------clk=80mhz => time unit:12.5nsec-----------------------------
constant pulsWith: integer range 0 to 580:=480;
----------------------------------------------------------
signal Cntr:integer range 0 to pulsWith:=0;
begin
process(clk)
begin
if(rising_edge(clk)) then
---------------------------------------------------------------------------------
if(Cntr>0) then
Cntr<=Cntr-1;
end if;
case sreg0 is
when s0 =>
if(Trig='0'
then
sreg0<=s0;
else
sreg0<=s1;
end if;
when s1 => --rising_edge
Cntr<=pulsWith;
if(Trig='0'
then
sreg0<=s3;
else
sreg0<=s2;
end if;
when s2 =>
if(Trig='0'
then
sreg0<=s3;
else
sreg0<=s2;
end if;
when s3 => --falling_edge
if(Trig='0'
then
sreg0<=s0;
else
sreg0<=s1;
end if;
when others =>
null;
-----------------
end case;
-----------------
end if;
-----------------------------------------------------------------------------
end process;
Q<='1' when(Cntr>0) else --output pulse delayed 1 cyclr(20nsec) acording to input CLK
'0';
Qnot<='0' when(Cntr>0) else --output pulse delayed 1 cyclr(20nsec) acording to input CLK
'1';
end Behavioral;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity monoVHDL is
Port ( Trig : in STD_LOGIC;
Q : out STD_LOGIC;
Qnot : out STD_LOGIC;
clk : in STD_LOGIC);
end monoVHDL;
architecture Behavioral of monoVHDL is
type sreg0_type is(s0,s1,s2,s3);
signal sreg0:sreg0_type;
-----------------------------clk=80mhz => time unit:12.5nsec-----------------------------
constant pulsWith: integer range 0 to 580:=480;
----------------------------------------------------------
signal Cntr:integer range 0 to pulsWith:=0;
begin
process(clk)
begin
if(rising_edge(clk)) then
---------------------------------------------------------------------------------
if(Cntr>0) then
Cntr<=Cntr-1;
end if;
case sreg0 is
when s0 =>
if(Trig='0'

sreg0<=s0;
else
sreg0<=s1;
end if;
when s1 => --rising_edge
Cntr<=pulsWith;
if(Trig='0'

sreg0<=s3;
else
sreg0<=s2;
end if;
when s2 =>
if(Trig='0'

sreg0<=s3;
else
sreg0<=s2;
end if;
when s3 => --falling_edge
if(Trig='0'

sreg0<=s0;
else
sreg0<=s1;
end if;
when others =>
null;
-----------------
end case;
-----------------
end if;
-----------------------------------------------------------------------------
end process;
Q<='1' when(Cntr>0) else --output pulse delayed 1 cyclr(20nsec) acording to input CLK
'0';
Qnot<='0' when(Cntr>0) else --output pulse delayed 1 cyclr(20nsec) acording to input CLK
'1';
end Behavioral;