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

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [tags/] [start_version/] [rtl/] [vhdl/] [core/] [x_shift_reg.vhd] - Diff between revs 2 and 48

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 48
------------------------------------------------------------------------------------ 
------------------------------------------------------------------------------------ 
--                      
--                      
-- Geoffrey Ottoy - DraMCo research group
-- Geoffrey Ottoy - DraMCo research group
--
--
-- Module Name: x_shift_reg.vhd / entity x_shift_reg
-- Module Name: x_shift_reg.vhd / entity x_shift_reg
-- 
-- 
-- Last Modified:       18/06/2012 
-- Last Modified:       18/06/2012 
-- 
-- 
-- Description:         n-bit shift register with lsb output
-- Description:         n-bit shift register with lsb output
--
--
--
--
-- Dependencies:        none
-- Dependencies:        none
--
--
-- Revision:
-- Revision:
--      Revision 1.00 - Architecture
--      Revision 1.00 - Architecture
--      Revision 0.01 - File Created
--      Revision 0.01 - File Created
--
--
--
--
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
--
--
-- NOTICE:
-- NOTICE:
--
--
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
-- by other third parties!
-- by other third parties!
--
--
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
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;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
 
 
---- Uncomment the following library declaration if instantiating
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
---- any Xilinx primitives in this code.
--library UNISIM;
--library UNISIM;
--use UNISIM.VComponents.all;
--use UNISIM.VComponents.all;
 
 
entity x_shift_reg is
entity x_shift_reg is
        generic(  n : integer := 1536;
        generic(  n : integer := 1536;
                       t : integer := 48;
                       t : integer := 48;
                                tl : integer := 16
                                tl : integer := 16
        );
        );
        port(   clk : in  STD_LOGIC;
        port(   clk : in  STD_LOGIC;
         reset : in  STD_LOGIC;
         reset : in  STD_LOGIC;
          x_in : in  STD_LOGIC_VECTOR((n-1) downto 0);
          x_in : in  STD_LOGIC_VECTOR((n-1) downto 0);
        load_x : in  STD_LOGIC;
        load_x : in  STD_LOGIC;
        next_x : in  STD_LOGIC;
        next_x : in  STD_LOGIC;
                   p_sel : in  STD_LOGIC_VECTOR(1 downto 0);
                   p_sel : in  STD_LOGIC_VECTOR(1 downto 0);
           x_i : out  STD_LOGIC
           x_i : out  STD_LOGIC
        );
        );
end x_shift_reg;
end x_shift_reg;
 
 
architecture Behavioral of x_shift_reg is
architecture Behavioral of x_shift_reg is
        signal x_reg_i : std_logic_vector((n-1) downto 0); -- register
        signal x_reg_i : std_logic_vector((n-1) downto 0); -- register
        constant s : integer := n/t;   -- nr of stages
        constant s : integer := n/t;   -- nr of stages
        constant offset : integer := s*tl; -- calculate startbit pos of higher part of pipeline
        constant offset : integer := s*tl; -- calculate startbit pos of higher part of pipeline
begin
begin
 
 
        REG_PROC: process(reset, clk)
        REG_PROC: process(reset, clk)
        begin
        begin
                if reset = '1' then -- Reset, clear the register
                if reset = '1' then -- Reset, clear the register
                        x_reg_i <= (others => '0');
                        x_reg_i <= (others => '0');
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        if load_x = '1' then -- Load_x, load the register with x_in
                        if load_x = '1' then -- Load_x, load the register with x_in
                                x_reg_i <= x_in;
                                x_reg_i <= x_in;
                        elsif next_x = '1' then  -- next_x, shift to right. LSbit gets lost and zero's are shifted in
                        elsif next_x = '1' then  -- next_x, shift to right. LSbit gets lost and zero's are shifted in
                                x_reg_i((n-2) downto 0) <= x_reg_i((n-1) downto 1);
                                x_reg_i((n-2) downto 0) <= x_reg_i((n-1) downto 1);
                        else -- else remember state
                        else -- else remember state
                                x_reg_i <= x_reg_i;
                                x_reg_i <= x_reg_i;
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;
 
 
        with p_sel select  -- pipeline select
        with p_sel select  -- pipeline select
                x_i <= x_reg_i(offset) when "10",   -- use bit at offset for high part of pipeline
                x_i <= x_reg_i(offset) when "10",   -- use bit at offset for high part of pipeline
                                 x_reg_i(0) when others;    -- use LS bit for lower part of pipeline
                                 x_reg_i(0) when others;    -- use LS bit for lower part of pipeline
 
 
end Behavioral;
end Behavioral;
 
 
 
 

powered by: WebSVN 2.1.0

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