【文章內(nèi)容簡(jiǎn)介】
待計(jì)時(shí)使能控制信號(hào)en行程3公里外的使能控制信號(hào)en0。以及進(jìn)行滿量程清零。library ieee。 use 。 use 。 use 。 entity jiliang is port( s: in std_logic。 計(jì)量開(kāi)始信號(hào) fin: in std_logic。 計(jì)量路程的信號(hào) stop: in std_logic。 等待信號(hào) clk1: in std_logic。 計(jì)量驅(qū)動(dòng)信號(hào) en1,en0: buffer std_logic。 計(jì)量控制信號(hào) k1,k0: buffer std_logic_vector(3 downto 0)。 路程的計(jì)量 m1,m0: buffer std_logic_vector(3 downto 0))。 時(shí)間的計(jì)量 end jiliang。 architecture rt2 of jiliang is signal w:integer range 0 to 59。 begin process(clk1) begin if (clk139。event and clk1=39。139。) then 驅(qū)動(dòng)信號(hào)發(fā)揮作用 if s=39。039。 then w=0。en1=39。039。en0=39。039。m1=0000。m0=0000。 k1=0000。k0=0000。 初始化值 elsif stop=39。139。 then 等待信號(hào)為高時(shí)間控制信號(hào)開(kāi)始計(jì)時(shí) if w=59 then w=0。 if m0=1001 then m0=0000。 if m1=0101 then m1=0000。 else m1=m1+1。 end if。 else m0=m0+1。 end if。 計(jì)時(shí) if m1amp。m000000010then en1=39。139。 當(dāng)時(shí)間大于3min時(shí)使能信號(hào) en1開(kāi)始使能 else en1=39。039。 end if。 else w=w+1。en1=39。039。 end if。 elsif fin=39。139。 then