lemmon8017
驱动牛犊
驱动牛犊
  • 注册日期2005-06-01
  • 最后登录2005-06-20
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1799回复:2

急!!!求哪位帮忙看一下程序哪里错(VHDL语言)

楼主#
更多 发布于:2005-06-17 13:20
在MAXPLUS II 9.23版下编译通不过。说有一个错误,但是提示是一堆乱七八糟的符号,不知道该怎么改。
急求哪位高手帮忙指点一下!!!!
请一定要帮帮忙!!!
多谢!!
我的邮箱是lemmon8017@163.com


程序是HDLC的发送部分。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity transmit is
port(
clk: in std_logic;
data_in: in std_logic;--串行数据输入端
reset: in std_logic;
data_out: out std_logic--发送数据端
     );
end transmit;

architecture tran of transmit is
--定义全局信号
signal crc_begin: std_logic;--CRC 校验开始的控制信号
signal test_11111_reg:std_logic_vector(4 downto 0); --检测五连一的寄存器
signal test_11111_begin:std_logic;
                            --五连一寄存器的控制信号
signal buf_save: std_logic_vector(35 downto 0);
                           --定义储存外部输入的串行数据的buffer
signal buf1: std_logic_vector(35 downto 0);
signal crc_reg: std_logic_vector(51 downto 0);
                            --CRC 处理时,添零后的数据
signal crc_out,crc_out_tmp: std_logic_vector(51 downto 0);
                             ---添加了CRC码的数据
signal buf2: std_logic_vector(69 downto 0);
signal d_7e: std_logic_vector(77 downto 0);

signal tr: std_logic_vector(77 downto 0);

signal data_in_count: std_logic_vector(5 downto 0);
signal data_latch_flag,data_out_flag: std_logic;  

begin

process (clk,data_in,buf_save,reset)
begin
    if(reset=\'0\')then
        data_in_count<=\"000000\";
    elsif clk\'event and clk=\'1\' then
                                     --时钟上升沿时
            buf_save(0)<=data_in;
              
            for i in 34 downto 0 loop
                buf_save(i+1)<=buf_save(i);
            end loop;
            if(data_in_count<38)then
                data_in_count<=data_in_count+1;
            else
                data_in_count<=\"100110\";
            end if;
    end if ;

end process;


process(clk,data_in_count)
begin
    if(clk\'event and clk=\'1\')then
        if(data_in_count=35)then
            data_latch_flag<=\'1\';
        else
            data_latch_flag<=\'0\';
        end if;
        if(data_in_count=36)then
            data_out_flag<=\'1\';
        else
            data_out_flag<=\'0\';
        end if;
        
    end if;
end process;

 process(data_latch_flag,buf_save)
      --定义中间变量
      variable c: std_logic_vector(15 downto 0);
      variable p: std_logic_vector(16 downto 0);
      variable d: std_logic_vector(16 downto 0);--定义滑块变量
 
      begin
              
          if(data_latch_flag=\'1\')then
              buf1<=buf_save;
              crc_reg<=buf_save&c;  --在数据后添16个0
              d(15 downto 0) := buf_save(35 downto 20);
              c:=\"0000000000000000\";
              p:=\"10001000000100001\";
          else
              
          for k in 1 downto 0 loop
          if(k>0)then    
              for i in 36 downto 1 loop --前36次计算
                  if(i>0)then
                  
                     if d(16)=\'0\' then
              
                     --如果d的最高位为0则做异或\'0\'的运算
                            for j in 15 downto 0 loop
                                   c(j):=d(j) xor \'0\';
                            end loop;
                     else  

                  --如果d的最高位为1,由变量d和变量p做异或运算
                            
                             for j in 15 downto 0 loop
                                  c(j):=d(j) xor p(j);
                             end loop;
                     end if; --if d(16)=\'0\'

                    d:=c&crc_reg(i-1);--d往后滑动一位
                  
                  else
                  
                       if d(16)=\'0\' then --最后一次计算
                          for j in 15 downto 0 loop
                              c(j):=d(j) xor \'0\';
                          end loop;
                      else
                          for j in 15 downto 0 loop
                              c(j):=d(j) xor p(j);
                          end loop;
                      end if;
                        
                  end if; --if(i>0)      
              
              end loop;
          else
              crc_out_tmp<=buf1&c;
          end if; --if(k>0)
          end loop;    
          end if; --if(data_latch_flag=\'1\')
      
          
end process;


process(crc_out_tmp)
begin

for n in 2 downto 0 loop
if(n >1)then
    crc_out<=crc_out_tmp;
elsif(n>0)then
    for m in 2 downto 0 loop
        if(m>1)then -- m==2
            buf2(7 downto 0)<=\"01111110\";          
        elsif(m > 0) then -- m==1
            for i in 50 downto 0 loop
                for k in 1 downto 0 loop
                    if(k>0)then
                        buf2(0)<=crc_out(51);
                        for l in 60 downto 0 loop
                        buf2(l+1)<=buf2(l);
                        end loop;
                
                        crc_out(i+1)<=crc_out(i);
                
                    else
            
                        if(buf2(4 downto 0)=\"11111\")then
                            for j in 60 downto 0 loop
                            buf2(j+1)<=buf2(j);
                            end loop;
                            buf2(0)<=\'0\';
                          
                        end if;
                    end if; -- if k
                end loop; -- k loop
            end loop; -- i loop
        else -- m==0
        for k in 1 downto 0 loop
            if(k>0)then
                buf2(0)<=crc_out(51);
                for l in 60 downto 0 loop
                    buf2(l+1)<=buf2(l);
                end loop;
            else
            
                if(buf2(4 downto 0)=\"11111\")then
                    for j in 60 downto 0 loop
                        buf2(j+1)<=buf2(j);
                    end loop;
                    buf2(0)<=\'0\';
                    
                end if;
            end if; -- if k
        end loop; -- k loop
        end if; -- if m
    end loop; -- m loop                        
else
    d_7e( 77 downto 0 ) <= buf2( 69 downto 0 )&\"01111110\";
end if; -- if n
end loop; -- n loop    

end process;
                        
process(clk,d_7e)
begin
    
    if( clk\'event and clk=\'1\')then
        if(data_out_flag=\'1\')then
            tr<=d_7e;
        else
            data_out<=tr(77);
            for i in 76 downto 0 loop
                tr(i+1)<=tr(i);
            end loop;
        end if;
    end if;
end process;
            
end tran;
brian_em
驱动牛犊
驱动牛犊
  • 注册日期2004-10-12
  • 最后登录2005-11-30
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2005-06-20 16:56
编译能通过呀,就是警告多
wind_jly
驱动牛犊
驱动牛犊
  • 注册日期2005-06-21
  • 最后登录2005-11-28
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望2点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2005-06-25 15:43
请问:\"0000000"\里的 \ 是什么意思?
游客

返回顶部