vhdl语言翻译

[复制链接]
查看11 | 回复0 | 2008-7-3 10:39:08 | 显示全部楼层 |阅读模式
大家帮我看看这段程序,我关键不知道里面定义了的a和b是什么意思
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity jifei is
port (clk,start,stop,pause,js:in std_logic;

chefei,luc
: out integer range 0 to 8000);
end jifei;
architecture rtl of jifei is
begin
process(clk,start,stop,pause,js)
variable a,b : std_logic;
variable aa: integer range 0 to 100;
variable chf,lc: integer range 0 to 8000;
variable num: integer range 0 to 9;

begin
if(clk'event and clk='1')then
if(stop='0')then
chf:=0;
num:=0;
b:='1';
aa:=0;
lc:=0;
elsif(start='0')then
b:='0';
chf:=700;
lc:=0;
elsif(start='1' and js='1'and pause='1')then
if(b='0')then
num:=num+1;
end if;
if(num=9)then
lc:=lc+5;
num:=0;
aa:=aa+5;
end if;
elsif(start='1'and js='0'and pause='1')then
lc:=lc+1;
aa:=aa+1;
end if;
if(aa>=100)then
a:='1';
aa:=0;
else
a:='0';
end if;
if(lc=2000 and a='1')then

chf:=chf+330;
end if;
end if;
chefei=20时,车费一公里加3.30元。b是为了让stop、start、js的控制能够有正确的顺序。若js=1,则只有按了stop后,又让start=0,使车费初始化为7.00元,使b=0,然后再start=1开始计费,10个时钟
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行