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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib_helper/] [MemoryBlock_by_logic.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2 13 Andrewski
--This file is part of fpga_gpib_controller.
3
--
4
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
--
9
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with Fpga_gpib_controller.  If not, see <http://www.gnu.org/licenses/>.
16
--------------------------------------------------------------------------------
17 3 Andrewski
-- Entity: MemoryBlock
18
-- Date:2011-11-14  
19 13 Andrewski
-- Author: Andrzej Paluch
20 3 Andrewski
--
21
-- Description ${cursor}
22
--------------------------------------------------------------------------------
23
library ieee;
24
use ieee.std_logic_1164.all;
25
use ieee.std_logic_unsigned.all;
26
use ieee.std_logic_arith.all;
27
 
28
library UNISIM;
29
use UNISIM.vcomponents.all;
30
 
31
use work.utilPkg.all;
32
use work.helperComponents.all;
33
 
34
 
35
entity MemoryBlock is
36
        port (
37
                reset : in std_logic;
38
                clk : in std_logic;
39
                -------------------------------------------------
40
                p1_addr : in std_logic_vector(10 downto 0);
41
                p1_data_in : in std_logic_vector(7 downto 0);
42
                p1_strobe : in std_logic;
43
                p1_data_out : out std_logic_vector(7 downto 0);
44
                -------------------------------------------------
45
                p2_addr : in std_logic_vector(10 downto 0);
46
                p2_data_in : in std_logic_vector(7 downto 0);
47
                p2_strobe : in std_logic;
48
                p2_data_out : out std_logic_vector(7 downto 0)
49
        );
50
end MemoryBlock;
51
 
52
architecture arch of MemoryBlock is
53
 
54
        type mem is array(0 to 31) of std_logic_vector(7 downto 0);
55
 
56
        signal memory : mem;
57
        signal addrP1, addrP2 : integer range 0 to 31;
58
 
59
begin
60
 
61
        addrP1 <= conv_integer(UNSIGNED(p1_addr));
62
        addrP2 <= conv_integer(UNSIGNED(p2_addr));
63
 
64
        process(reset, clk) begin
65
                if reset = '1' then
66
 
67
                elsif rising_edge(clk) then
68
                        p1_data_out <= memory(addrP1);
69
                        p2_data_out <= memory(addrP2);
70
 
71
                        if p1_strobe = '1' then
72
                                memory(addrP1) <= p1_data_in;
73
                        end if;
74
 
75
                        if p2_strobe = '1' then
76
                                memory(addrP2) <= p2_data_in;
77
                        end if;
78
                end if;
79
        end process;
80
 
81
end arch;
82
 

powered by: WebSVN 2.1.0

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