5、2;ARCHITECTUREoneOFclk_div2IS BEGIN PROCESS(CLK) BEGIN IFCLK'EVENTANDCLK='1'THEN OUTPUT<=NOTOUTPUT; ENDIF; ENDPROCESS;ENDone; 仿真波形: 2、计数器模块: 功能描述:该模块的主要功能是通过计数,实现对左移及右移模块的选通,并在右移和左移模块完成后,跳转到循环取反模块执行指令。 计数器1代码部分:LIBRAR
6、YIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYcount1ISPORT(CLK,ENA:INSTD_LOGIC; OUTPUT:BUFFERSTD_LOGIC_VECTOR(1DOWNTO0));ENDcount1;ARCHITECTUREoneOFcount1IS SIGNALCQ:STD_LOGIC_VECTOR(5DOWNTO0); BEGIN PROCESS(CLK,ENA)
7、 BEGIN IFCLK'EVENTANDCLK='1'THEN IFENA='1'THEN IFCQ<"100111"THENCQ<=CQ+1; IFCQ="100000"THENOUTPUT<="10"; ELSIFCQ="100001"THENOUTPUT<="01"; ELSIFCQ="100010"THENOUTPUT<="10";