热门

最新

红包

立Flag

投票

同城

我的

发布
m0_70073800
m0_70073800
4 年前
truem0_70073800

VHDL错误:各位大佬,这是哪里错了啊,真的给孩子整崩溃了
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity lucheng is
port(clkl,start,rst,pause:in std_logic;
cost_1,mileage:out integer range 0 to 8000;
p:out std_logic);
end lucheng;
architecture analog of lucheng is
begin
process(clkl,start,rst,pause)
variable a,c:std_logic;
variable b:integer range 0 to 50;
variable cos,mile:integer range 0 to 8000;
begin
if(clkl'event and clkl='1')then
if(rst='1')then --车停止,未开动时
cos:=0;
b:=0;
mile:=0;
elsif(start='0')then
a:='0';
cos:=100;
mile:=0; --计价器未开始计价工作时
elsif(start='1'and pause='0')then
mile:=mile+1;
b:=b+1;
end if;
if(b>=50)then
a:='1';
b:=0;
else
a:='0';
end if;
if(mile<300)then
c:='0';
elsif(cos<200 and a='1')then --超过起步路程后,价格小于20元,2元/公里
cos:=cos+10; --每次计费是1元
c:='1'; --超出起步价标志
elsif(cos>=200 and a='1')or(mile>=900 and a='1')then --超过20元或9公里后每公里加收50%车费
cos:=cos+15; --每次计费是500米加1.5元
c:='1';
end if;
end if;
cost_1<=cos;
mileage<=mile;
p<2c;
end process;
end analog;

CSDN App 扫码分享
分享
评论
1
打赏
  • 复制链接
  • 举报
下一条:
3000粉啦,谢谢大家支持!
立即登录