?? dalia.vhd
字號:
else fade_stop_level<=level-fade_rate_temp; fade_total_temp2:="0000000001010"; end if; datain21<="00000010"; addr21<=1; state_time<=fade_total_temp2; fg_temp:=not fg_temp; fade_total<=fade_total_temp2; end if;
when "00000011"=> if(level/="00000000" and level/=max_level) then --step up input_level2<=level+"00000001"; datain21<="00000000"; addr21<=1; end if;
when "00000100"=> if(level/="00000000" and level/=min_level) then -- step down input_level2<=level-"00000001"; datain21<="00000000"; addr21<=1; end if;
when "00000101"=> power_failure<='0'; --recall max_level input_level2<=max_level; datain21<="00000000"; addr21<=1;
when "00000110"=> power_failure<='0'; --recall min_level input_level2<=min_level; datain21<="00000000"; addr21<=1;
when "00000111"=>
power_failure<='0'; --step down and off if(level/="00000000") then if(level=min_level) then input_level2<="00000000"; else input_level2<=level-"00000001"; end if; datain21<="00000000"; addr21<=1; end if;
when "00001000"=> power_failure<='0'; --on and step up if(level/=max_level) then if(level="00000000")then input_level2<=min_level; else input_level2<=level+"00000001"; end if; datain21<="00000000"; addr21<=1; end if;
when "00100000"=> search_address_h<="11111111"; search_address_m<="11111111"; search_address_l<="11111111"; --resetflash() input_level2<="11111110"; datain21 <="00000000"; addr21<=1;
when "00101010"=> if(level>=min_level and dtr<="11111110")then max_level<=command; end if;
when "00101011"=> if(level>="00000001")then min_level<=command; end if;
when "00101100"=> system_failure_level<=command;
when "00101101"=>
if(level>="00000001"and level<="11111110")then power_on_level<=command; end if;
when "00101110"=> fade_time<=command;
when "00101111"=> if((level and "00001111")/="00000000")then fade_rate<=command; end if;
when "01000000"=> if(level="11111111")then short_address<=command; elsif((level and"01111110")<="11000110")then short_address<=command; end if;-- wo shi fen ge xian when "10010000" => answer <= "00000000"; if lamp_failure = '1' then answer(1) <= '1'; else answer(1) <= '0'; end if; if level/="00000000" then answer(2) <= '1'; else answer(2) <= '0'; end if; if limit_error ='1' then answer(3) <= '1'; else answer(3) <= '0'; end if; if dataout2 = "00000010" then answer(4) <= '1'; else answer(4) <= '0'; end if; if dataout2 = "00000001" then answer(5) <= '1'; else answer(5) <= '0'; end if; if short_address = "11111111" then answer(6) <= '1'; else answer(6) <= '0'; end if; if power_failure = '1' then answer(7) <= '1'; else answer(7) <= '0'; end if; datain12 <="00000010"; addr12<=0; when "10010001" => answer <= "11111111"; datain12 <="00000010"; addr12<=0; when "10010010" => if lamp_failure = '1' then answer <= "11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10010011" => if level/="00000000" then answer <= "11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10010100" => if limit_error ='1' then answer <= "11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10010101" => if dataout2 = "00000001" then answer <= "11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10010110" => if short_address = "11111111" then answer <= "11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10010111" => answer <= "00000000"; datain12 <="00000010"; addr12<=0;
when "10011000" => answer <= dtr; --deleted datain12 <="00000010"; addr12<=0; when "10011001" => answer<= "00000000"; datain12 <="00000010"; addr12<=0; when "10011010" => answer <= "00000001"; datain12 <="00000010"; addr12<=0; when "10011011" => answer <= "11111111"; datain12 <="00000010"; addr12<=0; when "10100000" => answer<= level; datain12 <="00000010"; addr12<=0; when "10100001" => answer<= max_level; datain12 <="00000010"; addr12<=0; when "10100010" => answer<= min_level; datain12 <="00000010"; addr12<=0; when "10100011" => answer<= power_on_level; datain12 <="00000010"; addr12<=0; when "10100100" => answer<= system_failure_level; datain12 <="00000010"; addr12<=0; when "10100101" => fadetime:=fade_time*"00010000"; answer<= fadetime or fade_rate; datain12 <="00000010"; addr12<=0; when "11000010" => answer<=random_address_h; datain12 <="00000010"; addr12<=0; when "11000011" => answer<= random_address_m; datain12 <="00000010"; addr12<=0; when "11000100" => answer<= random_address_l; datain12 <="00000010"; addr12<=0; when others=>null; end case; end if;-- wo also shi fen ge xian elsif((a="10100001") or (a="10110001")) then if((address>"10100110") and (address<"10111110") and (address_time="00000000")) then null; else case address is when "10100001" => address_time<="00000000"; when "10100011" => dtr<=command; when "10100101" => if((command="00000000") or (command(6 downto 1)=short_address(5 downto 0))) then withdraw<='0'; selection<="00000000"; end if;
when "10100111" => random_address_h<=random_addr_out1; random_address_m<=random_addr_out2; random_address_l<=random_addr_out3;
when "10101001" => if((random_address_h/=search_address_h) or (random_address_m/=search_address_m) or (random_address_l/=search_address_l) or (withdraw='0')) then m(23 downto 0):= random_address_h&random_address_m&random_address_l; n(23 downto 0):= search_address_h&search_address_m&search_address_l; if(m<=n) then answer<="11111111"; datain12 <="00000010"; addr12<=0; end if; end if;
when "10101011" => withdraw<='1' ; when "10110001" => search_address_h<=command; when "10110011" => search_address_m<=command; when "10110101" => search_address_l<=command;
when "10110111" => if(selection="00000001") then if(lamp_failure='1') then if(command="11111111") then short_address<="11111111"; else if(dtr(6 downto 1)<="111111") then short_address<='0'&'0'&command(6 downto 1); end if; end if; end if; elsif(m=n) then if(command="11111111") then short_address<="11111111"; else if(dtr(6 downto 1)<="111111") then short_address<='0'&'0'&command(6 downto 1); end if; end if; end if;
when "10111001" => if(short_address=('0'&'0'&command(6 downto 1))) then answer<="11111111"; datain12 <="00000010"; addr12<=0; end if;
when "10111011" => if(selection="00000001") then if(lamp_failure='1') then answer<=short_address; datain12 <="00000010"; addr12<=0; end if; elsif(m=n) then answer<=short_address; datain12 <="00000010"; addr12<=0; end if;
when "10111101" => selection<="00000001"; when others => null; end case; end if; end if; end if; end if; end process p3;
p4: process(clk_main) variable temp1,temp2,temp3 : std_logic_vector(7 downto 0) :="00000000"; begin if(rising_edge(clk_main)) then temp1:=temp1+"00000001"; random_addr_out1<=temp1; end if; if(rising_edge(clk_dali)) then temp2:=temp2+"00000001"; random_addr_out2<=temp2; end if; if(rising_edge(clk_20)) then temp3:=temp3+"00000001"; random_addr_out3<=temp3; end if; end process p4;
p5: process(clk_main) variable count: std_logic_vector(9 downto 0); variable temp: std_logic; begin if(rising_edge(clk_main)) then count:=count+1; if(count="0000000000") then temp:= not temp; clk_dali<=temp; end if; end if; end process;
p6: process(clk_dali) variable temp:integer:=0; begin if(rising_edge(clk_dali)) then case temp is when 95=> temp:=0; clk_20<=not clk_20; when others=>temp:=temp+1; end case; end if; end process p6; p7: process(dataout2,clk_20,fg) variable dif_level: std_logic_vector(7 downto 0); variable state_no_temp1: std_logic_vector(7 downto 0):="00000000"; variable p :integer ; variable p1,p2,p3,p4,p5,p6,p7,p8:std_logic_vector(20 downto 0); variable p12,p23,p34,p45,p56,p67,p78,p89:std_logic_vector(20 downto 0); variable result:std_logic; variable state_time_temp: std_logic_vector(12 downto 0); variable fg_temp:std_logic:='1'; begin if rising_edge(clk_20) then if(fg/=fg_temp) then fg<=fg_temp; state_time_temp:=state_time; end if; case dataout2 is when "00000000"=>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -