8.22.4程序设计与仿真。1.出租车计价器VHDL程序--文件名:taxi.hd--功能:出租车计价器--最后修改日期:2004.4.9libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitytaxiisport(clk_240:instd_logic;--频率为240Hz的时钟start:instd_logic;--计价使能信号stop:instd_logic;--等待信号fin:instd_logic;--公里脉冲信号cha3,cha2,cha1,cha0:outstd_logic_vector(3downto0);--费用数据km1,km0:outstd_logic_vector(3downto0);--公里数据min1,min0:outstd_logic_vector(3downto0));--等待时间endtaxi;architecturebehavoftaxiissignalf_15,f_16,f_1:std_logic;--频率为15Hz,16Hz,1Hz的信号signalq_15:integerrange0to15;--分频器signalq_16:integerrange0to14;--分频器signalq_1:integerrange0to239;--分频器signalw:integerrange0to59;--秒计数器signalc3,c2,c1,c0:std_logic_vector(3downto0);--制费用计数器signalk1,k0:std_logic_vector(3downto0);--公里计数器signalm1:std_logic_vector(2downto0);--分的十位计数器signalm0:std_logic_vector(3downto0);--分的个位计数器signalen1,en0,f:std_logic;--使能信号beginfeipin:process(clk_240,start)beginifclk_240'eventandclk_240='1'thenifstart='0'thenq_15<=0;q_16<=0;f_15<='0';f_16<='0';f_1<='0';f<='0';elseifq_15=15thenq_15<=0;f_15<='1';--此语句得到频率为15Hz的信号elseq_15<=q_15+1;f_15<='0';endif;ifq_16=14thenq_16<=0;f_16<='1';--此语句得到频率为16Hz的信号elseq_16<=q_16+1;f_16<='0';endif;ifq_1=239thenq_1<=0;f_1<='1';--此语句得到频率为1Hz的信号elseq_1<=q_1+1;f_1<='0';endif;ifen1='1'thenf<=f_15;--此语句得到计费脉冲felsifen0='1'thenf<=f_16;elsef<='0';endif;endif;endif;endprocess;process(f_1)beginiff_1'eventandf_1='1'thenifstart='0'thenw<=0;en1<='0';en0<='0';m1<="000";m0<="0000";k1<="0000";k0<="0000";elsifstop='1'thenifw=59thenw<=0;--此语句完成等待计时ifm0="1001"thenm0<="0000";--此语句完成分计数ifm1<="101"thenm1<="000";elsem1<=m1+1;endif;elsem0<=m0+1;endif;ifm1&m0>"0000001"thenen1<='1';--此语句得到en1使能信号elseen1<='0';endif;elsew<=w+1;en1<='0';endif;elsiffin='1'thenifk0="1001"thenk0<="0000";--此语句完成公里脉冲计数ifk1="1001"thenk1<="0000";elsek1<=k1...