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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [bench/] [vhdl/] [spdif_source.vhd] - Diff between revs 13 and 40

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 13 Rev 40
Line 43... Line 43...
----------------------------------------------------------------------
----------------------------------------------------------------------
--
--
-- CVS Revision History
-- CVS Revision History
--
--
-- $Log: not supported by cvs2svn $
-- $Log: not supported by cvs2svn $
 
-- Revision 1.2  2004/06/06 15:45:24  gedra
 
-- Cleaned up lint warnings.
 
--
-- Revision 1.1  2004/06/03 17:45:18  gedra
-- Revision 1.1  2004/06/03 17:45:18  gedra
-- SPDIF signal generator.
-- SPDIF signal generator.
--
--
--
--
 
 
LIBRARY ieee;
library ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_1164.all;
 
 
entity spdif_source is
entity spdif_source is
  generic (FREQ: natural);            -- Sampling frequency in Hz
  generic (FREQ: natural);            -- Sampling frequency in Hz
  port (                              -- Bitrate is 64x sampling frequency
  port (                              -- Bitrate is 64x sampling frequency
    reset: in std_logic;
    reset: in std_logic;
Line 64... Line 67...
 
 
  constant X_Preamble : std_logic_vector(7 downto 0) := "11100010";
  constant X_Preamble : std_logic_vector(7 downto 0) := "11100010";
  constant Y_Preamble : std_logic_vector(7 downto 0) := "11100100";
  constant Y_Preamble : std_logic_vector(7 downto 0) := "11100100";
  constant Z_Preamble : std_logic_vector(7 downto 0) := "11101000";
  constant Z_Preamble : std_logic_vector(7 downto 0) := "11101000";
  signal clk, ispdif: std_logic;
  signal clk, ispdif: std_logic;
  signal fcnt : integer;              -- frame counter
  signal fcnt : natural range 0 to 191;   -- frame counter
  signal bcnt : integer;              -- subframe bit counter
  signal bcnt : natural range 0 to 63;    -- subframe bit counter
  signal pcnt : integer;
  signal pcnt : natural range 0 to 63;  -- parity counter
  signal toggle : integer range 0 to 1;
  signal toggle : integer range 0 to 1;
  -- Channel A: sinewave with frequency=Freq/12
  -- Channel A: sinewave with frequency=Freq/12
  type sine16 is array (0 to 15) of std_logic_vector(15 downto 0);
  type sine16 is array (0 to 15) of std_logic_vector(15 downto 0);
  signal channel_a : sine16 := ((x"8000"),(x"b0fb"),(x"da82"),(x"f641"),
  signal channel_a : sine16 := ((x"8000"),(x"b0fb"),(x"da82"),(x"f641"),
                                (x"ffff"), (x"f641"), (x"da82"), (x"b0fb"),
                                (x"ffff"), (x"f641"), (x"da82"), (x"b0fb"),
Line 89... Line 92...
 
 
-- Generate SPDIF signal 
-- Generate SPDIF signal 
  SGEN: process (clk, reset)
  SGEN: process (clk, reset)
  begin
  begin
    if reset = '1' then
    if reset = '1' then
      fcnt <= 188;      -- start just before block to shorten simulation
      fcnt <= 184;      -- start just before block to shorten simulation
      bcnt <= 0;
      bcnt <= 0;
      toggle <= 0;
      toggle <= 0;
      ispdif <= '0';
      ispdif <= '0';
 
      pcnt <= 0;
    elsif rising_edge(clk) then
    elsif rising_edge(clk) then
      if toggle = 1 then
      if toggle = 1 then
        -- frame counter: 0 to 191
        -- frame counter: 0 to 191
        if fcnt < 191 then
        if fcnt < 191 then
          if bcnt = 63 then
          if bcnt = 63 then

powered by: WebSVN 2.1.0

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