多功能信号发生器的设计_毕业设计(编辑修改稿)内容摘要:

:std_logic。 begin if full39。 event and full=39。 139。 then t2:=not t2。 if t2=39。 139。 then d_out=39。 139。 else d_out=39。 039。 end if。 end if。 end process p_div。 end behav。 频率为 1MHz 的分频波形图: 9 其生成元器件如图 2所示: 图 2 数控分频器器件生成图 产生方波,是通过交替送出全 0和全 1实现,每 32 个时钟翻转一次。 其 VHDL代码如下: library ieee。 use。 entity square is port(clk,clr:in std_logic。 q:out integer range 0 to 255)。 end square。 architecture one of square is signal a:bit:=39。 039。 begin process(clk,clr) variable t:integer range 0 to 31。 begin if clr=39。 039。 then a=39。 039。 elsif clk39。 event and clk=39。 139。 then if t31 then t:=t+1。 else t:=0。 a=not a。 end if。 end if。 end process。 process(clk,a) begin if clk39。 event and clk=39。 139。 then 10 if a=39。 139。 then q=255。 else q=0。 end if。 end if。 end process。 end one。 其仿真波形如图 3所示: 图 3 方波仿真图 其生成元器件如图 4所示: 图 4 方波元器件生成图 该模块产生的三角波以 64个时钟为一个周期,输出 q每次加减 8。 其 VHDL代码如下: library ieee。 use。 use。 entity delta is port(clk,reset:in std_logic。 q:out std_logic_vector(7 downto 0))。 end delta。 architecture delta_arc of delta is begin 11 process(clk,reset) variable tmp:std_logic_vector(7 downto 0)。 variable a:std_logic。 begin if reset=39。 039。 then tmp:=00000000。 elsif clk39。 event and clk=39。 139。 then if a=39。 039。 then if tmp=11111110 then tmp:=11111111。 a:=39。 139。 else tmp:=tmp+39。 139。 end if。 else if tmp=00000001 then tmp:=00000000。 a:=39。 039。 else tmp:=tmp39。 139。 end if。 end if。 end if。 q=tmp。 end process。 end delta_arc。 其仿真波形如图 5所示: 图 5 三角波仿真图 其生成元器件如图 6所示: 12 图 6 三角波元器件生成图 该模块产生以 64个时钟为一个周期的正弦波。 其 VHDL代码如下: library ieee。 use。 use。 entity sin is port(clk,clr:in std_logic。 d:out integer range 0 to 255)。 end sin。 architecture sin_arc of sin is begin process(clk,clr) variable tmp:integer range 0 to 63。 begin if clr=39。 039。 then d=0。 elsif clk39。 event and clk=39。 139。 then if tmp=63 then tmp:=0。 else tmp:=tmp+1。 end if。 case tmp is when 00=d=255。 when 01=d=254。 when 02=d=252。 when 03=d=249。 when 04=d=24。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。