文件名称:基于vhdld的出租车计费器设计
文件大小:4.13MB
文件格式:RAR
更新时间:2013-02-15 06:43:33
出租车计费器
此计费器与事实相符,可直接用于出租车 --计费模块 library ieee; use ieee.std_logic_1164.all; use IEEE.STD_LOGIC_arith.ALL; use ieee.std_logic_unsigned.all; entity JIFEI is port(start,stop,js:in std_logic; LUCHEN:in INTEGER RANGE 0 TO 999; CLK_1:IN STD_LOGIC; DENGDAI:OUT INTEGER RANGE 0 TO 9; CHEFEI:out integer RANGE 0 TO 9999); end JIFEI; architecture BEHAV of JIFEI is signal CF:integer RANGE 0 TO 9999; signal JSH1:integer range 0 to 179; signal JSH2:integer range 0 to 59; SIGNAL DD: INTEGER RANGE 0 TO 9; begin process(LUCHEN,CLK_1,start,stop,js) begin IF CLK_1'EVENT AND CLK_1='1' THEN if stop='1' then CF<=0; DD<=0; end if; IF start='1' and stop='0' then if js='1' then if LUCHEN<2 then CF<=60; END IF; if 2<=LUCHEN AND LUCHEN<10 THEN CF<=CF+14; end if; if LUCHEN>=10 THEN CF<=CF+21; END IF; END IF; IF JS='0' THEN IF JSH1=179 THEN JSH1<=0; CF<=CF+7; ELSE JSH1<=JSH1+1; IF JSH2=59 THEN DD<=DD+1; JSH2<=0; ELSE JSH2<=JSH2+1; END IF; END IF; END IF; END IF; END IF; end process; DENGDAI<=DD; CHEFEI<=CF; end BEHAV;