我的程序在下面!有错误,不知道怎么去改!
用MAX+PLUS2软件!有些语法是不支持的!
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity par_ser is
port(load,clk:in std_logic;
par_in:in std_logic_vector(7 downto 0);
busy:buffer std_logic;
ser_outut std_logic);
end par_ser;
architecture rtl of par_ser is
signal tmp:std_logic;
signal reg:std_logic_vector(7 downto 0);
begin
process(clk,load)
begin
if(clk'event and clk='1') then
if(load='1') then
reg<=par_in;
busy<='1';
end if;
if(tmp='1') then
busy<='0';
end if;
end if;
end process;
process(clk)
variable count:integer;
variable oreg:std_logic_vector(8 downto 0);
begin
if(clk'event and clk='1') then
if(busy='1') then
count:=0;
oreg:=reg & '0'; --reg左移一位
ser_out<=oreg(0);
tmp<='0';
end if;
for i in 0 to 7 loop
if(clk'event and clk='1') then
oreg:='0'&oreg((7+i) downto i); --oreg右移一位
ser_out<=oreg(0);
--count:=count-1;
end if;
end loop;
if(clk'event and clk='1') then
tmp<='1';
end if;
end if;
end process;
end rtl;