OpenCores
URL https://opencores.org/ocsvn/gpib_controller/gpib_controller/trunk

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib_helper/] [EdgeDetector.vhd] - Diff between revs 3 and 13

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 13
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
 
--This file is part of fpga_gpib_controller.
 
--
 
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
 
-- it under the terms of the GNU General Public License as published by
 
-- the Free Software Foundation, either version 3 of the License, or
 
-- (at your option) any later version.
 
--
 
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
 
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
-- GNU General Public License for more details.
 
 
 
-- You should have received a copy of the GNU General Public License
 
-- along with Fpga_gpib_controller.  If not, see <http://www.gnu.org/licenses/>.
 
--------------------------------------------------------------------------------
-- Entity: EdgeDetector
-- Entity: EdgeDetector
-- Date:2011-11-25  
-- Date:2011-11-25  
-- Author: Administrator     
-- Author: Andrzej Paluch
--
--
-- Description ${cursor}
-- Description ${cursor}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
 
 
use work.helperComponents.all;
use work.helperComponents.all;
 
 
entity EdgeDetector is
entity EdgeDetector is
        generic (
        generic (
                RISING : std_logic := '1';
                RISING : std_logic := '1';
                FALLING : std_logic := '0';
                FALLING : std_logic := '0';
                PULSE_WIDTH : integer := 10
                PULSE_WIDTH : integer := 10
        );
        );
 
 
        port (
        port (
                reset : in std_logic;
                reset : in std_logic;
                clk : in std_logic;
                clk : in std_logic;
                in_data : in std_logic;
                in_data : in std_logic;
                pulse : out std_logic
                pulse : out std_logic
        );
        );
end EdgeDetector;
end EdgeDetector;
 
 
architecture arch of EdgeDetector is
architecture arch of EdgeDetector is
 
 
        signal t_i, t_o : std_logic;
        signal t_i, t_o : std_logic;
        signal lastData : std_logic;
        signal lastData : std_logic;
 
 
begin
begin
 
 
        process(reset, clk, t_o, in_data) begin
        process(reset, clk, t_o, in_data) begin
                if reset = '1' then
                if reset = '1' then
                        t_i <= t_o;
                        t_i <= t_o;
                        lastData <= in_data;
                        lastData <= in_data;
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        if lastData /= in_data then
                        if lastData /= in_data then
                                if RISING='1' and lastData='0' and in_data='1' then
                                if RISING='1' and lastData='0' and in_data='1' then
                                        t_i <= not t_o;
                                        t_i <= not t_o;
                                end if;
                                end if;
 
 
                                if FALLING='1' and lastData='1' and in_data='0' then
                                if FALLING='1' and lastData='1' and in_data='0' then
                                        t_i <= not t_o;
                                        t_i <= not t_o;
                                end if;
                                end if;
                        end if;
                        end if;
                        lastData <= in_data;
                        lastData <= in_data;
                end if;
                end if;
        end process;
        end process;
 
 
        spg: SinglePulseGenerator generic map (WIDTH => PULSE_WIDTH) port map (
        spg: SinglePulseGenerator generic map (WIDTH => PULSE_WIDTH) port map (
                reset => reset, clk => clk, t_in => t_i, t_out => t_o, pulse => pulse
                reset => reset, clk => clk, t_in => t_i, t_out => t_o, pulse => pulse
        );
        );
 
 
end arch;
end arch;
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.