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

Subversion Repositories spdif_interface

[/] [spdif_interface/] [trunk/] [rtl/] [vhdl/] [gen_control_reg.vhd] - Diff between revs 5 and 8

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

Rev 5 Rev 8
Line 43... Line 43...
----------------------------------------------------------------------
----------------------------------------------------------------------
--
--
-- CVS Revision History
-- CVS Revision History
--
--
-- $Log: not supported by cvs2svn $
-- $Log: not supported by cvs2svn $
 
-- Revision 1.1  2004/06/03 17:47:17  gedra
 
-- Generic control register. Used in both recevier and transmitter.
 
--
--
--
 
 
library IEEE;
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_arith.all;
 
 
entity gen_control_reg is
entity gen_control_reg is
  generic (DataWidth: integer;
  generic (DATA_WIDTH: integer;
           ActiveBitsMask: std_logic_vector); -- note that this vector is (0 to xx), reverse order
           ACTIVE_BIT_MASK: std_logic_vector); -- note that this vector is (0 to xx),
  port (
  port (                                       -- reverse order
    clk: in std_logic;   -- clock  
    clk: in std_logic;   -- clock  
    rst: in std_logic; -- reset
    rst: in std_logic; -- reset
    ctrl_wr: in std_logic; -- control register write    
    ctrl_wr: in std_logic; -- control register write    
    ctrl_rd: in std_logic; -- control register read
    ctrl_rd: in std_logic; -- control register read
    ctrl_din: in std_logic_vector(DataWidth - 1 downto 0); -- write data
    ctrl_din: in std_logic_vector(DATA_WIDTH - 1 downto 0); -- write data
    ctrl_dout: out std_logic_vector(DataWidth - 1 downto 0); -- read data
    ctrl_dout: out std_logic_vector(DATA_WIDTH - 1 downto 0); -- read data
    ctrl_bits: out std_logic_vector(DataWidth - 1 downto 0)); -- control bits
    ctrl_bits: out std_logic_vector(DATA_WIDTH - 1 downto 0)); -- control bits
end gen_control_reg;
end gen_control_reg;
 
 
architecture rtl of gen_control_reg is
architecture rtl of gen_control_reg is
 
 
  signal ctrl_internal, BitMask: std_logic_vector(DataWidth - 1 downto 0);
  signal ctrl_internal: std_logic_vector(DATA_WIDTH - 1 downto 0);
 
 
begin
begin
 
 
  ctrl_dout <= ctrl_internal when ctrl_rd = '1' else (others => '0');
  ctrl_dout <= ctrl_internal when ctrl_rd = '1' else (others => '0');
  ctrl_bits <= ctrl_internal;
  ctrl_bits <= ctrl_internal;
 
 
-- control register generation
-- control register generation
--BitMask <= CONV_STD_LOGIC_VECTOR(ActiveBitsMask, ctrl_din'length);
 
  CTRLREG: for k in ctrl_din'range generate
  CTRLREG: for k in ctrl_din'range generate
    ACTIVE: if  ActiveBitsMask(k) = '1' generate                 -- active bits can be written to
    -- active bits can be written to
 
    ACTIVE: if  ACTIVE_BIT_MASK(k) = '1' generate
      CBIT: process (clk, rst)
      CBIT: process (clk, rst)
      begin
      begin
        if rst = '1' then
        if rst = '1' then
          ctrl_internal(k) <= '0';
          ctrl_internal(k) <= '0';
        else
        else
Line 87... Line 90...
              ctrl_internal(k) <= ctrl_din(k);
              ctrl_internal(k) <= ctrl_din(k);
            end if;
            end if;
          end if;
          end if;
        end if;
        end if;
      end process CBIT;
      end process CBIT;
    end generate;
    end generate ACTIVE;
    INACTIVE: if ActiveBitsMask(k) = '0' generate        -- inactive bits are always 0
    -- inactive bits are always 0
 
    INACTIVE: if ACTIVE_BIT_MASK(k) = '0' generate
      ctrl_internal(k) <= '0';
      ctrl_internal(k) <= '0';
    end generate;
    end generate INACTIVE;
  end generate;
  end generate CTRLREG;
 
 
end rtl;
end rtl;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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