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