-------------------------------------------------------------------------------------------------100
|
-------------------------------------------------------------------------------------------------100
|
--| Modular Oscilloscope
|
--| Modular Oscilloscope
|
--| UNSL - Argentine
|
--| UNSL - Argentine
|
--|
|
--|
|
--| File: data_skipper.vhd
|
--| File: data_skipper.vhd
|
--| Version: 0.1
|
--| Version: 0.1
|
--| Tested in: Actel A3PE1500
|
--| Tested in: Actel A3PE1500
|
--|-------------------------------------------------------------------------------------------------
|
--|-------------------------------------------------------------------------------------------------
|
--| Description:
|
--| Description:
|
--| CONTROL - Data skipper
|
--| CONTROL - Data skipper
|
--| It generates an enable signal for write acquisitions in memory.
|
--| It generates an enable signal for write acquisitions in memory.
|
--|
|
--|
|
--|-------------------------------------------------------------------------------------------------
|
--|-------------------------------------------------------------------------------------------------
|
--| File history:
|
--| File history:
|
--| 0.1 | jul-2009 | First testing
|
--| 0.1 | jul-2009 | First testing
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
--| Copyright ® 2009, Facundo Aguilera.
|
--| Copyright © 2009, Facundo Aguilera.
|
--|
|
--|
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
--| modify it and/or implement it after contacting the author.
|
--| modify it and/or implement it after contacting the author.
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
--==================================================================================================
|
--==================================================================================================
|
-- TO DO
|
-- TO DO
|
-- · ...
|
-- · ...
|
--==================================================================================================
|
--==================================================================================================
|
|
|
|
|
|
|
|
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use IEEE.NUMERIC_STD.ALL;
|
use IEEE.NUMERIC_STD.ALL;
|
use ieee.math_real.all;
|
use ieee.math_real.all;
|
|
|
use work.ctrl_pkg.all;
|
use work.ctrl_pkg.all;
|
|
|
|
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
entity data_skipper is
|
entity data_skipper is
|
generic(
|
generic(
|
-- max losses = 2**(2**SELECTOR_WIDTH). (i.e., if SELECTOR_WIDTH = 5: 4.2950e+09)
|
-- max losses = 2**(2**SELECTOR_WIDTH). (i.e., if SELECTOR_WIDTH = 5: 4.2950e+09)
|
SELECTOR_WIDTH: integer := 5
|
SELECTOR_WIDTH: integer := 5
|
);
|
);
|
port(
|
port(
|
-- enable output signal
|
-- enable output signal
|
ack_O: out std_logic;
|
ack_O: out std_logic;
|
-- sinal from wishbone interface
|
-- sinal from wishbone interface
|
ack_I, stb_I: in std_logic;
|
ack_I, stb_I: in std_logic;
|
-- selector from register, equation: losses = 2**(selector_I + 1) * enable_skipper_I
|
-- selector from register, equation: losses = 2**(selector_I + 1) * enable_skipper_I
|
selector_I: in std_logic_vector(SELECTOR_WIDTH-1 downto 0);
|
selector_I: in std_logic_vector(SELECTOR_WIDTH-1 downto 0);
|
-- enable from register
|
-- enable from register
|
enable_skipper_I: in std_logic;
|
enable_skipper_I: in std_logic;
|
-- common signals
|
-- common signals
|
reset_I, clk_I: in std_logic
|
reset_I, clk_I: in std_logic
|
);
|
);
|
end entity data_skipper;
|
end entity data_skipper;
|
|
|
|
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
architecture ARCH10 of data_skipper is
|
architecture ARCH10 of data_skipper is
|
signal count: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
signal count: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
signal decoded: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
signal decoded: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
signal reset_count: std_logic;
|
signal reset_count: std_logic;
|
signal match: std_logic;
|
signal match: std_logic;
|
signal enable_count: std_logic;
|
signal enable_count: std_logic;
|
begin
|
begin
|
|
|
U_COUNTER0: generic_counter
|
U_COUNTER0: generic_counter
|
generic map(
|
generic map(
|
OUTPUT_WIDTH => integer(2**real(SELECTOR_WIDTH)) -- Output width for counter.
|
OUTPUT_WIDTH => integer(2**real(SELECTOR_WIDTH)) -- Output width for counter.
|
)
|
)
|
port map(
|
port map(
|
clk_I => clk_I,
|
clk_I => clk_I,
|
count_O => count,
|
count_O => count,
|
reset_I => reset_count,
|
reset_I => reset_count,
|
enable_I => enable_count
|
enable_I => enable_count
|
);
|
);
|
|
|
U_DECO0: generic_decoder
|
U_DECO0: generic_decoder
|
generic map(
|
generic map(
|
INPUT_WIDTH => SELECTOR_WIDTH
|
INPUT_WIDTH => SELECTOR_WIDTH
|
)
|
)
|
port map(
|
port map(
|
enable_I => enable_skipper_I,
|
enable_I => enable_skipper_I,
|
data_I => selector_I,
|
data_I => selector_I,
|
decoded_O => decoded
|
decoded_O => decoded
|
);
|
);
|
|
|
|
|
match <= '1' when decoded <= count else
|
match <= '1' when decoded <= count else
|
'0' ;
|
'0' ;
|
reset_count <= match or reset_I;
|
reset_count <= match or reset_I;
|
enable_count <= stb_I and ack_I and enable_skipper_I;
|
enable_count <= stb_I and ack_I and enable_skipper_I;
|
|
|
ack_O <= stb_I and ack_I and (match or not(enable_skipper_I)) and not(reset_I);
|
ack_O <= stb_I and ack_I and (match or not(enable_skipper_I)) and not(reset_I);
|
|
|
|
|