VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx

上传人:b****6 文档编号:7406024 上传时间:2023-01-23 格式:DOCX 页数:10 大小:33.91KB
下载 相关 举报
VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx_第1页
第1页 / 共10页
VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx_第2页
第2页 / 共10页
VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx_第3页
第3页 / 共10页
VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx_第4页
第4页 / 共10页
VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx

《VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx》由会员分享,可在线阅读,更多相关《VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx(10页珍藏版)》请在冰豆网上搜索。

VerilogHDL数字设计与综合夏宇闻译第二版课后题答案.docx

VerilogHDL数字设计与综合夏宇闻译第二版课后题答案

Verilog-HDL数字设计与综合-夏宇闻译(第二版)课后题答案

LT

c:

-2(1010)--取反(1101)----再加一(1110)

d:

'h1234

/*2---------------------------------------------------------------*/

a:

正确

b:

正确

c:

正确

d:

正确

/*3---------------------------------------------------------------*/

a:

合法

b:

合法

c:

不合法,含有$为延时含义

d:

标识符组成:

字母数字下划线。

/*4---------------------------------------------------------------*/

a:

wire[7:

0]a_in;

b:

reg[31:

0]

c:

integercount;

d:

timesnap_shot;

e:

integerdelays[20];

f:

reg[63:

0]mem[256];

g:

parametercach_size=256;

/*5---------------------------------------------------------------*/

a:

1010

b:

10

c:

400

第四章

/*1-----------------------------------------------------------------------*/

//模块的基本组成部分有哪些?

哪几个部分必须出现?

模块定义已关键字module开始,模块名,端口列表,端口声明和可选的参数声明出现在其他部分的前面

,endmodule必须为最后一条语句

1)wire。

reg和其他类型的变量的声明

2)数据流语句(assign,连续赋值语句)

3)低层模块实例

4)always和initial块,所有的行为语句都在这些块中

5)任务和函数。

其中module和模块名和endmodule是必不可少的。

/*2-----------------------------------------------------------------------*/

//一个不与外界环境交互的模块是否有端口?

模块定义中是否有端口列表?

不与外界交互即没有端口列表,在没有端口的情况下端口列表也是不存在的。

/*3-----------------------------------------------------------------------*/

moduleshift_reg(reg_in[3:

0],clock,reg_out[3:

0]);

input[3:

0]reg_in;

inputclock;

output[3:

0]reg_out;

//......

endmodule;

/*4-----------------------------------------------------------------------*/

//connectinorder

modulestimulus();

reg[3:

0]REG_IN;

wire[3:

0]REG_OUT;

regCLK;

shift_regsr1(REG_IN,CLK,REG_OUT);

endmodule

/*5-----------------------------------------------------------------------*/

//connectbyname

modulestimulus();

reg[3:

0]REG_IN;

wire[3:

0]REG_OUT;

regCLK;

shift_regsr1(.clock(CLK),.reg_in(REG_IN),.reg_out(REG_OUT));

endmodule

/*6-----------------------------------------------------------------------*/

stimulus.REG_IN

stimulus.CLK;

stimulus.REG_OUT;

/*7-----------------------------------------------------------------------*/

stimulus.sr1;

stimulus.sr1.clock;

stimulus.sr1.reg_in;

stimulus.sr1.reg_out;

第五章

/*1--------------------------------------------------------------------*/

//利用双输入的nand门设计自己的与或非门。

//my_and

modulemy_and(out,in1,in2);

inputin1,in2;

outputout;

endmodule

//my_not

modulemy_not(out,in1);

inputin1;

outputout;

nand(out,in1,in1);

endmodule

//my_and

modulemy_or(out,in1,in2);

wiret;

nand(t,in1,in2);

nand(out,t,t);

//

endmodule

/*2--------------------------------------------------------------------*/

//使用上题中完成的my_or,my_and,my_not构造一个双

//输入的xor门,其功能是计算z=x'y+xy'

/*3--------------------------------------------------------------------*/

//全加器

modulesum(a,b,c_in,sum,c_out);

inputa,b,c_in;

outputsum,c_out;

wirey1,y2,y3,y4;

wirex1,x2,x3;

or(sum,y1,y2,y3,y4);

and(y1,a,b,c_in);

and(y2,x1,b,x3);

and(y3,x1,x2,c_in);

and(y4,a,x2,x3);

not(x1,a);

not(x2,b);

not(x3,c);

wirej1,j2,j3;

or(c_out,j1,j2,j3);

and(j1,a,b);

and(j2,b,c_in);

and(j3,a,c_in);

endmodule

/*4--------------------------------------------------------------------*/

//带有延时的SR锁存器

moduleSR(reset,q,set,qbar);

inputreset,set;

outputq,qbar;

wireline1,line2;

nor(line2,reset,line1);

nor(line1,set,line2);

endmodule

/*---------------------------ISE中一个端口如何接多根线?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

*/

/*5--------------------------------------------------------------------*/

moduleselect(out,in1,in2,s);

inputin1,in2,s;

outputout;

//3为上升延迟,4为下降延时,5为关断延迟。

bufif1#(1:

2:

3,3:

4:

5,5:

6:

7)b2(out,in1,s);

bufif0#(1:

2:

3,3:

4:

5,5:

6:

7)b1(out,in2,s);

endmodule

/*--------------------------------------------------------------------*/

第六章

/*1----------------------------------------------------------------*/

//全减器

//输入:

x,y,z(前面的借位)

//输出:

差和借位

modulesub(x,y,z,D,B);

inputx,y,z;

outputD,B;

wirey0,y1,y2,y3;

wirej1,j2,j0;

//非门

not(j0,x);

not(j1,y);

not(j2,z);

and(y0,j0,j1,j2);

and(y1,j0,y,j2);

and(y2,x,j1,j2);

and(y3,x,y,z);

or(D,y0,y1,y2,y3);

//B

wirea1,a0,a2;

and(a0,j0,y);

and(a1,j0,z);

and(a2,y,z);

or(B,a1,a0,a2);

endmodule

//激励模块:

modulestimulus;

//initial从仿真0时刻开始,而且只执行一次,若程序中有若干个initial块,则并发执行。

rega,b,c;

wired,e;

regi;

subsub(a,b,c,d,e);

initial

for(i=1;i>0;)begin

#5;

a=1;

b=1;

c=0;

#5;

a=1;

b=0;

c=0;

end

endmodule

/*2----------------------------------------------------------------*/

//大小比较器

modulecmp(A,B,A_gt_B,A_lt_B,A_eq_B);

input[3:

0]A,[3:

0]B;

outputA_gt_B,A_lt_B,A_eq_B;

endmodule

/*3----------------------------------------------------------------*/

modulesyn_counter(clear,clock,count_enable,Q);

inputclear,clock,count_enable;

output[3:

0]Q;

wire[3:

0]Q;

wireb1,b2,b3;

nand(b1,count_enable,Q[1]);

nand(b2,b1,Q[2]);

nand(b3,b2,Q[3]);

jkjk1(count_enable,count_enable,clear,clock,Q[0],);

jkjk2(b1,b1,clear,clock,Q[1],);

jkjk3(b2,b2,clear,clock,Q[2],);

jkjk4(b3,b3,clear,clock,Q[3],);

endmodule

modulejk(J,K,clear,clock,q,qbar);

inputJ,K,clear,clock;

outputq,qbar;

wirea,y,c,b,ybar,cbar,d;

not(cbar,clock);

nanda1(a,qbar,J,clock,clear);

nanda2(b,clock,K,q);

nanda3(y,a,ybar);

nanda4(ybar,y,clear,b);

nanda5(c,y,cbar);

nanda6(d,cbar,ybar);

nanda7(q,c,qbar);

nanda8(qbar,q,clear,d);

endmodule

第七章

/*1----------------------------------------------------------------*/

regoscillate=0;

initial

begin

forever

#30oscillate=~oscillate;

end

/*2----------------------------------------------------------------*/

initial

clock=0;

always

begin

#30clock=1;

#10clock=0;

end

/*3----------------------------------------------------------------*/

执行时刻:

0,10,15,35.

最终结果:

a=0,b=1,c=0;d=3'b010;

/*4----------------------------------------------------------------*/

执行时刻:

0,10,5,20.

最终结果:

a=0,b=1,c=0;d=3'b010;

/*5----------------------------------------------------------------*/

a,b,c,d:

0,1,1,0

//每个initial中的语句是串行执行的。

/*6----------------------------------------------------------------*/

d=0;

 

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

当前位置:首页 > 高等教育 > 理学

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

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