[an error occurred while processing this directive]
|
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity shifter is
port(
--************* Host interface ************%
clk :in std_logic
;res :in std_logic
;data :in std_logic_vector(15 downto 0)-- Internal buffer register
;write :in std_logic -- Wr buffer
--************ device interface *************%
;SH_SDATA :out std_logic
;SH_CLK :out std_logic
;
);
end shifter;
architecture Arc of shifter is
signal Dbuf : std_logic_vector(15 downto 0);
--**********************************************
begin
SH_CLK<=clk;
LD_buf: process(clk) begin -- data buffer
if clk='1' and clk'event then
if res='1' then
Dbuf<=(others=>'0');
elsif write='1' then
Dbuf<=data;
end if;
end if;
end process;
LBitsCnt: process(AMP_CLK)
subtype TBitsCnt is integer range 0 to 16;
variable BitsCnt : TBitsCnt; --counter of sending bits
begin
if clk='0' and clk'event then
if res='1' then
BitsCnt:= 0;
elsif write='1' then
BitsCnt:=TBitsCnt'high;
elsif BitsCnt > 0 then
BitsCnt:=BitsCnt-1;
SH_SDATA<=Dbuf(BitsCnt);
elsif BitsCnt = 0 then
SH_SDATA<=Dbuf(BitsCnt);
end if;
end if;
end process;
end shifter;
E-mail: info@telesys.ru