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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [ctrl/] [output_manager.vhd] - Blame information for rev 54

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 budinero
-------------------------------------------------------------------------------------------------100
2
--| Modular Oscilloscope
3
--| UNSL - Argentine
4
--|
5 37 budinero
--| File: ctrl_output_manager.vhd
6 54 budinero
--| Version: 0.54
7 28 budinero
--| Tested in: Actel A3PE1500
8 37 budinero
--|   Board: RVI Prototype Board + LP Data Conversion Daughter Board
9 28 budinero
--|-------------------------------------------------------------------------------------------------
10
--| Description:
11
--|   CONTROL - Output manager
12 35 budinero
--|   Reads a memory incrementaly under certain parameters.
13 28 budinero
--|   
14
--|-------------------------------------------------------------------------------------------------
15
--| File history:
16
--|   0.1   | jun-2009 | First testing
17
--|   0.2   | jul-2009 | Two levels internal buffer
18
--|   0.3   | jul-2009 | One level internal buffer and only one clock
19 33 budinero
--|   0.31  | jul-2009 | Internal WE signals
20 35 budinero
--|   0.5   | jul-2009 | Architecture completely renovated (reduced)
21 54 budinero
--|   0.54  | aug-2009 | New finish_O and init flag behavior
22 28 budinero
----------------------------------------------------------------------------------------------------
23 33 budinero
--| Copyright © 2009, Facundo Aguilera.
24 28 budinero
--|
25
--| This VHDL design file is an open design; you can redistribute it and/or
26
--| modify it and/or implement it after contacting the author.
27
----------------------------------------------------------------------------------------------------
28
 
29 33 budinero
 
30
--==================================================================================================
31 37 budinero
-- TO DO
32 54 budinero
-- NO Speed up address_counter
33
-- OK Full test of new architecture
34
-- OK Fix default value of s_finish signal 
35
-- ·  General speed up
36 33 budinero
--==================================================================================================
37 28 budinero
 
38
 
39
library ieee;
40
use ieee.std_logic_1164.all;
41
use IEEE.STD_LOGIC_UNSIGNED.ALL;
42
use IEEE.NUMERIC_STD.ALL;
43
 
44
 
45
 
46
----------------------------------------------------------------------------------------------------
47
----------------------------------------------------------------------------------------------------
48 37 budinero
entity ctrl_output_manager is
49 28 budinero
  generic(
50 33 budinero
    MEM_ADD_WIDTH: integer :=  14
51 28 budinero
  );
52
  port(
53
    ------------------------------------------------------------------------------------------------
54
    -- MASTER (to memory) 
55
    DAT_I_mem: in std_logic_vector (15 downto 0);
56
    --DAT_O_mem: out std_logic_vector (15 downto 0);
57
    ADR_O_mem: out std_logic_vector (MEM_ADD_WIDTH - 1  downto 0);
58
    CYC_O_mem: out std_logic;
59
    STB_O_mem: out std_logic;
60
    ACK_I_mem: in std_logic ;
61
    WE_O_mem:  out std_logic;
62
 
63
    ------------------------------------------------------------------------------------------------
64
    -- SLAVE (to I/O ports) 
65
    --DAT_I_port: in std_logic_vector (15 downto 0);
66
    DAT_O_port: out std_logic_vector (15 downto 0);
67
    --ADR_I_port: in std_logic_vector (7 downto 0); 
68
    CYC_I_port: in std_logic;
69
    STB_I_port: in std_logic;
70
    ACK_O_port: out std_logic ;
71
    WE_I_port:  in std_logic;
72
 
73
 
74
    ------------------------------------------------------------------------------------------------
75
    -- Common signals 
76
    RST_I: in std_logic;
77
    CLK_I: in std_logic;
78
 
79
    ------------------------------------------------------------------------------------------------
80
    -- Internal
81 35 budinero
 
82
    load_I:             in std_logic;
83
    -- load initial address
84
 
85
    enable_I:           in std_logic;
86
    -- continue reading from the actual address ('0' means pause, '1' means continue)
87
 
88
    initial_address_I:  in std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
89 28 budinero
    -- buffer starts and ends here 
90 35 budinero
 
91 37 budinero
    biggest_address_I:  in std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
92 35 budinero
    -- when the buffer arrives here, address is changed to 0 (buffer size)
93
 
94 37 budinero
    pause_address_I:    in std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
95 28 budinero
    -- address wich is being writed by control
96 35 budinero
 
97
    finish_O:           out std_logic
98
    -- it is set when communication ends and remains until next restart or actual address change                                                    
99 37 budinero
 
100 28 budinero
        );
101 37 budinero
end entity ctrl_output_manager;
102 28 budinero
 
103
----------------------------------------------------------------------------------------------------
104
----------------------------------------------------------------------------------------------------
105 54 budinero
architecture ARCH22 of ctrl_output_manager is
106 37 budinero
 
107 28 budinero
  signal address_counter: std_logic_vector(MEM_ADD_WIDTH - 1  downto 0);
108
  signal enable_read: std_logic;
109 35 budinero
  signal enable_count: std_logic;
110
  signal s_finish: std_logic; -- register previous (and equal) to output
111 37 budinero
  signal init: std_logic;     -- register
112 28 budinero
 
113
begin
114 35 budinero
 
115 28 budinero
  --------------------------------------------------------------------------------------------------
116 35 budinero
  -- Wishbone signals
117
  DAT_O_port <= DAT_I_mem;
118
  CYC_O_mem <= CYC_I_port;
119
  STB_O_mem <= STB_I_port and enable_read;
120
  ACK_O_port <= ACK_I_mem;
121
  ADR_O_mem <= address_counter;
122
  WE_O_mem <= '0' ;
123 28 budinero
 
124 35 budinero
  --------------------------------------------------------------------------------------------------
125
  -- Status signals  
126 54 budinero
  -- there is an init signal because in the first read, address_counter may be = to pause_address_I
127 37 budinero
  enable_read <= '1'  when enable_I = '1' and  WE_I_port = '0' and s_finish = '0' and
128
                        (address_counter /= pause_address_I or init = '1')
129 33 budinero
            else '0';
130 37 budinero
 
131 35 budinero
  enable_count <= CYC_I_port and STB_I_port and ACK_I_mem and enable_read;
132 28 budinero
 
133 35 budinero
  finish_O <= s_finish;
134 54 budinero
  s_finish <= '1' when address_counter = initial_address_I and init = '0' else
135
              '0';
136 35 budinero
 
137 54 budinero
--   P_finish: process ( CLK_I, RST_I, address_counter, initial_address_I, load_I)
138
--   begin
139
--     if CLK_I'event and CLK_I = '1' and CLK_I'LAST_VALUE = '0' then
140
--       if RST_I = '1' then
141
--         --s_finish <= '0'; -- !! enable signal must be '0' until load
142
--         init <= '0';
143
--       elsif load_I = '1' then
144
--         --s_finish <= '0';
145
--         init <= '1';
146
--       -- elsif address_counter + 1 = initial_address_I then
147
--         -- s_finish <= '1';
148
--         -- init <= '0';
149
--       elsif enable_count = '1' then
150
--         init <= '0';
151
--       end if;
152
--     end if;
153
--   end process;
154 33 budinero
 
155 35 budinero
  --------------------------------------------------------------------------------------------------
156
  -- Address counter
157 54 budinero
  P_count: process(CLK_I, RST_I, address_counter, enable_count, load_I)
158 28 budinero
  begin
159 35 budinero
    if CLK_I'event and CLK_I = '1' and CLK_I'LAST_VALUE = '0' then
160 54 budinero
      if RST_I = '1' then
161
        address_counter <= (others => '0');
162
        init <= '1';
163
      elsif load_I = '1' then
164 35 budinero
        address_counter <= initial_address_I;
165 54 budinero
        init <= '1';
166 37 budinero
      elsif enable_count = '1' and address_counter >= biggest_address_I then
167
        address_counter <= (others => '0');
168
      elsif  enable_count = '1' then
169
        address_counter <= address_counter + 1;
170 54 budinero
        init <= '0';
171 28 budinero
      end if;
172 35 budinero
    end if;
173 28 budinero
  end process;
174
 
175
end architecture;

powered by: WebSVN 2.1.0

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