| 1 |
32 |
budinero |
-------------------------------------------------------------------------------------------------100
|
| 2 |
|
|
--| Modular Oscilloscope
|
| 3 |
|
|
--| UNSL - Argentine
|
| 4 |
|
|
--|
|
| 5 |
37 |
budinero |
--| File: ctrl_data_skipper.vhd
|
| 6 |
|
|
--| Version: 0.12
|
| 7 |
32 |
budinero |
--| Tested in: Actel A3PE1500
|
| 8 |
37 |
budinero |
--| Board: RVI Prototype Board + LP Data Conversion Daughter Board
|
| 9 |
32 |
budinero |
--|-------------------------------------------------------------------------------------------------
|
| 10 |
|
|
--| Description:
|
| 11 |
|
|
--| CONTROL - Data skipper
|
| 12 |
|
|
--| It generates an enable signal for write acquisitions in memory.
|
| 13 |
|
|
--|
|
| 14 |
|
|
--|-------------------------------------------------------------------------------------------------
|
| 15 |
|
|
--| File history:
|
| 16 |
|
|
--| 0.1 | jul-2009 | First testing
|
| 17 |
37 |
budinero |
--| 0.11 | jul-2009 | Added input signal indicating when it's selected the first channel
|
| 18 |
|
|
--| 0.12 | jul-2009 | Optimized
|
| 19 |
32 |
budinero |
----------------------------------------------------------------------------------------------------
|
| 20 |
33 |
budinero |
--| Copyright © 2009, Facundo Aguilera.
|
| 21 |
32 |
budinero |
--|
|
| 22 |
|
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
| 23 |
|
|
--| modify it and/or implement it after contacting the author.
|
| 24 |
|
|
----------------------------------------------------------------------------------------------------
|
| 25 |
|
|
|
| 26 |
|
|
|
| 27 |
|
|
--==================================================================================================
|
| 28 |
|
|
-- TO DO
|
| 29 |
|
|
-- · ...
|
| 30 |
|
|
--==================================================================================================
|
| 31 |
|
|
|
| 32 |
|
|
|
| 33 |
|
|
|
| 34 |
|
|
|
| 35 |
|
|
|
| 36 |
|
|
library ieee;
|
| 37 |
|
|
use ieee.std_logic_1164.all;
|
| 38 |
|
|
use IEEE.NUMERIC_STD.ALL;
|
| 39 |
|
|
use ieee.math_real.all;
|
| 40 |
|
|
|
| 41 |
|
|
use work.ctrl_pkg.all;
|
| 42 |
|
|
|
| 43 |
|
|
|
| 44 |
|
|
----------------------------------------------------------------------------------------------------
|
| 45 |
|
|
----------------------------------------------------------------------------------------------------
|
| 46 |
37 |
budinero |
entity ctrl_data_skipper is
|
| 47 |
32 |
budinero |
generic(
|
| 48 |
|
|
-- max losses = 2**(2**SELECTOR_WIDTH). (i.e., if SELECTOR_WIDTH = 5: 4.2950e+09)
|
| 49 |
|
|
SELECTOR_WIDTH: integer := 5
|
| 50 |
|
|
);
|
| 51 |
|
|
port(
|
| 52 |
|
|
-- enable output signal
|
| 53 |
|
|
ack_O: out std_logic;
|
| 54 |
|
|
-- sinal from wishbone interface
|
| 55 |
|
|
ack_I, stb_I: in std_logic;
|
| 56 |
|
|
-- selector from register, equation: losses = 2**(selector_I + 1) * enable_skipper_I
|
| 57 |
|
|
selector_I: in std_logic_vector(SELECTOR_WIDTH-1 downto 0);
|
| 58 |
|
|
-- enable from register
|
| 59 |
|
|
enable_skipper_I: in std_logic;
|
| 60 |
|
|
-- common signals
|
| 61 |
37 |
budinero |
reset_I, clk_I: in std_logic;
|
| 62 |
|
|
|
| 63 |
|
|
first_channel_I: in std_logic
|
| 64 |
32 |
budinero |
);
|
| 65 |
37 |
budinero |
end ctrl_entity data_skipper;
|
| 66 |
32 |
budinero |
|
| 67 |
|
|
|
| 68 |
|
|
----------------------------------------------------------------------------------------------------
|
| 69 |
|
|
----------------------------------------------------------------------------------------------------
|
| 70 |
37 |
budinero |
architecture ARCH10 of ctrl_data_skipper is
|
| 71 |
32 |
budinero |
signal count: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
| 72 |
|
|
signal decoded: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
| 73 |
37 |
budinero |
signal anded: std_logic_vector( integer(2**real(SELECTOR_WIDTH))-1 downto 0);
|
| 74 |
32 |
budinero |
signal reset_count: std_logic;
|
| 75 |
|
|
signal match: std_logic;
|
| 76 |
|
|
signal enable_count: std_logic;
|
| 77 |
37 |
budinero |
|
| 78 |
32 |
budinero |
begin
|
| 79 |
|
|
|
| 80 |
|
|
U_COUNTER0: generic_counter
|
| 81 |
|
|
generic map(
|
| 82 |
|
|
OUTPUT_WIDTH => integer(2**real(SELECTOR_WIDTH)) -- Output width for counter.
|
| 83 |
|
|
)
|
| 84 |
|
|
port map(
|
| 85 |
|
|
clk_I => clk_I,
|
| 86 |
|
|
count_O => count,
|
| 87 |
|
|
reset_I => reset_count,
|
| 88 |
|
|
enable_I => enable_count
|
| 89 |
|
|
);
|
| 90 |
|
|
|
| 91 |
|
|
U_DECO0: generic_decoder
|
| 92 |
|
|
generic map(
|
| 93 |
|
|
INPUT_WIDTH => SELECTOR_WIDTH
|
| 94 |
|
|
)
|
| 95 |
|
|
port map(
|
| 96 |
|
|
enable_I => enable_skipper_I,
|
| 97 |
|
|
data_I => selector_I,
|
| 98 |
|
|
decoded_O => decoded
|
| 99 |
|
|
);
|
| 100 |
|
|
|
| 101 |
37 |
budinero |
anded <= decoded and count;
|
| 102 |
|
|
match <= '1' when anded = std_logic_vector(to_unsigned(0,integer(2**real(SELECTOR_WIDTH)))) else
|
| 103 |
32 |
budinero |
'0' ;
|
| 104 |
37 |
budinero |
|
| 105 |
|
|
reset_count <= reset_I;
|
| 106 |
|
|
enable_count <= stb_I and ack_I and enable_skipper_I and first_channel_I;
|
| 107 |
32 |
budinero |
|
| 108 |
|
|
ack_O <= stb_I and ack_I and (match or not(enable_skipper_I)) and not(reset_I);
|
| 109 |
|
|
|
| 110 |
|
|
end architecture;
|