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 35

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

powered by: WebSVN 2.1.0

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