2017-12-12 2 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 가지 외부 상태를 체크하는 것을 멈추게한다. 위와 같이 작성하면 작동하지만 세 가지 조건 중 첫 번째를 항상 확인합니다. 내가 이런 일을하려고했다 :

 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; 

을하지만 그것은 uncompilable하고 문이 텍스트 공정 근처 예상되는 경우를 말한다.

+0

이 코드는 VHDL과 비슷한 C 코드입니다. 제발 [mcve]를주세요. – JHBonarius

+0

내 생각에이 문제와 관련이 없으므로 여기에 표시하고 싶지 않지만 게시물에서 편집했습니다. –

+0

수정 사항은 최소, 완전 및 검증 가능한 예가 아니며 최소, 완전 또는 검증 할 수 없습니다. 귀하의 게시물은 동일한 코드 스 니펫을 3 번 보여줍니다. 우리는 그것을 시뮬레이션 할 수 없으므로 귀하의 문제를 볼 수 없습니다. 주석없이 고도로 통합 된 코드를 디버깅 해달라고 요청하는 것입니다. 미안하지만 그건 너무 많은 시간이 걸릴거야. – JHBonarius

답변

0

BrianDrummond가 나를 상기시키면서, 문제는 내가 elsif 대신에 'else if'라고 썼다는 것이다.