2017-12-12 6 views
-2

場合:私はプログラムを望んでいたVHDL - ネストされた私は、この(文は不要ですが、私は今のためにそれを無視していた場合、私は中に条件のいくつかを知っている)のようなVHDLで定義されたプロセス持っ文

LSPflag : process(xcolumn, yrow, picture_q_s) -- output of process depends on xcolumn and yrow 
    variable RGB : RGB_type; -- output colors 
    variable x, y, zx,zy : integer; -- renamed xcolumn and yrow 
    variable isPicture:boolean; 
    begin 
     x:=to_integer(xcolumn); y:=to_integer(yrow); -- convert to integer 
     zy:= To_integer(unsigned(xyoffset)); 
     zx:= (To_integer(unsigned(xyoffset))*XSIZE)/YSIZE; 
     RGB:=BLACK; 
     if zy>360 then 
     --do stuff1 with if statements 
     end if; 
     if zy>240 then 
     --do stuff2 with if statements 
     end if; 
     if zy>120 then 
     --do stuff3 with if statements 
     else 
      isPicture:= x>=EMBORGX+centerx-zx and x<EMBORGX+MEMROWSIZE+centerx-zx and y>=EMBORGY+centery+zy and y<EMBORGY+MEMROWCOUNT+centery+zy;    
      if isPicture and picture_q_s = '1' then--bottomleft corner 
       RGB:=YELLOW or RGB; 
      end if; 
      if y*XSIZE<=-YSIZE*x+YSIZE*XSIZE+(centery-zy)*XSIZE+(centerx-zx)*YSIZE and x>=centerx-zx and x<=XSIZE+centerx-zx and y>=centery-zy and y<=YSIZE+centery-zy then--upperleft corner 
       RGB:=WHITE or RGB; 
      end if; 
      if y*XSIZE>-YSIZE*x+YSIZE*XSIZE+(centery-zy)*XSIZE+(centerx+zx)*YSIZE and x>=centerx+zx and x<=XSIZE+centerx+zx and y>=centery-zy and y<=YSIZE+centery-zy and y*XSIZE<YSIZE*x-(2*zy)*XSIZE then--upperright corner 
       RGB:=RED or RGB; 
      end if; 
      if y*XSIZE>-YSIZE*x+YSIZE*XSIZE+(centery+zy)*XSIZE+(centerx+zx)*YSIZE and x>=centerx+zx and x<=XSIZE+centerx+zx and y>=centery+zy and y<=YSIZE+centery+zy and y*XSIZE>YSIZE*x then--bottomright corner 
       RGB:=BLUE or RGB; 
      end if; 
      if isPicture then 
       picture_address_s <= std_logic_vector(to_unsigned((y-EMBORGY-centery-zy)*MEMROWSIZE + (x-EMBORGX-centerx+zx), picture_address_s'LENGTH)); 
      else 
       picture_address_s <=(others=>'0'); 
      end if; 
     end if; 
     VGA_R<=RGB.R; VGA_G<=RGB.G; VGA_B<=RGB.B; 
    end process; 

をそれが真のものを見つけた後で4つの外部条件のチェックを止める。 上記のように書くと動作しますが、常に3つの条件のうち最初にチェックします。 私はこのような何かしようとしていた。

 if zy>360 then 
     --do stuff with if statements1   
     else if zy>240 then 
     --do stuff with if statements2 
     else if zy>120 then 
     --do stuff with if statements3 
     else 
      isPicture:= x>=EMBORGX+centerx-zx and x<EMBORGX+MEMROWSIZE+centerx-zx and y>=EMBORGY+centery+zy and y<EMBORGY+MEMROWCOUNT+centery+zy;    
      if isPicture and picture_q_s = '1' then--bottomleft corner 
       RGB:=YELLOW or RGB; 
      end if; 
      if y*XSIZE<=-YSIZE*x+YSIZE*XSIZE+(centery-zy)*XSIZE+(centerx-zx)*YSIZE and x>=centerx-zx and x<=XSIZE+centerx-zx and y>=centery-zy and y<=YSIZE+centery-zy then--upperleft corner 
       RGB:=WHITE or RGB; 
      end if; 
      if y*XSIZE>-YSIZE*x+YSIZE*XSIZE+(centery-zy)*XSIZE+(centerx+zx)*YSIZE and x>=centerx+zx and x<=XSIZE+centerx+zx and y>=centery-zy and y<=YSIZE+centery-zy and y*XSIZE<YSIZE*x-(2*zy)*XSIZE then--upperright corner 
       RGB:=RED or RGB; 
      end if; 
      if y*XSIZE>-YSIZE*x+YSIZE*XSIZE+(centery+zy)*XSIZE+(centerx+zx)*YSIZE and x>=centerx+zx and x<=XSIZE+centerx+zx and y>=centery+zy and y<=YSIZE+centery+zy and y*XSIZE>YSIZE*x then--bottomright corner 
       RGB:=BLUE or RGB; 
      end if; 
      if isPicture then 
       picture_address_s <= std_logic_vector(to_unsigned((y-EMBORGY-centery-zy)*MEMROWSIZE + (x-EMBORGX-centerx+zx), picture_address_s'LENGTH)); 
      else 
       picture_address_s <=(others=>'0'); 
      end if; 
     end if; 

をしかし、それは互換性のないですし、文がテキストプロセスの近くに期待されている場合、それは言います。

+0

これはC言語のコードによく似ています。 [mcve]を挙げてください。 – JHBonarius

+0

私の意見では問題にはあまり関係ないので、ここには載せたくありませんでしたが、投稿で編集しました。 –

+0

あなたの編集は、最小、完全、および検証可能な例ではなく、最小、完全、または検証可能ではありません。あなたの投稿は同じコードスニペットを3回表示しています。私たちはそれをシミュレートすることはできませんので、あなたの問題は見えません。コメントなしで高度に統合されたコードをデバッグするようにお願いしています。申し訳ありませんが、時間がかかりすぎます。 – JHBonarius

答えて

0

BrianDrummondが私に思い出させるように、問題はelsifではなくelse ifと書いていたことです。

関連する問題