library ieee副本.docx

上传人:b****6 文档编号:7157129 上传时间:2023-01-21 格式:DOCX 页数:20 大小:99.97KB
下载 相关 举报
library ieee副本.docx_第1页
第1页 / 共20页
library ieee副本.docx_第2页
第2页 / 共20页
library ieee副本.docx_第3页
第3页 / 共20页
library ieee副本.docx_第4页
第4页 / 共20页
library ieee副本.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

library ieee副本.docx

《library ieee副本.docx》由会员分享,可在线阅读,更多相关《library ieee副本.docx(20页珍藏版)》请在冰豆网上搜索。

library ieee副本.docx

libraryieee副本

 

蜗牛的染色体学院

电子设计自动化

实验报告

 

姓  名:

吃一口羊羔肉

学号:

一口吃羊羔肉

班级:

吃羊羔肉一口

实验内容:

多路波形发生器

指导教师:

羊羔肉吃一口

报告日期:

 

多路波形发生器实验

1.实验要求

1.1.对输入时钟信号进行分频,实现三路互差120度的信号。

1.2.实现输出信号的占空比例控制。

其中

clk:

输入时钟信号;

reset:

同步复位信号(低电平有效);

div:

输入分频控制信号(6n分频);

ctrl:

占空比例控制信号,其中

当ctrl=1时,占空比为1:

1;

当ctrl=2时,占空比为1:

2;

当ctrl=3时,占空比为2:

1;

A,B,C:

三路输出信号。

2.设计思路

2.1clk:

时钟输入,设置为上升沿触发;

2.2.reset:

题目要求同步复位,故应将时钟输入作为reset

触发的必要条件。

2.3.div:

题目要求为6分频,用二进制表示为

(110)2,(1100)2,(100100)2以此类推。

当temp计

数是遇到上述数字便清零重新技术以实现6n分

频。

2.4.ctrl:

占空比为三种,分别用(01)2,(10)2,(11)

2表示。

然后用temp中3位0和1的个数比例

来控制占空比。

占空比=1的个数/(0的个数+1

的个数)

又因为题目要求相位角互差120度,即三个输出

依次领先前一位4个输入字符。

即若A(0)=1,则

B(4)=1,C(8)=1。

A(0)B(4)C(8)为同相位。

2.5.temp:

声明三个变量,其中

temp为三位,分别对应于A,B,C。

用于输出。

temp2与temp3用于计数分频。

3.程序流程图

 

4.源程序一

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entityzongheis

port

clk:

instd_logic;

aclk:

outstd_logic;

bclk:

outstd_logic;

cclk:

outstd_logic;

resetb:

instd_logic;

div:

instd_logic_vector(1downto0);

ctrl:

instd_logic_vector(1downto0)

);

endzonghe;

architecturebehaveofzongheis

signaltmp:

std_logic;

signaltmp1:

std_logic;

signaltmp2:

std_logic;

signalcnt0:

integerrange0to5:

=0;

signalcnt1:

integerrange0to11:

=0;

signalcnt2:

integerrange0to17:

=0;

signalcnt3:

integerrange0to23:

=0;

begin

process(clk,resetb,div,ctrl)

begin

ifclk'eventandclk='1'then

ifresetb='0'then

cnt0<=0;

cnt1<=0;

cnt2<=0;

cnt3<=0;

tmp<='0';

tmp1<='0';

tmp2<='0';

elsifresetb='1'then

cnt0<=cnt0+1;

cnt1<=cnt1+1;

cnt2<=cnt2+1;

cnt3<=cnt3+1;

casectrlis

when"01"=>

casedivis

when"00"=>

casecnt0is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='1';

when2=>tmp<='0';tmp1<='0';tmp2<='1';

when3=>tmp<='1';tmp1<='0';tmp2<='1';

when4=>tmp<='1';tmp1<='0';tmp2<='0';

when5=>tmp<='1';tmp1<='1';tmp2<='0';cnt0<=0;

endcase;

when"01"=>

casecnt1is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='1';

when3=>tmp<='0';tmp1<='1';tmp2<='1';

when4=>tmp<='0';tmp1<='0';tmp2<='1';

when5=>tmp<='0';tmp1<='0';tmp2<='1';

when6=>tmp<='1';tmp1<='0';tmp2<='1';

when7=>tmp<='1';tmp1<='0';tmp2<='1';

when8=>tmp<='1';tmp1<='0';tmp2<='0';

when9=>tmp<='1';tmp1<='0';tmp2<='0';

when10=>tmp<='1';tmp1<='1';tmp2<='0';

when11=>tmp<='1';tmp1<='1';tmp2<='0';cnt1<=0;

endcase;

when"10"=>

casecnt2is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='0';

when3=>tmp<='0';tmp1<='1';tmp2<='1';

when4=>tmp<='0';tmp1<='1';tmp2<='1';

when5=>tmp<='0';tmp1<='1';tmp2<='1';

when6=>tmp<='0';tmp1<='0';tmp2<='1';

when7=>tmp<='0';tmp1<='0';tmp2<='1';

when8=>tmp<='0';tmp1<='0';tmp2<='1';

when9=>tmp<='1';tmp1<='0';tmp2<='1';

when10=>tmp<='1';tmp1<='0';tmp2<='1';

when11=>tmp<='1';tmp1<='0';tmp2<='1';

when12=>tmp<='1';tmp1<='0';tmp2<='0';

when13=>tmp<='1';tmp1<='0';tmp2<='0';

when14=>tmp<='1';tmp1<='0';tmp2<='0';

when15=>tmp<='1';tmp1<='1';tmp2<='0';

when16=>tmp<='1';tmp1<='1';tmp2<='0';

when17=>tmp<='1';tmp1<='1';tmp2<='0';cnt2<=0;

endcase;

when"11"=>

casecnt3is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='0';

when3=>tmp<='0';tmp1<='1';tmp2<='0';

when4=>tmp<='0';tmp1<='1';tmp2<='1';

when5=>tmp<='0';tmp1<='1';tmp2<='1';

when6=>tmp<='0';tmp1<='1';tmp2<='1';

when7=>tmp<='0';tmp1<='1';tmp2<='1';

when8=>tmp<='0';tmp1<='0';tmp2<='1';

when9=>tmp<='0';tmp1<='0';tmp2<='1';

when10=>tmp<='0';tmp1<='0';tmp2<='1';

when11=>tmp<='0';tmp1<='0';tmp2<='1';

when12=>tmp<='1';tmp1<='0';tmp2<='1';

when13=>tmp<='1';tmp1<='0';tmp2<='1';

when14=>tmp<='1';tmp1<='0';tmp2<='1';

when15=>tmp<='1';tmp1<='0';tmp2<='1';

when16=>tmp<='1';tmp1<='0';tmp2<='0';

when17=>tmp<='1';tmp1<='0';tmp2<='0';

when18=>tmp<='1';tmp1<='0';tmp2<='0';

when19=>tmp<='1';tmp1<='0';tmp2<='0';

when20=>tmp<='1';tmp1<='1';tmp2<='0';

when21=>tmp<='1';tmp1<='1';tmp2<='0';

when22=>tmp<='1';tmp1<='1';tmp2<='0';

when23=>tmp<='1';tmp1<='1';tmp2<='0';cnt3<=0;

endcase;

endcase;

when"10"=>

casedivis

when"00"=>

casecnt0is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='0';tmp2<='1';

when3=>tmp<='0';tmp1<='0';tmp2<='1';

when4=>tmp<='1';tmp1<='0';tmp2<='0';

when5=>tmp<='1';tmp1<='0';tmp2<='0';cnt0<=0;

endcase;

when"01"=>

casecnt1is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='0';

when3=>tmp<='0';tmp1<='1';tmp2<='0';

when4=>tmp<='0';tmp1<='0';tmp2<='1';

when5=>tmp<='0';tmp1<='0';tmp2<='1';

when6=>tmp<='0';tmp1<='0';tmp2<='1';

when7=>tmp<='0';tmp1<='0';tmp2<='1';

when8=>tmp<='1';tmp1<='0';tmp2<='0';

when9=>tmp<='1';tmp1<='0';tmp2<='0';

when10=>tmp<='1';tmp1<='0';tmp2<='0';

when11=>tmp<='1';tmp1<='0';tmp2<='0';cnt1<=0;

endcase;

when"10"=>

casecnt2is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='0';

when3=>tmp<='0';tmp1<='1';tmp2<='0';

when4=>tmp<='0';tmp1<='1';tmp2<='0';

when5=>tmp<='0';tmp1<='1';tmp2<='0';

when6=>tmp<='0';tmp1<='0';tmp2<='1';

when7=>tmp<='0';tmp1<='0';tmp2<='1';

when8=>tmp<='0';tmp1<='0';tmp2<='1';

when9=>tmp<='0';tmp1<='0';tmp2<='1';

when10=>tmp<='0';tmp1<='0';tmp2<='1';

when11=>tmp<='0';tmp1<='0';tmp2<='1';

when12=>tmp<='1';tmp1<='0';tmp2<='0';

when13=>tmp<='1';tmp1<='0';tmp2<='0';

when14=>tmp<='1';tmp1<='0';tmp2<='0';

when15=>tmp<='1';tmp1<='0';tmp2<='0';

when16=>tmp<='1';tmp1<='0';tmp2<='0';

when17=>tmp<='1';tmp1<='0';tmp2<='0';cnt2<=0;

endcase;

when"11"=>

casecnt3is

when0=>tmp<='0';tmp1<='1';tmp2<='0';

when1=>tmp<='0';tmp1<='1';tmp2<='0';

when2=>tmp<='0';tmp1<='1';tmp2<='0';

when3=>tmp<='0';tmp1<='1';tmp2<='0';

when4=>tmp<='0';tmp1<='1';tmp2<='0';

when5=>tmp<='0';tmp1<='1';tmp2<='0';

when6=>tmp<='0';tmp1<='1';tmp2<='0';

when7=>tmp<='0';tmp1<='1';tmp2<='0';

when8=>tmp<='0';tmp1<='0';tmp2<='1';

when9=>tmp<='0';tmp1<='0';tmp2<='1';

when10=>tmp<='0';tmp1<='0';tmp2<='1';

when11=>tmp<='0';tmp1<='0';tmp2<='1';

when12=>tmp<='0';tmp1<='0';tmp2<='1';

when13=>tmp<='0';tmp1<='0';tmp2<='1';

when14=>tmp<='0';tmp1<='0';tmp2<='1';

when15=>tmp<='0';tmp1<='0';tmp2<='1';

when16=>tmp<='1';tmp1<='0';tmp2<='0';

when17=>tmp<='1';tmp1<='0';tmp2<='0';

when18=>tmp<='1';tmp1<='0';tmp2<='0';

when19=>tmp<='1';tmp1<='0';tmp2<='0';

when20=>tmp<='1';tmp1<='0';tmp2<='0';

when21=>tmp<='1';tmp1<='0';tmp2<='0';

when22=>tmp<='1';tmp1<='0';tmp2<='0';

when23=>tmp<='1';tmp1<='0';tmp2<='0';cnt3<=0;

endcase;

endcase;

when"11"=>

casedivis

when"00"=>

casecnt0is

when0=>tmp<='0';tmp1<='1';tmp2<='1';

when1=>tmp<='0';tmp1<='1';tmp2<='1';

when2=>tmp<='1';tmp1<='0';tmp2<='1';

when3=>tmp<='1';tmp1<='0';tmp2<='1';

when4=>tmp<='1';tmp1<='1';tmp2<='0';

when5=>tmp<='1';tmp1<='1';tmp2<='0';cnt0<=0;

endcase;

when"01"=>

casecnt1is

when0=>tmp<='0';tmp1<='1';tmp2<='1';

when1=>tmp<='0';tmp1<='1';tmp2<='1';

when2=>tmp<='0';tmp1<='1';tmp2<='1';

when3=>tmp<='0';tmp1<='1';tmp2<='1';

when4=>tmp<='1';tmp1<='0';tmp2<='1';

when5=>tmp<='1';tmp1<='0';tmp2<='1';

when6=>tmp<='1';tmp1<='0';tmp2<='1';

when7=>tmp<='1';tmp1<='0';tmp2<='1';

when8=>tmp<='1';tmp1<='1';tmp2<='0';

when9=>tmp<='1';tmp1<='1';tmp2<='0';

when10=>tmp<='1';tmp1<='1';tmp2<='0';

when11=>tmp<='1';tmp1<='1';tmp2<='0';cnt1<=0;

endcase;

when"10"=>

casecnt2is

when0=>tmp<='0';tmp1<='1';tmp2<='1';

when1=>tmp<='0';tmp1<='1';tmp2<='1';

when2=>tmp<='0';tmp1<='1';tmp2<='1';

when3=>tmp<='0';tmp1<='1';tmp2<='1';

when4=>tmp<='0';tmp1<='1';tmp2<='1';

when5=>tmp<='0';tmp1<='1';tmp2<='1';

when6=>tmp<='1';tmp1<='0';tmp2<='1';

when7=>tmp<='1';tmp1<='0';tmp2<='1';

when8=>tmp<='1';tmp1<='0';tmp2<='1';

when9=>tmp<='1';tmp1<='0';tmp2<='1';

when10=>tmp<='1';tmp1<='0';tmp2<='1';

when11=>tmp<='1';tmp1<='0';tmp2<='1';

when12=>tmp<='1';tmp1<='1';tmp2<='0';

when13=>tmp<='1';tmp1<='1';tmp2<='0';

when14=>tmp<='1';tmp1<='1';tmp2<='0';

when15=>tmp<='1';tmp1<='1';tmp2<='0';

when16=>tmp<='1';tmp1<='1';tmp2<='0';

when17=>tmp<='1';tmp1<='1';tmp2<='0';cnt2<=0;

endcase;

when"11"=>

casecnt3is

when0=>tmp<='0';tmp1<='1';tmp2<='1';

when1=>tmp<='0';tmp1<='1';tmp2<='1';

when2=>tmp<='0';tmp1<='1';tmp2<='1';

when3=>tmp<='0';tmp1<='1';tmp2<='1';

when4=>tmp<='0';tmp1<='1';tmp2<='1';

when5=>tmp<='0';tmp1<='1';tmp2<='1';

when6=>tmp<='0';tmp1<='1';tmp2<='1';

when7=>tmp<='0';tmp1<='1';tmp2<='1';

when8=>tmp<='1';tmp1<='0';tmp2<='1';

when9=>tmp<='1';tmp1<='0';tmp2<='1';

when10=>tmp<='1';tmp1<='0';tmp2<='1';

when11=>tmp<='1';tmp1<='0';tmp2<='1';

when12=>tmp<='1';tmp1<='0';tmp2<='1';

when13=>tmp<='1';tmp1<='0';tmp2<='1';

when14=>tmp<='1';tmp1<='0';tmp2<='1';

when15=>tmp<='1';tmp1<='0';tmp2<='1';

when16=>tmp<='1';tmp1<='1';tmp2<='0';

when17=>tmp<='1';tmp1<='1';tmp2<='0';

when18=>tmp<='1';tmp1<='1';tmp2<='0';

when19=>tmp<='1';tmp1<='1';tmp2<='0';

when20=>tmp<='1';tmp1<='1';tmp2<='0';

when21=>tmp<='1';tmp1<='1';tmp2<='0';

when22=>tmp<='1';tmp1<='1';tmp2<='0';

when23=>tmp<='1';tmp1<='1';tmp2<='0';cnt3<=0;

endcase;

endcase;

when"00"=>tmp<='0';tmp1<='0';tmp2<='0';

endcase;

endif;

endif;

endprocess;

aclk<=tmp;

bclk<=tmp1;

cclk<=tmp2;

endbehave;

7源程序二

libraryieee;

useieee.std_logic_116

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1