library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity h2 is port(clk:instd_logic; cp:bufferstd_logic_vector (6downto0)); end h2; architecture one of h2 is signal tour1:integerrange0to45800:=0; signal tour2:integerrange0to40815:=0; signal tour3:integerrange0to36362:=0; signal tour4:integerrange0to34383:=0; signal tour5:integerrange0to30611:=0; signal tour6:integerrange0to27272:=0; signal tour7:integerrange0to24290:=0; begin process(clk) begin if(clk'eventand clk='1') then if tour1=45800then tour1<=0; else tour1<=tour1+1; endif; if tour1>45800/2and tour1<45800then cp(0)<='0'; else cp(0)<='1'; endif; if tour2=40815then tour2<=0; else tour2<=tour2+1; endif; if tour2>40815/2and tour2<40815then cp(1)<='0'; else cp(1)<='1'; endif; if tour3=36362then tour3<=0; else tour3<=tour3+1; endif; if tour3>36362/2and tour3<36362then cp(2)<='0'; else cp(2)<='1'; endif; if tour4=34383then tour4<=0; else tour4<=tour4+1; endif; if tour4>34383/2and tour4<34383then cp(3)<='0'; else cp(3)<='1'; endif; if tour5=30611then tour5<=0; else tour5<=tour5+1; endif; if tour5>30611/2and tour5<30611then cp(4)<='0'; else cp(4)<='1'; endif; if tour6=27272then tour6<=0; else tour6<=tour6+1; endif; if tour6>27272/2and tour6<27272then cp(5)<='0'; else cp(5)<='1'; endif; if tour7=24291then tour7<=0; else tour7<=tour7+1; endif; if tour7>24291/2and tour7<24291then cp(6)<='0'; else cp(6)<='1'; endif; endif; endprocess; end;
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY H3 IS PORT(CP:INSTD_LOGIC_VECTOR(6DOWNTO0); AN: INSTD_LOGIC_VECTOR(6DOWNTO0); CC:OUTSTD_LOGIC); END H3; ARCHITECTURE STR OF H3 IS BEGIN PROCESS(AN) BEGIN CASE AN IS WHEN"1000000"=> CC<=CP(6); WHEN"0100000"=> CC<=CP(5); WHEN"0010000"=> CC<=CP(4); WHEN"0001000"=> CC<=CP(3); WHEN"0000100"=> CC<=CP(2); WHEN"0000010"=> CC<=CP(1); WHEN"0000001"=> CC<=CP(0); WHENOTHERS=> NULL; ENDCASE; ENDPROCESS; END;