?? taxi.vhd
字號:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity taxi is
port (
clk,reset:in std_logic;--每來一個脈沖(代表運行了0.1公里)
en1:out std_logic; --超出起車里程開始記價使能信號(7元)
count1 :out std_logic_vector (3 downto 0);--――里程數值的十分位
count2 :out std_logic_vector (3 downto 0); --――里程數值的個位
count3 :out std_logic_vector (3 downto 0)); --――里程數值的十位
end taxi ;
architecture aa of taxi is
begin
process(clk,reset)
variable mm : std_logic_vector (11 downto 0);
begin
if reset='1' then
mm:="000000000000";
elsif clk'event and clk='1' then
if mm(3 downto 0)="1001" then--――十六進制轉換成十進制
mm:=mm+7;
else
mm:=mm+1;
end if;
if mm(7 downto 4)="1010" then
mm:=mm+"01100000";
end if;
end if;
if mm(11 downto 4)>"00000111" then
en1<='1';
else
en1<='0';
end if;
count1<=mm(3 downto 0);
count2<=mm(7 downto 4);
count3<=mm(11 downto 8);
end process;
end aa;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -