|
技术交流 | 电路欣赏 | 工控天地 | 数字广电 | 通信技术 | 电源技术 | 测控之家 | EMC技术 | ARM技术 | EDA技术 | PCB技术 | 嵌入式系统 驱动编程 | 集成电路 | 器件替换 | 模拟技术 | 新手园地 | 单 片 机 | DSP技术 | MCU技术 | IC 设计 | IC 产业 | 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); --楼层指示及楼层数计数器 signal wai_t : std_logic_vector (2 downto 0); --运行或等待计数器 signal divide1,hand: std_logic; --时钟2分频和楼选复位变量 signal ladd: std_logic_vector (1 downto 0); --电梯运行状态变量 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 --该进程完成电梯将来运行状态的判断输出 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 发布:
可能跟中文注释有关 去掉中文注释试试 |
|
|
Copyright © 1998-2006 tgdrjb.cn 浙ICP证030469号 |