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

Subversion Repositories modbus

[/] [modbus/] [trunk/] [enlace/] [contro_ram.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 guanucolui
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
entity contro_ram is
12
        generic(
13
                addr_bits : integer := 8); -- 2^addr_bits = numero bits de direccionamiento
14
        port(
15
--entradas y salidas de la RAM
16
                clk                     :in std_logic;
17
                reset           :in std_logic;
18
                Eram            :out std_logic;
19
                Eram_write      :out std_logic;
20
                ram_addr                :out std_logic_vector(addr_bits-1 downto 0);
21
                data_in_ram     :out std_logic_vector(7 downto 0);
22
                data_out_ram    :in std_logic_vector(7 downto 0);
23
--entradas y salidas del pico blaze
24
                Eram_picoB      :in std_logic;
25
                WEram_picoB     :in std_logic;
26
                addr_picoB      :in std_logic_vector(addr_bits-1 downto 0);
27
                data_in_ram_picoB:in std_logic_vector(7 downto 0);
28
                data_out_ram_picoB:out std_logic_vector(7 downto 0);
29
--entradas y salidas del componente detector
30
                Eram_det                :in std_logic;
31
                Eram_write_det  :in std_logic;
32
                ram_addr_det    :in std_logic_vector(addr_bits-1 downto 0);
33
                data_in_ram_det:in std_logic_vector(7 downto 0);
34
--entradas y salidas del componente generador trama
35
          E_ram_gen             :in std_logic;
36
                WE_ram_gen      :in std_logic;
37
                addr_ram_gen    :in std_logic_vector(addr_bits-1 downto 0);
38
                data_out_ram_gen:out std_logic_vector(7 downto 0)
39
                );
40
end contro_ram;
41
 
42
architecture Behavioral of contro_ram is
43
 
44
--signal Senable_ram : std_logic_vector (2 downto 0):="000";
45
begin
46
 
47
--Senable_ram <= Eram_det & E_ram_gen & Eram_picoB;
48
 
49
enable_ram: process(clk, Eram_det,E_ram_gen,Eram_picoB)
50
variable Venable_ram : std_logic_vector (2 downto 0):="000";
51
begin
52
Venable_ram := Eram_det & E_ram_gen & Eram_picoB;
53
if clk'event and clk = '1' then
54
        case (Venable_ram) is
55
--      case (Senable_ram) is 
56
         when "001" =>
57
                Eram            <= Eram_picoB;
58
                Eram_write      <= WEram_picoB;
59
                ram_addr                <= addr_picoB;
60
                data_in_ram     <= data_in_ram_picoB;
61
                data_out_ram_picoB <= data_out_ram;
62
    when "010" =>
63
      Eram              <= E_ram_gen;
64
                Eram_write      <= WE_ram_gen;
65
                ram_addr        <= addr_ram_gen;
66
                data_in_ram     <= (others=>'0');
67
                data_out_ram_gen <= data_out_ram;
68
         when "100" =>
69
      Eram              <= Eram_det;
70
                Eram_write      <= Eram_write_det;
71
                ram_addr        <= ram_addr_det;
72
                data_in_ram     <= data_in_ram_det;
73
    when others =>
74
        Eram            <= '0';
75
                Eram_write      <= '0';
76
                ram_addr        <= (others=>'0');
77
                data_in_ram     <= (others=>'0');
78
    end case;
79
end if;
80
end process;
81
 
82
end Behavioral;

powered by: WebSVN 2.1.0

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