library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity serial_out is
port (
clkin : in std_logic;
cntout:in std_logic_vector(7 downto 0); --锁存计数器,由外界控制
parallel:in std_logic_vector(13 downto 0);
serial ut std_logic
);
end entity;
architecture behav of serial_out is
signal temp :std_logic_vector(31 downto 0);
begin
process(clkin,cntout,temp)
variable i:integer range 0 to 31;
begin
if clkin'event and clkin='1' then
if cntout=0 then
temp(9 downto 0)<="0101010101";
temp(23 downto 10)<=parallel;
temp(31 downto 24)<="11100100";
i:=31;
else
i:=i-1;
end if;
end if;
serial<=temp(i);
end process;
end behav;