qq_29628385 2016-04-25 02:53 采纳率: 0%
浏览 1561
已结题

vhdl错误,急求帮忙看一下

错误是:syntax error:near text"end process ",expecting"if"自己没找到T。T
我就把结构体里面的贴出来,求帮忙
architecture behav of dianti is

signal d11,d22,d33,d44,d55,d66: std_logic;
signal c_u11,c_u22,c_u33,c_u44,c_u55: std_logic;
signal c_d22,c_d33,c_d44,c_d55,c_d66: std_logic;
signal q: integer range 0 to 1;
signal q1: integer range 0 to 6;
signal q2: integer range 0 to 9;
signal dd,cc_u,cc_d,dd_cc: std_logic_vector(5 downto 0);
signal opendoor: std_logic;
signal updown: std_logic;
signal en_up,en_dw: std_logic;

begin
process(clk)

begin

if clk'event and clk='1' then
    if clr='1' then q1<=0;q2<=0;wahaha<='0';
    elsif full='1' then alarm<='1';q1<=0;
        if q1>=3 then door<="10";
        else door<="00";
        end if;
    elsif q=1 then q<=0;alarm<='0';
        if q2=3 then wahaha<='1';
        else
              if opendoor='1' then door<="10";q1<=0;q2<=0;up<='0';down<='0';
            elsif en_up='1' then
                if deng='1' then door<="10";q1<=0;q2<=q2+1;
                elsif quick='1' then q1<=3;
                elsif q1>3 then door<="01";q1<=q1+1;
                elsif q1=6 then door<="00";updown<='1';up<='1';
                else  q1<=q1+1;door<="00";
                end if;
            elsif en_dw='1' then
                if deng='1' then door<="10";q1<=0;q2<=q2+1;
                elsif quick='1' then q1<=3;
                elsif q1>3 then door<="01";q1<=q1+1;
                elsif q1=6 then door<="00";updown<='0';down<='1';
                else  q1<=q1+1;door<="00";
                end if;
            end if;

            if g1='1' then led<="1001111";
                if d11='1' or c_u11='1' then dll<='0';c_u11<='0';opendoor<='1';
                elsif dd_cc>"00000001" then en_up<='1';en_dw<='0';openfoor<='0';
                elsif dd_cc="00000000" then opendoor<='0';
                end if;

            elsif g2='1' then led<="0010010";
                if updown='1' then
                    if d22='1' or c_u22='1' then d22<='0';c_u22<='0';opendoor<='1';
                    elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                    elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                    end if;
                elsif updown='0' then
                    if d22='1' or c_d22='1' then d22<='0';c_d22<='0';opendoor<='1';
                    elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                    elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                    end if;

            elsif g3='1' then led<="0000110";
                if updown='1' then
                    if d33='1' or c_u33='1' then d33<='0';c_u33<='0';opendoor<='1';
                    elsif dd_cc>"00000111" then en_up<='1';en_dw<='0';opendoor<='0';
                    elsif dd_cc<"00000100" then en_dw<='1';en_up<='0';opendoor<='0';
                    end if;
                elsif updown='0' then
                    if d33='1' or c_d33='1' then d33<='0';c_d33<='0';opendoor<='1';
                    elsif dd_cc<"00000100" then en_dw<='1';en_up<='0';opendoor<='0';
                    elsif dd_cc>"00000111" then en_up<='1';en_dw<='0';opendoor<='0';
                    end if;

            elsif g4='1' then led<="1001100";
                if updown='1' then
                    if d44='1' or c_u44='1' then d44<='0';c_u44<='0';opendoor<='1';
                    elsif dd_cc>"00001111" then en_up<='1';en_dw<='0';opendoor<='0';
                    elsif dd_cc<"00001000" then en_dw<='1';en_up<='0';opendoor<='0';
                    end if;
                elsif updown='0' then
                    if d44='1' or c_d44='1' then d44<='0';c_d44<='0';opendoor<='1';
                    elsif dd_cc<"00001000" then en_dw<='1';en_up<='0';opendoor<='0';
                    elsif dd_cc>"00001111" then en_up<='1';en_dw<='0';opendoor<='0';
                    end if;

            elsif g5='1' then led<="0100100";
                if updown='1' then
                    if d55='1' or c_u55='1' then d55<='0';c_u55<='0';opendoor<='1';
                    elsif dd_cc>"00011111" then en_up<='1';en_dw<='0';opendoor<='0';
                    elsif dd_cc<"00010000" then en_dw<='1';en_up<='0';opendoor<='0';
                    end if;
                elsif updown='0' then
                    if d55='1' or c_d55='1' then d55<='0';c_d55<='0';opendoor<='1';
                    elsif dd_cc<"00010000" then en_dw<='1';en_up<='0';opendoor<='0';
                    elsif dd_cc>"00011111" then en_up<='1';en_dw<='0';opendoor<='0';
                    end if; 

            elsif g6='1' then led<="0100000";
                if d66='1'or c_d66='1' then d66<='0';c_d66<='0';opendoor<='1';
                elsif dd_cc<"10000000" then en_dw<='1';en_up<='0';opendoor<='0';
                end if;

            else 
                en_up<='0';en_dw<='0';

            end if;

        end if;

    else 
        q<=1;alarm<='0';

        if d1='1' then d11<=d1;
        elsif d2='1' then d22<=d2;
        elsif d3='1' then d33<=d3;
        elsif d4='1' then d44<=d4;
        elsif d5='1' then d55<=d5;
        elsif d6='1' then f66<=d6;
        end if;

        if c_u1='1' then c_u11<=c_u1;
        elsif c_u2='1' then c_u22<=c_u2;
        elsif c_u3='1' then c_u33<=c_u3;
        elsif c_u4='1' then c_u44<=c_u4;
        elsif c_u5='1' then c_u55<=c_u5;
        end if;

        if c_d2='1' then c_d22<=c_d2;
        elsif c_d3='1' then c_d33<=c_d3;
        elsif c_d4='1' then c_d44<=c_d4;
        elsif c_d5='1' then c_d55<=c_d5;
        elsif c_d6='1' then c_d66<=c_d6;
        end if;

        dd<=d66 & d55 & d44 & d33 & d22 & d11;
        cc_u<='0' & c_u55 & c_u44 & c_u33 & c_u22 & c_u11;
        cc_d<=c_d66 & c_d55 & c_d44 & c_d33 & c_d22 & '0';
        dd_cc<= dd or cc_u or cc_d;
    end if;
    ud<=updown;
    led_d<=dd;
    led_c_u<=cc_u;
    led_c_d<=cc_d;
    end if;
end process;

end behav;

  • 写回答

1条回答 默认 最新

  • sleeplessvenus 2016-05-09 04:12
    关注

    原文中类似这样的格式

                 elsif g2='1' then led<="0010010";
                    if updown='1' then
                        if d22='1' or c_u22='1' then d22<='0';c_u22<='0';opendoor<='1';
                        elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                        elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                        end if;
                    elsif updown='0' then
                        if d22='1' or c_d22='1' then d22<='0';c_d22<='0';opendoor<='1';
                        elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                        elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                        end if;
    
                elsif g3='1' then led<="0000110";
    
    

    全部改为下列格式

                 elsif g2='1' then led<="0010010";
                    if updown='1' then
                        if d22='1' or c_u22='1' then d22<='0';c_u22<='0';opendoor<='1';
                        elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                        elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                        end if;
                    else
                        if d22='1' or c_d22='1' then d22<='0';c_d22<='0';opendoor<='1';
                        elsif dd_cc<"00000010" then en_dw<='1';en_up<='0';opendoor<='0';
                        elsif dd_cc>"00000011" then en_up<='1';en_dw<='0';opendoor<='0';
                        end if;
                    end if;
    
                elsif g3='1' then led<="0000110";
    
    

    另外用了太多的elsif, 不如试试 case 语句, 时序还能好点

    评论

报告相同问题?

悬赏问题

  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题