【正文】
VHDL語(yǔ)言 library ieee。entity ctrl is port(left,right:in std_logic。end ctrl。 begin tmp:=leftamp。 case tmp is when00=lfen=39。 rten=39。 lr=39。 when01=lfen=39。 rten=39。 lr=39。 when10=lfen=39。 rten=39。 lr=39。 when others=lfen=39。 rten=39。 lr=39。 end case。end a。當(dāng)兩個(gè)都沒輸入,輸出選擇LR清零端。當(dāng)left為高電平時(shí),lfen也為高,起到了選擇器的作用。use 。 led2,led1,led0:out std_logic )。architecture a of leftp issignal tmp:std_logic_vector(2 downto 0)。event and clk=39。)then if lr=39。then if leften =39。then tmp=000。 else tmp=tmp(1 downto 0) amp。039。 end if。 end if。 end process。 led1=tmp(1)。end a。當(dāng)LR端起作用時(shí),三個(gè)二極管全滅。 (1)右邊燈控制模塊的VHDL語(yǔ)言library ieee。entity rightp isport(righten,clk,lr:in std_logic。end rightp。begin process(clk,righten,lr) begin if(clk39。139。039。039。 else if(tmp=000)then