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 22

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 22 gedra
-- Revision 1.2  2004/08/06 18:55:43  gedra
48
-- De-linting.
49
--
50 18 gedra
-- Revision 1.1  2004/08/03 18:50:51  gedra
51
-- Transmitter Wishbone cycle decoder.
52 9 gedra
--
53
--
54 18 gedra
--
55 9 gedra
 
56
library ieee;
57
use ieee.std_logic_1164.all;
58
use ieee.numeric_std.all;
59
 
60
entity tx_i2s_wbd is
61
  generic (DATA_WIDTH: integer;
62
           ADDR_WIDTH: integer);
63
  port (
64
    wb_clk_i: in std_logic;             -- wishbone clock
65
    wb_rst_i: in std_logic;             -- reset signal
66
    wb_sel_i: in std_logic;             -- select input
67
    wb_stb_i: in std_logic;             -- strobe input
68
    wb_we_i: in std_logic;              -- write enable
69
    wb_cyc_i: in std_logic;             -- cycle input
70
    wb_bte_i: in std_logic_vector(1 downto 0);  -- burts type extension
71
    wb_cti_i: in std_logic_vector(2 downto 0);  -- cycle type identifier
72
    wb_adr_i: in std_logic_vector(ADDR_WIDTH - 1 downto 0);  -- address
73
    data_out: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- internal bus
74
    wb_ack_o: out std_logic;            -- acknowledge
75
    wb_dat_o: out std_logic_vector(DATA_WIDTH - 1 downto 0);  -- data out
76
    version_rd: out std_logic;          -- Version register read 
77
    config_rd: out std_logic;           -- Config register read
78
    config_wr: out std_logic;           -- Config register write
79
    intmask_rd: out std_logic;          -- Interrupt mask register read
80
    intmask_wr: out std_logic;          -- Interrupt mask register write
81
    intstat_rd: out std_logic;          -- Interrupt status register read
82
    intstat_wr: out std_logic;          -- Interrupt status register read
83
    mem_wr: out std_logic);             -- Sample memory write
84
end tx_i2s_wbd;
85
 
86
architecture rtl of tx_i2s_wbd is
87
 
88
  constant REG_TXVERSION : std_logic_vector(3 downto 0) := "0000";
89
  constant REG_TXCONFIG  : std_logic_vector(3 downto 0) := "0001";
90
  constant REG_TXINTMASK : std_logic_vector(3 downto 0) := "0010";
91
  constant REG_TXINTSTAT : std_logic_vector(3 downto 0) := "0011";
92
  signal iack, iwr, ird : std_logic;
93
  signal acnt: integer range 0 to 2**(ADDR_WIDTH - 1) - 1;
94
  signal rdout : std_logic_vector(DATA_WIDTH - 1 downto 0);
95
 
96
begin
97
 
98
  wb_ack_o <= iack;
99
 
100
-- acknowledge generation
101
  ACK: process (wb_clk_i, wb_rst_i)
102
  begin
103
    if wb_rst_i = '1' then
104
      iack <= '0';
105
    elsif rising_edge(wb_clk_i) then
106
      if wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' then
107
        case wb_cti_i is
108
          when "010" => -- incrementing burst
109
            case wb_bte_i is -- burst extension
110
              when "00" => -- linear burst
111
                iack <= '1';
112
              when others => -- all other treated assert classic cycle
113
                iack <= not iack;
114
            end case;
115
          when "111" => -- end of burst
116
            iack <= not iack;
117
          when others => -- all other treated assert classic cycle 
118
            iack <= not iack;
119
        end case;
120
      else
121
        iack <= '0';
122
      end if;
123
    end if;
124
  end process ACK;
125
 
126
-- write generation      
127
  WR: process (wb_clk_i, wb_rst_i)
128
  begin
129
    if wb_rst_i = '1' then
130
      iwr <= '0';
131
    elsif rising_edge(wb_clk_i) then
132
      if wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' and
133
        wb_we_i = '1' then
134
        case wb_cti_i is
135
          when "010" => -- incrementing burst
136
            case wb_bte_i is -- burst extension
137
              when "00" => -- linear burst
138
                iwr <= '1';
139
              when others => -- all other treated as classic cycle
140
                iwr <= not iwr;
141
            end case;
142
          when "111" => -- end of burst
143
            iwr <= not iwr;
144
          when others => -- all other treated as classic cycle   
145
            iwr <= not iwr;
146
        end case;
147
      else
148
        iwr <= '0';
149
      end if;
150
    end if;
151
  end process WR;
152
 
153
-- read generation
154
  ird <= '1' when wb_cyc_i = '1' and wb_sel_i = '1' and wb_stb_i = '1' and
155
         wb_we_i = '0' else '0';
156
 
157
  wb_dat_o <= data_out when wb_adr_i(ADDR_WIDTH - 1) = '1' else rdout;
158
 
159
  DREG: process (wb_clk_i)              -- clock data from registers
160
  begin
161
    if rising_edge(wb_clk_i) then
162
      rdout <= data_out;
163
    end if;
164
  end process DREG;
165
 
166
-- read and write strobe generation
167
 
168
  version_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXVERSION and ird = '1'
169 22 gedra
                and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
170 9 gedra
  config_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXCONFIG and ird = '1'
171 22 gedra
               and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
172 9 gedra
  config_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXCONFIG and iwr = '1'
173 22 gedra
               and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
174 9 gedra
  intmask_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXINTMASK and ird = '1'
175 22 gedra
                and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
176 9 gedra
  intmask_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXINTMASK and iwr = '1'
177 22 gedra
                and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
178 9 gedra
  intstat_rd <= '1' when wb_adr_i(3 downto 0) = REG_TXINTSTAT and ird = '1'
179 22 gedra
                and wb_adr_i(ADDR_WIDTH - 1) = '0' else '0';
180 9 gedra
  intstat_wr <= '1' when wb_adr_i(3 downto 0) = REG_TXINTSTAT and iwr = '1'
181
                else '0';
182
  mem_wr <= '1' when wb_adr_i(ADDR_WIDTH - 1) = '1' and iwr = '1' else '0';
183
 
184
end rtl;

powered by: WebSVN 2.1.0

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