- #1
HD555
- 27
- 0
Hi, I have a small piece of code that will detect a rising edge and output a pulse for 2 clock cycles. I'm only doing this for simulation purposes and will not be porting this into a FPGA.
When using the after 10 ns after a statement, I know this is ignored during sythesis. How can I implement a delay and have it be shown on the testbench waveform?
Thanks. I'm using Xilinx's ISE WebPACK Software. Code is below.
When using the after 10 ns after a statement, I know this is ignored during sythesis. How can I implement a delay and have it be shown on the testbench waveform?
Thanks. I'm using Xilinx's ISE WebPACK Software. Code is below.
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rising_edge_detector_2ms is
Port (
clk : in STD_LOGIC;
signal_input : in STD_LOGIC;
out1, out2 : out STD_LOGIC;
output : out STD_LOGIC
);
end rising_edge_detector_2ms;
architecture Behavioral of rising_edge_detector_2ms is
signal Q_FF, Q1_FF, Q2_FF : STD_LOGIC;
begin
process(clk)
begin
if rising_edge(clk) then
Q_FF <= signal_input after 20 ns;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
Q1_FF <= Q_FF after 20 ns;
end if;
end process;
process(clk)
begin
if rising_edge(clk) then
Q2_FF <= Q1_FF after 20 ns;
end if;
end process;
-- Final Output Through AND Gate
out1 <= Q1_FF;
out2 <= Q2_FF;
output <= (not Q2_FF) and signal_input;
end Behavioral;