|
|||||||||||
| 技術交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術 | 電源技術 | 測控之家 | EMC技術 | ARM技術 | EDA技術 | PCB技術 | 嵌入式系統(tǒng) 驅(qū)動編程 | 集成電路 | 器件替換 | 模擬技術 | 新手園地 | 單 片 機 | DSP技術 | MCU技術 | IC 設計 | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe |
難題一個,高手幫忙解圍 |
| 作者:yyb1982 欄目:EDA技術 |
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity lift is PORT( clkin: in std_logic; upin: in std_logic; downin: in std_logic; st_ch: in std_logic; CLOSE: in std_logic; delay: in std_logic; run_stop: in std_logic; lamp: out std_logic; run_wait : out std_logic_vector (3 downto 0); st_out : out std_logic_vector (3 downto 0); direct : out std_logic_vector (3 downto 0) ); end lift; architecture lift_arch of lift is signal ur,dr : std_logic_vector (6 downto 1); --上升或下降樓層請求寄存器 signal dir,liftor : std_logic_vector (2 downto 0); --樓層指示及樓層數(shù)計數(shù)器 signal wai_t : std_logic_vector (2 downto 0); --運行或等待計數(shù)器 signal divide1,hand: std_logic; --時鐘2分頻和樓選復位變量 signal ladd: std_logic_vector (1 downto 0); --電梯運行狀態(tài)變量 signal CLOSEx,delayx: std_logic; --提前關門及延時變量 begin direct<='0'&dir+1; st_out<='0'&liftor+1; run_wait<='0'&wai_t; lamp<=ladd(1); hand<=wai_t(2) and (not wai_t(1)) and wai_t(0); CLOSEx<=CLOSE and (not ladd(1)); delayx<=delay and (not ladd(1)); p1:PROCESS(clkin) begin if (clkin'event and clkin='1') then divide1<=not divide1; if (dir="101") then dir<="000"; else dir<=dir+1; end if; end if; end PROCESS p1; p2:PROCESS (ur,dr,dir,upin,downin,st_ch,liftor,wai_t,run_stop,hand) variable num,t:integer; begin --該進程完成樓層請求寄存器的位置與復位 num:=conv_integer(liftor)+1; t:=conv_integer(dir)+1; if (run_stop='1') then if (((t>num)and(st_ch='1'))or(upin='1')) then ur(t)<='1'; elsif (hand='1') then ur(num)<='0'; end if; if (((t<num)and(st_ch='1'))or(downin='1')) then dr(t)<='1'; elsif (hand='1') then dr(num)<='0'; end if; else ur<="000000"; dr<="000000"; end if; end PROCESS p2; p3:PROCESS(ur,dr,liftor,ladd,wai_t,run_stop) begin --該進程完成電梯將來運行狀態(tài)的判斷輸出 if (run_stop='1') then if (wai_t="110") then if((ur or dr)="000000")then ladd(1)<='0'; else case liftor is when "000"=>if ((ur(1)or dr(1))>'0') then ladd(1)<='0'; else ladd<="11"; end if; when "001"=>if ((ur(2)or dr(2))>'0' )then ladd(1)<='0'; elsif (((ladd(0)='1')and((ur(6 downto 3) or dr(6 downto 3))>"0000"))or((ur(1)or dr(1))='0' then ladd <="11"; else ladd<="10"; end if; when "010"=>if ((ur(3)or dr(3))>'0') then ladd(1)<='0'; elsif (((ladd(0)='1')and((ur(6 downto 4) or dr(6 downto 4))>"000"))or((ur(2 downto 1)or dr(2 downto 1)) ="00")) then ladd<="11"; else ladd<="10"; end if; when "011"=>if ((ur(4)or dr(4))>'0')then ladd(1)<='0'; elsif (((ladd(0)='1')and((ur(6 downto 5) or dr(6 downto 5))>"00"))or((ur(3 downto 1)or dr(3 downto 1)) ="000")) then ladd<="11"; else ladd<="10"; end if; when "100"=>if ((ur(5)or dr(5))>'0') then ladd(1)<='0'; elsif (((ladd(0)='1')and((ur(6) or dr(6))>'0')) or((ur( 4 downto 1)or dr(4 downto 1))="0000")) then ladd <="11"; else ladd<="10"; end if; when "101"=>if ((ur(6)or dr(6))>'0') then ladd(1)<='0'; else ladd<="10"; end if; when other=>null; end case; end if; end if; else ladd<="00"; end if; end PROCESS p3; p4:PROCESS(wai_t,ladd,CLOSEx,delayx) --該進程完成隨電梯運行樓層的相應增減 begin --并響應提前關門和延時關門請求 if (divide1'event and divide1='1') then if(wai_t="000" or CLOSEx='1') then wai_t<="110"; else if (delayx='0') then wai_t<=wai_t-1; else wai_t<="010"; end if; if(wai_t="001") then if(ladd="11")then liftor<=liftor+1; elsif (ladd="10")then liftor<=liftor-1; end if; end if; end if; end if; end PROCESS p4; end lift_arch; 編譯提示一個錯,請高手幫忙解圍 它得提示信息是這樣得“vhdl syntax erreor:unexpected end-of-file-try using the Text Edittor Syntax Coloring command to find the missing delimiter or keyword”哪位高手能解圍,請各位高手各顯神通。謝謝 |
| 2樓: | >>參與討論 |
| 作者: oaipoaip 于 2006/3/28 9:15:00 發(fā)布:
可能跟中文注釋有關 去掉中文注釋試試 |
|
|
|
| 免費注冊為維庫電子開發(fā)網(wǎng)會員,參與電子工程師社區(qū)討論,點此進入 |
Copyright © 1998-2006 udpf.com.cn 浙ICP證030469號 |