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

Subversion Repositories iicmb

[/] [iicmb/] [trunk/] [src/] [avalon_mm.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sshuv2
 
2
--==============================================================================
3
--                                                                             |
4
--    Project: IIC Multiple Bus Controller (IICMB)                             |
5
--                                                                             |
6
--    Module:  Avalon-MM adapter.                                              |
7
--    Version:                                                                 |
8
--             1.0,   April 29, 2016                                           |
9
--                                                                             |
10
--    Author:  Sergey Shuvalkin, (sshuv2@opencores.org)                        |
11
--                                                                             |
12
--==============================================================================
13
--==============================================================================
14
-- Copyright (c) 2016, Sergey Shuvalkin                                        |
15
-- All rights reserved.                                                        |
16
--                                                                             |
17
-- Redistribution and use in source and binary forms, with or without          |
18
-- modification, are permitted provided that the following conditions are met: |
19
--                                                                             |
20
-- 1. Redistributions of source code must retain the above copyright notice,   |
21
--    this list of conditions and the following disclaimer.                    |
22
-- 2. Redistributions in binary form must reproduce the above copyright        |
23
--    notice, this list of conditions and the following disclaimer in the      |
24
--    documentation and/or other materials provided with the distribution.     |
25
--                                                                             |
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   |
28
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  |
29
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE    |
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR         |
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF        |
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS    |
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN     |
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)     |
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  |
36
-- POSSIBILITY OF SUCH DAMAGE.                                                 |
37
--==============================================================================
38
 
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
 
43
 
44
--==============================================================================
45
entity avalon_mm is
46
  port
47
  (
48
    ------------------------------------
49 3 sshuv2
    clk           : in    std_logic;                            -- Clock input
50
    s_rst         : in    std_logic;                            -- Synchronous reset (active high)
51 2 sshuv2
    ------------------------------------
52
    ------------------------------------
53
    -- Avalon-MM slave interface:
54 3 sshuv2
    waitrequest   :   out std_logic;                            -- Wait request
55
    readdata      :   out std_logic_vector(31 downto 0);        -- Data from slave to master
56
    readdatavalid :   out std_logic;                            -- Data validity indication
57
    writedata     : in    std_logic_vector(31 downto 0);        -- Data from master to slave
58
    write         : in    std_logic;                            -- Asserted to indicate write transfer
59
    read          : in    std_logic;                            -- Asserted to indicate read transfer
60
    byteenable    : in    std_logic_vector( 3 downto 0);        -- Enables specific byte lane(s)
61 2 sshuv2
    ------------------------------------
62
    ------------------------------------
63
    -- Regblock interface:
64 3 sshuv2
    wr            :   out std_logic_vector( 3 downto 0);        -- Write (active high)
65
    rd            :   out std_logic_vector( 3 downto 0);        -- Read (active high)
66
    idata         :   out std_logic_vector(31 downto 0);        -- Data from System Bus
67
    odata         : in    std_logic_vector(31 downto 0)         -- Data for System Bus
68 2 sshuv2
    ------------------------------------
69
  );
70
end entity avalon_mm;
71
--==============================================================================
72
 
73
--==============================================================================
74
architecture rtl of avalon_mm is
75
 
76
begin
77
 
78
  waitrequest <= '0';
79
  wr          <= (3 downto 0 => write) and byteenable;
80
  rd          <= (3 downto 0 => read ) and byteenable;
81
  idata       <= writedata;
82
 
83
  ------------------------------------------------------------------------------
84
  readdata_proc:
85
  process(clk)
86
  begin
87
    if rising_edge(clk) then
88
      if (s_rst = '1') then
89
        readdata      <= (others => '0');
90
        readdatavalid <= '0';
91
      else
92
        readdata      <= odata;
93
        readdatavalid <= read;
94
      end if;
95
    end if;
96
  end process readdata_proc;
97
  ------------------------------------------------------------------------------
98
 
99
end architecture rtl;
100
--==============================================================================
101
 

powered by: WebSVN 2.1.0

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