📄 rx_spdif.vhd
字号:
-------------------------------------------------------------------------- -------- WISHBONE SPDIF IP Core -------- -------- This file is part of the SPDIF project -------- http://www.opencores.org/cores/spdif_interface/ -------- -------- Description -------- SPDIF receiver. Top level entity for the receiver core. -------- -------- -------- To Do: -------- - -------- -------- Author(s): -------- - Geir Drange, gedra@opencores.org -------- ------------------------------------------------------------------------------ -------- Copyright (C) 2004 Authors and OPENCORES.ORG -------- -------- This source file may be used and distributed without -------- restriction provided that this copyright statement is not -------- removed from the file and that any derivative work contains -------- the original copyright notice and the associated disclaimer. -------- -------- This source file is free software; you can redistribute it -------- and/or modify it under the terms of the GNU Lesser General -------- Public License as published by the Free Software Foundation; -------- either version 2.1 of the License, or (at your option) any -------- later version. -------- -------- This source is distributed in the hope that it will be -------- useful, but WITHOUT ANY WARRANTY; without even the implied -------- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -------- PURPOSE. See the GNU Lesser General Public License for more -------- details. -------- -------- You should have received a copy of the GNU Lesser General -------- Public License along with this source; if not, download it -------- from http://www.opencores.org/lgpl.shtml -------- ------------------------------------------------------------------------------ CVS Revision History---- $Log: rx_spdif.vhd,v $-- Revision 1.7 2007/10/11 19:14:43 gedra-- Code beautification---- Revision 1.6 2004/07/20 17:41:25 gedra-- Cleaned up synthesis warnings.---- Revision 1.5 2004/07/19 16:58:37 gedra-- Fixed bug.---- Revision 1.4 2004/07/12 17:06:41 gedra-- Fixed bug with lock event generation.---- Revision 1.3 2004/07/11 16:19:50 gedra-- Bug-fix.---- Revision 1.2 2004/06/27 16:16:55 gedra-- Signal renaming and bug fix.---- Revision 1.1 2004/06/26 14:13:56 gedra-- Top level entity for receiver.----library IEEE;use IEEE.std_logic_1164.all;use work.rx_package.all;entity rx_spdif is generic (DATA_WIDTH : integer range 16 to 32; ADDR_WIDTH : integer range 8 to 64; CH_ST_CAPTURE : integer range 0 to 8; WISHBONE_FREQ : natural); port ( -- Wishbone interface wb_clk_i : in std_logic; wb_rst_i : in std_logic; wb_sel_i : in std_logic; wb_stb_i : in std_logic; wb_we_i : in std_logic; wb_cyc_i : in std_logic; wb_bte_i : in std_logic_vector(1 downto 0); wb_cti_i : in std_logic_vector(2 downto 0); wb_adr_i : in std_logic_vector(ADDR_WIDTH - 1 downto 0); wb_dat_i : in std_logic_vector(DATA_WIDTH -1 downto 0); wb_ack_o : out std_logic; wb_dat_o : out std_logic_vector(DATA_WIDTH - 1 downto 0); -- Interrupt line rx_int_o : out std_logic; -- SPDIF input signal spdif_rx_i : in std_logic);end rx_spdif;architecture rtl of rx_spdif is signal data_out, ver_dout : std_logic_vector(DATA_WIDTH - 1 downto 0); signal ver_rd, conf_chas, conf_valid : std_logic; signal conf_rxen, conf_sample, evt_en : std_logic; signal conf_blken, conf_valen, conf_useren : std_logic; signal conf_paren, config_rd, config_wr : std_logic; signal conf_mode : std_logic_vector(3 downto 0); signal conf_bits, conf_dout : std_logic_vector(DATA_WIDTH - 1 downto 0); signal status_rd, istat_parityb : std_logic; signal stat_dout : std_logic_vector(DATA_WIDTH - 1 downto 0); signal imask_bits, imask_dout : std_logic_vector(DATA_WIDTH - 1 downto 0); signal imask_rd, imask_wr, conf_staten : std_logic; signal istat_dout, istat_events : std_logic_vector(DATA_WIDTH - 1 downto 0); signal istat_rd, istat_wr, istat_lock : std_logic; signal istat_lsbf, istat_hsbf, istat_paritya : std_logic; signal istat_cap : std_logic_vector(7 downto 0); signal ch_st_cap_rd, ch_st_cap_wr, ch_st_data_rd : std_logic_vector(7 downto 0); signal cap_dout : bus_array; signal ch_data, ud_a_en, ud_b_en, cs_a_en, cs_b_en : std_logic; signal mem_rd, sample_wr : std_logic; signal sample_din, sample_dout : std_logic_vector(DATA_WIDTH - 1 downto 0); signal sbuf_wr_adr, sbuf_rd_adr : std_logic_vector(ADDR_WIDTH - 2 downto 0); signal lock, rx_frame_start : std_logic; signal rx_data, rx_data_en, rx_block_start : std_logic; signal rx_channel_a, rx_error, lock_evt : std_logic;begin-- Data bus or'ing DB16 : if DATA_WIDTH = 16 generate data_out <= ver_dout or conf_dout or stat_dout or imask_dout or istat_dout when wb_adr_i(ADDR_WIDTH - 1) = '0' else sample_dout; end generate DB16; DB32 : if DATA_WIDTH = 32 generate data_out <= ver_dout or conf_dout or stat_dout or imask_dout or istat_dout or cap_dout(1) or cap_dout(2) or cap_dout(3) or cap_dout(4) or cap_dout(5) or cap_dout(6) or cap_dout(7) or cap_dout(0) when wb_adr_i(ADDR_WIDTH - 1) = '0' else sample_dout; end generate DB32;-- Wishbone bus cycle decoder WB : rx_wb_decoder generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH) port map ( wb_clk_i => wb_clk_i, wb_rst_i => wb_rst_i, wb_sel_i => wb_sel_i, wb_stb_i => wb_stb_i, wb_we_i => wb_we_i, wb_cyc_i => wb_cyc_i, wb_bte_i => wb_bte_i, wb_cti_i => wb_cti_i, wb_adr_i => wb_adr_i, data_out => data_out, wb_ack_o => wb_ack_o, wb_dat_o => wb_dat_o, version_rd => ver_rd, config_rd => config_rd, config_wr => config_wr, status_rd => status_rd, intmask_rd => imask_rd, intmask_wr => imask_wr, intstat_rd => istat_rd, intstat_wr => istat_wr, mem_rd => mem_rd, mem_addr => sbuf_rd_adr, ch_st_cap_rd => ch_st_cap_rd, ch_st_cap_wr => ch_st_cap_wr, ch_st_data_rd => ch_st_data_rd);-- Version register VER : rx_ver_reg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, CH_ST_CAPTURE => CH_ST_CAPTURE) port map ( ver_rd => ver_rd, ver_dout => ver_dout);-- Configuration register CG32 : if DATA_WIDTH = 32 generate CONF : gen_control_reg generic map ( DATA_WIDTH => 32, ACTIVE_BIT_MASK => "11111100000000001111111100000000") port map ( clk => wb_clk_i, rst => wb_rst_i, ctrl_wr => config_wr, ctrl_rd => config_rd, ctrl_din => wb_dat_i, ctrl_dout => conf_dout, ctrl_bits => conf_bits); conf_mode(3 downto 0) <= conf_bits(23 downto 20); conf_paren <= conf_bits(19); conf_staten <= conf_bits(18); conf_useren <= conf_bits(17); conf_valen <= conf_bits(16);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -