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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [rtl/] [vhdl/] [tx_bitbuf.vhd] - Blame information for rev 58

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

Line No. Rev Author Line
1 47 gedra
----------------------------------------------------------------------
2
----                                                              ----
3
---- WISHBONE SPDIF IP Core                                       ----
4
----                                                              ----
5
---- This file is part of the SPDIF project                       ----
6
---- http://www.opencores.org/cores/spdif_interface/              ----
7
----                                                              ----
8
---- Description                                                  ----
9
---- Bit buffer holding 2x192 bits of either channel status or    ----
10
---- user data for the transmitter.                               ----
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 Lesser General   ----
29
---- Public License as published by the Free Software Foundation; ----
30
---- either version 2.1 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
---- PURPOSE. See the GNU Lesser General Public License for more  ----
37
---- details.                                                     ----
38
----                                                              ----
39
---- You should have received a copy of the GNU Lesser General    ----
40
---- Public License along with this source; if not, download it   ----
41
---- from http://www.opencores.org/lgpl.shtml                     ----
42
----                                                              ----
43
----------------------------------------------------------------------
44
--
45
-- CVS Revision History
46
--
47
-- $Log: not supported by cvs2svn $
48 58 gedra
-- Revision 1.2  2004/07/17 17:21:11  gedra
49
-- Fixed bug.
50
--
51 53 gedra
-- Revision 1.1  2004/07/14 17:58:19  gedra
52
-- Transmitter channel status buffer.
53 47 gedra
--
54
--
55 53 gedra
--
56 47 gedra
 
57
library ieee;
58
use ieee.std_logic_1164.all;
59
use ieee.numeric_std.all;
60
 
61
entity tx_bitbuf is
62
  generic (ENABLE_BUFFER: integer range 0 to 1);
63
  port (
64
    wb_clk_i: in std_logic;             -- clock
65
    wb_rst_i: in std_logic;             -- reset
66
    buf_wr: in std_logic;               -- buffer write strobe
67
    wb_adr_i: in std_logic_vector(4 downto 0);  -- address
68
    wb_dat_i: in std_logic_vector(15 downto 0);  -- data
69
    buf_data_a: out std_logic_vector(191 downto 0);
70
    buf_data_b: out std_logic_vector(191 downto 0));
71
end tx_bitbuf;
72
 
73
architecture rtl of tx_bitbuf is
74
 
75 58 gedra
  type buf_type is array (0 to 23) of std_logic_vector(7 downto 0);
76
  signal buffer_a, buffer_b: buf_type;
77
 
78 47 gedra
begin
79
 
80
  -- the byte buffer is 192 bits (24 bytes) for each channel 
81
  EB: if ENABLE_BUFFER = 1 generate
82
    WBUF: process (wb_clk_i, wb_rst_i)
83
    begin
84
      if wb_rst_i = '1' then
85 58 gedra
        for i in 0 to 23 loop
86
          buffer_a(i) <= (others => '0');
87
          buffer_b(i) <= (others => '0');
88
        end loop;
89 47 gedra
      elsif rising_edge(wb_clk_i) then
90 53 gedra
        if buf_wr = '1' and to_integer(unsigned(wb_adr_i)) < 24 then
91 58 gedra
          buffer_a(to_integer(unsigned(wb_adr_i))) <= wb_dat_i(7 downto 0);
92
          buffer_b(to_integer(unsigned(wb_adr_i))) <= wb_dat_i(15 downto 8);
93 47 gedra
        end if;
94
      end if;
95
    end process WBUF;
96 58 gedra
    VGEN: for k in 0 to 23 generate
97
      buf_data_a(8 * k + 7 downto 8 * k) <= buffer_a(k);
98
      buf_data_b(8 * k + 7 downto 8 * k) <= buffer_b(k);
99
    end generate VGEN;
100 47 gedra
  end generate EB;
101
 
102
  -- if the byte buffer is not enabled, set all bits to zero
103
  NEB: if ENABLE_BUFFER = 0 generate
104
    buf_data_a(191 downto 0) <= (others => '0');
105
    buf_data_b(191 downto 0) <= (others => '0');
106
  end generate NEB;
107
 
108
end rtl;

powered by: WebSVN 2.1.0

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