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

Subversion Repositories i2s_interface

[/] [i2s_interface/] [trunk/] [rtl/] [vhdl/] [tx_i2s_wbd.vhd] - Blame information for rev 18

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

Line No. Rev Author Line
1 9 gedra
----------------------------------------------------------------------
2
----                                                              ----
3
---- WISHBONE I2S Interface IP Core                               ----
4
----                                                              ----
5
---- This file is part of the I2S Interface project               ----
6
---- http://www.opencores.org/cores/i2s_interface/                ----
7
----                                                              ----
8
---- Description                                                  ----
9
---- I2S transmitter Wishbone bus cycle decoder.                  ----
10
----                                                              ----
11
----                                                              ----
12
---- To Do:                                                       ----
13
---- -                                                            ----
14
----                                                              ----
15
---- Author(s):                                                   ----
16
---- - Geir Drange, gedra@opencores.org                           ----
17
----                                                              ----
18
----------------------------------------------------------------------
19
----                                                              ----
20
---- Copyright (C) 2004 Authors and OPENCORES.ORG                 ----
21
----                                                              ----
22
---- This source file may be used and distributed without         ----
23
---- restriction provided that this copyright statement is not    ----
24
---- removed from the file and that any derivative work contains  ----
25
---- the original copyright notice and the associated disclaimer. ----
26
----                                                              ----
27
---- This source file is free software; you can redistribute it   ----
28
---- and/or modify it under the terms of the GNU General          ----
29
---- Public License as published by the Free Software Foundation; ----
30
---- either version 2.0 of the License, or (at your option) any   ----
31
---- later version.                                               ----
32
----                                                              ----
33
---- This source is distributed in the hope that it will be       ----
34
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
35
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
36 18 gedra
---- PURPOSE. See the GNU General Public License for more details.----
37 9 gedra
----                                                              ----
38
---- You should have received a copy of the GNU General           ----
39
---- Public License along with this source; if not, download it   ----
40
---- from http://www.gnu.org/licenses/gpl.txt                     ----
41
----                                                              ----
42
----------------------------------------------------------------------
43
--
44
-- CVS Revision History
45
--
46
-- $Log: not supported by cvs2svn $
47 18 gedra
-- Revision 1.1  2004/08/03 18:50:51  gedra
48
-- Transmitter Wishbone cycle decoder.
49 9 gedra
--
50
--
51 18 gedra
--
52 9 gedra
 
53
library ieee;
54
use ieee.std_logic_1164.all;
55
use ieee.numeric_std.all;
56
 
57
entity tx_i2s_wbd is
58
  generic (DATA_WIDTH: integer;
59
           ADDR_WIDTH: integer);
60
  port (
61
    wb_clk_i: in std_logic;             -- wishbone clock
62
    wb_rst_i: in std_logic;             -- reset signal
63
    wb_sel_i: in std_logic;             -- select input
64
    wb_stb_i: in std_logic;             -- strobe input
65
    wb_we_i: in std_logic;              -- write enable
66
    wb_cyc_i: in std_logic;             -- cycle input
67
    wb_bte_i: in std_logic_vector(1 downto 0);  -- burts type extension
68
    wb_cti_i: in std_logic_vector(2 downto 0);  -- cycle type identifier
69
    wb_adr_i: in std_logic_vector(ADDR_WIDTH - 1 downto 0);  -- address
70
    data_out: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- internal bus
71
    wb_ack_o: out std_logic;            -- acknowledge
72
    wb_dat_o: out std_logic_vector(DATA_WIDTH - 1 downto 0);  -- data out
73
    version_rd: out std_logic;          -- Version register read 
74
    config_rd: out std_logic;           -- Config register read
75
    config_wr: out std_logic;           -- Config register write
76
    intmask_rd: out std_logic;          -- Interrupt mask register read
77
    intmask_wr: out std_logic;          -- Interrupt mask register write
78
    intstat_rd: out std_logic;          -- Interrupt status register read
79
    intstat_wr: out std_logic;          -- Interrupt status register read
80
    mem_wr: out std_logic);             -- Sample memory write
81
end tx_i2s_wbd;
82
 
83
architecture rtl of tx_i2s_wbd is
84
 
85
  constant REG_TXVERSION : std_logic_vector(3 downto 0) := "0000";
86
  constant REG_TXCONFIG  : std_logic_vector(3 downto 0) := "0001";
87
  constant REG_TXINTMASK : std_logic_vector(3 downto 0) := "0010";
88
  constant REG_TXINTSTAT : std_logic_vector(3 downto 0) := "0011";
89
  signal iack, iwr, ird : std_logic;
90
  signal acnt: integer range 0 to 2**(ADDR_WIDTH - 1) - 1;
91
  signal rdout : std_logic_vector(DATA_WIDTH - 1 downto 0);
92
 
93
begin
94
 
95
  wb_ack_o <= iack;
96
 
97
-- acknowledge generation
98
  ACK: process (wb_clk_i, wb_rst_i)
99
  begin
100
    if wb_rst_i = '1' then
101
      iack <= '0';
102
    elsif rising_edge(wb_clk_i) then
103
      if wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' then
104
        case wb_cti_i is
105
          when "010" => -- incrementing burst
106
            case wb_bte_i is -- burst extension
107
              when "00" => -- linear burst
108
                iack <= '1';
109
              when others => -- all other treated assert classic cycle
110
                iack <= not iack;
111
            end case;
112
          when "111" => -- end of burst
113
            iack <= not iack;
114
          when others => -- all other treated assert classic cycle 
115
            iack <= not iack;
116
        end case;
117
      else
118
        iack <= '0';
119
      end if;
120
    end if;
121
  end process ACK;
122
 
123
-- write generation      
124
  WR: process (wb_clk_i, wb_rst_i)
125
  begin
126
    if wb_rst_i = '1' then
127
      iwr <= '0';
128
    elsif rising_edge(wb_clk_i) then
129
      if wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' and
130
        wb_we_i = '1' then
131
        case wb_cti_i is
132
          when "010" => -- incrementing burst
133
            case wb_bte_i is -- burst extension
134
              when "00" => -- linear burst
135
                iwr <= '1';
136
              when others => -- all other treated as classic cycle
137
                iwr <= not iwr;
138
            end case;
139
          when "111" => -- end of burst
140
            iwr <= not iwr;
141
          when others => -- all other treated as classic cycle   
142
            iwr <= not iwr;
143
        end case;
144
      else
145
        iwr <= '0';
146
      end if;
147
    end if;
148
  end process WR;
149
 
150
-- read generation
151
  ird <= '1' when wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' and
152
         wb_we_i = '0' else '0';
153
 
154
  wb_dat_o <= data_out when wb_adr_i(ADDR_WIDTH - 1) = '1' else rdout;
155
 
156
  DREG: process (wb_clk_i)              -- clock data from registers
157
  begin
158
    if rising_edge(wb_clk_i) then
159
      rdout <= data_out;
160
    end if;
161
  end process DREG;
162
 
163
-- read and write strobe generation
164
 
165
  version_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXVERSION and ird = '1'
166
                else '0';
167
  config_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXCONFIG and ird = '1'
168
               else '0';
169
  config_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXCONFIG and iwr = '1'
170
               else '0';
171
  intmask_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXINTMASK and ird = '1'
172
                else '0';
173
  intmask_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXINTMASK and iwr = '1'
174
                else '0';
175
  intstat_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXINTSTAT and ird = '1'
176
                else '0';
177
  intstat_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXINTSTAT and iwr = '1'
178
                else '0';
179
  mem_wr <= '1' when wb_adr_i(ADDR_WIDTH - 1) = '1' and iwr = '1' else '0';
180
 
181
end rtl;

powered by: WebSVN 2.1.0

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