C
coderyogi
Guest
I've written a vhdl code in xilinx that generates an output waveform
based on the input clock. The problem i'm getting is that the code is
running only for the positive edge of the clock pulse whereas i've
coded it (i hope) to work for both positive as well as negative edges
of the clock pulse.
What i mean is that only that portion of the code is executing when
clock is = 1.
[code:1:afe1bf7e65]
entity sig_gen is
Port ( clk : in STD_LOGIC;
outp : out STD_LOGIC);
end sig_gen;
architecture Behavioral of sig_gen is
begin
process (clk)
variable temp1, temp2, temp3, temp4: integer:= 0;
begin
if (clk = '1') then
temp1 := temp1 + 1;
temp2 := temp2 + 1;
if (temp1 = 1 and temp2 = 1) then
outp <= '1';
elsif (temp2 = 3) then
temp1 := 0;
temp2 := 0;
temp3 := 0;
temp4 := 0;
outp <= '0';
else
outp <= '0';
end if;
else
temp3 := temp3 + 1;
temp4 := temp4 + 1;
if (temp3 = 2 and temp4 = 2) then
outp <= '1';
else
outp <= '0';
end if;
end if;
end process;
end Behavioral;
[/code:1:afe1bf7e65]
Any help would be appreciated...
based on the input clock. The problem i'm getting is that the code is
running only for the positive edge of the clock pulse whereas i've
coded it (i hope) to work for both positive as well as negative edges
of the clock pulse.
What i mean is that only that portion of the code is executing when
clock is = 1.
[code:1:afe1bf7e65]
entity sig_gen is
Port ( clk : in STD_LOGIC;
outp : out STD_LOGIC);
end sig_gen;
architecture Behavioral of sig_gen is
begin
process (clk)
variable temp1, temp2, temp3, temp4: integer:= 0;
begin
if (clk = '1') then
temp1 := temp1 + 1;
temp2 := temp2 + 1;
if (temp1 = 1 and temp2 = 1) then
outp <= '1';
elsif (temp2 = 3) then
temp1 := 0;
temp2 := 0;
temp3 := 0;
temp4 := 0;
outp <= '0';
else
outp <= '0';
end if;
else
temp3 := temp3 + 1;
temp4 := temp4 + 1;
if (temp3 = 2 and temp4 = 2) then
outp <= '1';
else
outp <= '0';
end if;
end if;
end process;
end Behavioral;
[/code:1:afe1bf7e65]
Any help would be appreciated...