deepthi.reddy.912
Newbie level 5
Hi,
My input clock is of period 100 with 50% duty cylce. I have two T-Flipflops. Each has outputs Q1 and Q2 respectively.I would like to add a delay of 8.144ns to Q1 and 10.386ns to Q2.
so that Q3<=Q1+8.144ns;
and Q4<=Q2+10.386ns;
and I would like to generata an enable so that en<=Q3 xor Q4;
I managed to write the code and it is being simulated but with small error.
The enable is becoming high at certain intervals and ignoring next 2 levels of unequal outputs of Q3 and Q4. Then for another 2 levels it is 1.
Please check and correct the code ASAP. Pleaseeeeeeeee
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity controlckt is
port(clk: in std_logic;
en : out std_logic := '0');
end controlckt;
architecture arch1 of controlckt is
signal Q1,Q2,Q3,Q4 : std_logic := '0';
signal t: std_logic := '1';
begin
process(clk)
BEGIN
if (clk = '1' and clk'event) then
Q1<= (t and (not Q1)) or ((not t) and Q1);
end if;
if (clk = '1' and clk'event) then
Q2<= (t and (not Q2)) or ((not t) and Q2);
end if;
end process;
process
begin
wait for 8.144 ns; --dmin delay
Q3 <= Q2;
wait for 10.836 ns; --dmax delay
Q4 <= Q1;
en<= Q3 xor Q4;
end process;
end arch1;
Thankyou.
My input clock is of period 100 with 50% duty cylce. I have two T-Flipflops. Each has outputs Q1 and Q2 respectively.I would like to add a delay of 8.144ns to Q1 and 10.386ns to Q2.
so that Q3<=Q1+8.144ns;
and Q4<=Q2+10.386ns;
and I would like to generata an enable so that en<=Q3 xor Q4;
I managed to write the code and it is being simulated but with small error.
The enable is becoming high at certain intervals and ignoring next 2 levels of unequal outputs of Q3 and Q4. Then for another 2 levels it is 1.
Please check and correct the code ASAP. Pleaseeeeeeeee
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity controlckt is
port(clk: in std_logic;
en : out std_logic := '0');
end controlckt;
architecture arch1 of controlckt is
signal Q1,Q2,Q3,Q4 : std_logic := '0';
signal t: std_logic := '1';
begin
process(clk)
BEGIN
if (clk = '1' and clk'event) then
Q1<= (t and (not Q1)) or ((not t) and Q1);
end if;
if (clk = '1' and clk'event) then
Q2<= (t and (not Q2)) or ((not t) and Q2);
end if;
end process;
process
begin
wait for 8.144 ns; --dmin delay
Q3 <= Q2;
wait for 10.836 ns; --dmax delay
Q4 <= Q1;
en<= Q3 xor Q4;
end process;
end arch1;
Thankyou.