数电组合逻辑实验.docx

上传人:b****4 文档编号:4910196 上传时间:2022-12-11 格式:DOCX 页数:9 大小:294.04KB
下载 相关 举报
数电组合逻辑实验.docx_第1页
第1页 / 共9页
数电组合逻辑实验.docx_第2页
第2页 / 共9页
数电组合逻辑实验.docx_第3页
第3页 / 共9页
数电组合逻辑实验.docx_第4页
第4页 / 共9页
数电组合逻辑实验.docx_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

数电组合逻辑实验.docx

《数电组合逻辑实验.docx》由会员分享,可在线阅读,更多相关《数电组合逻辑实验.docx(9页珍藏版)》请在冰豆网上搜索。

数电组合逻辑实验.docx

数电组合逻辑实验

西安交通大学实验报告

第页(共页)

课程电子技术实验实验日期:

年月日

专业班号:

电气12组别:

交报告日期:

年月日

姓名:

高加西学号:

2110401039报告退发:

(订正、重做)

同组者_____________________________教师审批签字:

实验名称:

基于HDL的组合逻辑实验

4.1逻辑门实验

4.1.1实验目的

●学习使用ISE软件生成一个新工程文件

●学习使用HDL进行电路设计

●学会编辑顶层文件和用户约束文件

●熟悉仿真及综合及实现还有FPGA配置等

●熟悉在BASYS2开发板上的简单外围设备的控制

4.1.2实验代码

使用HDL设计新的逻辑功能。

源文件如下:

modulegate2(

inputa,

inputb,

inputc,

inputd,

outputz

);

assignz=~((a&b)|(c&d));

endmodule

约束文件如下:

NET"a"LOC=P11;

NET"b"LOC=L3;

NET"c"LOC=K3;

NET"d"LOC=B4;

NET"z"LOC=M5;

仿真测试文件如下:

#100

a<=0;

b<=0;

c<=0;

d<=1;

#200

a<=0;

b<=0;

c<=1;

d<=0;

#200

a<=0;

b<=0;

c<=1;

d<=1;

#200

a<=0;

b<=1;

c<=0;

d<=0;

#200

a<=0;

b<=1;

c<=0;

d<=1;

#200

a<=0;

b<=1;

c<=1;

d<=0;

#200

a<=0;

b<=1;

c<=1;

d<=1;

#200

a<=1;

b<=0;

c<=0;

d<=0;

#200

a<=1;

b<=0;

c<=0;

d<=1;

#200

a<=1;

b<=0;

c<=1;

d<=0;

#200

a<=1;

b<=0;

c<=1;

d<=1;

#200

a<=1;

b<=1;

c<=0;

d<=0;

#200

a<=1;

b<=1;

c<=0;

d<=1;

#200

a<=1;

b<=1;

c<=1;

d<=0;

#200

a<=1;

b<=1;

c<=1;

d<=1;

波形如下:

4.3多路选择器实验

源文件如下:

moduleMUX(

inputwirea,

inputwireb,

inputwirec,

inputwired,

inputwires1,

inputwires2,

outputwirey

);

assigny=(a&(~s1)&(~s2))|(b&(~s1)&(s2))|(c&(s1)&(~s2))|(d&(s1)&(s2));

endmodule

约束文件如下:

NET"s1"LOC=P11;

NET"s2"LOC=L3;

NET"a"LOC=K3;

NET"b"LOC=B4;

NET"c"LOC=G3;

NET"d"LOC=F3;

NET"y"LOC=M5;

仿真测试文件如下:

#100

a<=1;

b<=0;

c<=0;

d<=0;

s1<=0;

s2<=0;

#400

a<=0;

b<=1;

c<=0;

d<=0;

s1<=0;

s2<=1;

#400

a<=0;

b<=0;

c<=1;

d<=0;

s1<=1;

s2<=0;

#400

a<=0;

b<=0;

c<=0;

d<=1;

s1<=1;

s2<=1;

end

结果截图如下:

4.3七段译码器实验

实验代码如下:

modulex7seg(

inputwire[7:

0]x,

inputwireclk,

inputwireclr,

outputreg[6:

0]a_to_g,

outputreg[3:

0]an

);

wire[1:

0]s;

reg[3:

0]digit;

reg[19:

0]clkdiv;

assigns=clkdiv[19:

18];

always@(*)

case(s)

0:

digit=x[7:

4];

1:

digit=x[3:

0];

2:

digit=0;

3:

digit=0;

default:

digit=x[7:

4];

endcase

always@(*)

case(digit)

0:

a_to_g=7'b0000001;

1:

a_to_g=7'b1001111;

2:

a_to_g=7'b0010010;

3:

a_to_g=7'b0000110;

4:

a_to_g=7'b1001100;

5:

a_to_g=7'b0100100;

6:

a_to_g=7'b0100000;

7:

a_to_g=7'b0001111;

8:

a_to_g=7'b0000000;

9:

a_to_g=7'b0000100;

'hA:

a_to_g=7'b0001000;

'hB:

a_to_g=7'b1100000;

'hC:

a_to_g=7'b0110001;

'hD:

a_to_g=7'b1000010;

'hE:

a_to_g=7'b0110000;

'hF:

a_to_g=7'b0111000;

default:

a_to_g=7'b0000001;

endcase

always@(*)

begin

an=4'b1111;

an[s]=0;

end

always@(posedgeclkorposedgeclr)

begin

if(clr==1)

clkdiv<=0;

else

clkdiv<=clkdiv+1;

end

endmodule

约束文件如下:

NET"a_to_g[0]"LOC=M12;

NET"a_to_g[1]"LOC=L13;

NET"a_to_g[2]"LOC=P12;

NET"a_to_g[3]"LOC=N11;

NET"a_to_g[4]"LOC=N14;

NET"a_to_g[5]"LOC=H12;

NET"a_to_g[6]"LOC=L14;

NET"an[3]"LOC=K14;

NET"an[2]"LOC=M13;

NET"an[1]"LOC=J12;

NET"an[0]"LOC=F12;

NET"clk"LOC=B8;

NET"clr"LOC=G12;

NET"x[0]"LOC=P11;

NET"x[1]"LOC=L3;

NET"x[2]"LOC=K3;

NET"x[3]"LOC=B4;

NET"x[4]"LOC=G3;

NET"x[5]"LOC=F3;

NET"x[6]"LOC=E2;

NET"x[7]"LOC=N3;

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

当前位置:首页 > 求职职场 > 简历

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

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