【正文】
when 6 = colr = shuzu(1)(38move downto 31move)。 when 4 = colr = shuzu(3)(38move downto 31move)。 when 2 = colr = shuzu(5)(38move downto 31move)。 then case t8 is –紅色 when 0 = colr = shuzu(7)(38move downto 31move)。 if tchange1=39。 when 1= threetwo 左右滾動(dòng) colg=00000000。 end case。 when 7 = colg = shuzu(0)((388*move1) downto (318*move1))。 when 5 = colg = shuzu(2)((388*move1) downto (318*move1))。 when 3 = colg = shuzu(4)((388*move1) downto (318*move1))。 when 1 = colg = shuzu(6)((388*move1) downto (318*move1))。139。 end if。 when others = colr = 00000000。 when 6 = colr = shuzu(1)((388*move1) downto (318*move1))。 when 4 = colr = shuzu(3)((388*move1) downto (318*move1))。 when 2 = colr = shuzu(5)((388*move1) downto (318*move1))。 then case t8 is 紅色 when 0 = colr = shuzu(7)((388*move1) downto (318*move1))。 if tchange1=39。 case t4 is when 0= threeone 單字循環(huán) colg=00000000。 if swt=10 or swt=11 then function three ,four 功能三四使用相同的譯碼部分,不同點(diǎn)在于變色計(jì)數(shù)器的驅(qū)動(dòng)時(shí)鐘不同。 end case。 when others =colr=00000000。 when 7 =colr=00000000。else colg=00000000。139。end if。 then colr=shuzu2(1)。 when 6 = if pwm1=39。else colg=00000000。139。end if。 then colr=shuzu2(2)。 when 5 = if pwm2=39。else colg=00000000。139。end if。 then colr=shuzu2(3)。 when 4 = if pwm3=39。else colg=00000000。139。end if。 then colr=shuzu2(4)。 when 3 = if pwm4=39。else colg=00000000。139。end if。 then colr=shuzu2(5)。 when 2 = if pwm5=39。else colg=00000000。139。end if。 then colr=shuzu2(6)。 when 1 = if pwm6=39。 if swt=01 then function 2 colr,colg 八級(jí)漸變色 CASE t8 IS when 0 =colr=shuzu2(7)。 end if。 end case。 when 7 = colr = shuzu2(0)。 when 5 = colr = shuzu2(2)。 when 3 = colr = shuzu2(4)。 when 1 = colr = shuzu2(6)。139。 process(t8,t4,swt,pwm,pwm1,pwm2,pwm3,pwm4,pwm5,pwm6,move,move1,tchange1,tchange2,shuzu,shuzu1,shuzu2)function 1 begin if swt=00 then function one 四級(jí)亮度 colg=00000000。 end case。 when others = pwm=39。 when 3= pwm=39。 when 1= pwm=pwm3。 end process。039。139。139。039。tchange2=pwm5。tchange2=pwm2。039。139。 end process 。 when others =row=11111111。 when 6 =row=11111101。 when 4 =row=11110111。 when 2 =row=11011111。process(t8)control row vector begin CASE t8 IS 控制每一行能夠亮的時(shí)刻 when 0 =row=01111111。shuzu1=( 39*8賦值10000001,11000011,10100101,10011001,10000001,10000001,10000001,10000001,00111100,00011000,00011000,00011000,00011000,00011000,00011000,00111100,10000001,11000001,10100001,10010001,10001001,10000101,10000011,10000001,01111110,10000001,10000000,10000000,10001111,10001001,10000001,01111110,10000001,11000011,10100101,10011001,10000001,10000001,10000001)。定義88數(shù)組signal shuzu2:r2。定義398二維數(shù)組signal shuzu1:r1。定義839二維數(shù)組signal shuzu:r。signal pwm:std_logic。architecture project of translate issignal tchange1:std_logic。 colg:out std_logic_vector(7 downto 0) )。變色狀態(tài)計(jì)數(shù)器,模4 row:out std_logic_vector(7 downto 0)。狀態(tài)計(jì)數(shù)器值,模32 move1:IN integer range 0 to 3。 swt:IN std_logic_vector(1 downto 0)。 t8:IN integer range 0 to 7。 pwm5:IN STD_LOGIC。 pwm3:IN STD_LOGIC。entity translate is port( pwm1:IN STD_LOGIC。use 。end a。end case。功能四時(shí),根據(jù)t2值不同,輸出低頻、高頻時(shí)鐘when others = clkout=39。else clkout=clk2。architecture a of mux2 is begin process(clk1,clk2,btn,swt)begincase swt is—只對(duì)功能三四有效when 10=clkout=btn。clkout:out std_logic)。按鍵脈沖輸入t2:in integer range 0 to 1。 低頻時(shí)鐘輸入()clk2:in std_logic。use 。 end project。 move1=count1。 END IF。 ELSE count1:=count1+1。 END IF。)THEN IF count=31 THEN count:=0。EVENT AND clk=39。 variable count1:integer range 0 to 3。end yidong。 move:OUT integer range 0 to 31。use 。滾動(dòng)狀態(tài)計(jì)數(shù)器(模4模32計(jì)數(shù)器組合)library ieee。 END PROCESS 。 END IF。 ELSE count:=count+1。139。begin IF(clk39。end jishuqi8。entity jishuqi8 is port( clk:IN STD_LOGIC。 模8計(jì)數(shù)器use 。 end project。 t4=count。 END IF。)THEN IF count=3 THEN count:=0。EVENT AND clk=39。architecture project of jishuqi4 isbeginprocess(clk) variable count:integer range 0 to 3。 t4:OUT integer range 0 to 3)。use 。模4計(jì)數(shù)器library ieee。 END PROCESS 。 END IF。 ELSE count:=count+1。139。begin IF(clk39。end jishuqi2。entity jishuqi2 is port( clk:IN STD_LOGIC。 模2計(jì)數(shù)器use 。end a。 end process。 end if。 temp=not temp。139。 begin if clk39。architecture a of divider2 issignal temp:std_logic。clkout: out std_logic)。use 。三級(jí)分頻器library ieee。clkout=temp。 end if。 else count:=count+1。 then if count=249 then count:=0。 event and clk=39。 begin process(clk) variable count:integer range 0 to 249。end divider。entity divider isport(clk:in std_logic。 基本分頻器use 。 end project。 end if。039。139。139。 if clk39。 end if。else pwm5=39。 then pwm5if count35000 thenpwm5=39。 event and clk=39。 end if。039。139。139。if clk39。 end if。else pwm3=39。 then pwm3if count21000 thenpwm3=39。 event and clk=39。 end if。039。139。139。 if clk39。 end if