1、 IF cnt=count_value THEN ELSE=cnt+1; end if; else IF cnt=0 THEN=count_value;=cnt-1; END PROCESS; ledout=NOT led; WITH cnt SELECT led=1111001WHEN 1, 0100100WHEN 2,0110000WHEN 3,0011001WHEN 4,0010010WHEN 5,0000010WHEN 6,1111000WHEN 7,0000000WHEN 8,0010000WHEN 9,1000000WHEN 0,1111111WHEN others;END a;第
2、二题分频器ENTITY div4 ISPORT(clk: din:IN STD_LOGIC_VECTOR(3 DOWNTO 0); fout:OUT std_LOGIC);END div4;ARCHITECTURE a OF div4 ISbegin process(clk) variable cnt:std_logic_vector(3 downto 0); begin if(clkevent and clk=) then if cnt=1111 then cnt:0000;=cnt+ if din= fout=cnt(3); elsif din=1000=cnt(2); 1100=cnt(
3、1);1110=cnt(0);= end process;end a;第三题ENTITY div ISGENERIC (num:=2);PORT (clk: co:OUT STD_LOGIC);END div;ARCHITECTURE rtl OF div IS PROCESS(clk) VARIABLE cnt:STD_LOGIC_VECTOR(num downto 0); IF(clk END IF; co=cnt(num);END rtl;第四题 COUNT: SIGNAL co:STD_LOGIC; count cout elsif(en=011010010cout0011THEN E
4、LSIF(MA=010101111001END PROCESS;ledoutWITH cnt SELECTled); elsif clk if en=0000100100010000 elsif cnt=00011001then -注意此处,前面跳过了A到F的计数,所以计数到1100100000000 process(clk1) if clk1event and clk1= scan=not scan; scanout=scan; hex,1=,2=,others= k elsif(rl=led(14 downto 0)&led(15);=led(0)&led(15 downto 1);=le
5、d;第十题ENTITY shifter1 ISPORT(clk,clr,ser,dir,stld:din: IN STD_LOGIC_VECTOR(0 TO 7) ;qh:END shifter1;ARCHITECTURE rt1 OF shifter1 ISSIGNAL reg:STD_LOGIC_VECTOR(0 TO 7);process(clk,clr)if clr=regelsif clk if stld= reg=din; if(dir=reg(1 to 7)&ser;qh=reg(0);=ser®(0 to 6);=reg(7);end rt1;第十一题entity sel
6、ector isport(b:in std_logic_vector(6 downto 0);clr: red,gree:end selector;architecture rtl of selector is signal count: signal a:process(b,clr) if (clr= a for i in 0 to 6 loop a(i)=b(i); end loop;process(a) if a(i)= and cnt gree red=cnt;with count select第十二题ENTITY shifter ISPORT(clk,clr,ser,stld:END
7、 shifter;ARCHITECTURE rt1 OF shifter IS第十三题ENTITY bhxs ISPORT(INPUT:IN STD_LOGIC_VECTOR(15 DOWNTO 0); LEDOUT: out STD_LOGIC_VECTOR(6 DOWNTO 0);END bhxs;ARCHITECTURE RT1 OF bhxs IS SIGNAL LED: process(INPUT) LEDOUT=NOT LED; IF(INPUT(0)= LED ELSIF(INPUT(1)= ELSIF(INPUT(2)= ELSIF(INPUT(3)= ELSIF(INPUT(4)= ELSIF(INPUT(5)= ELSIF(INPUT(6)= ELSIF(INPUT(7)= ELSIF(INPUT(8)= ELSIF(INPUT(9)= ELSIF(INPUT(10)=
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1