第九章测试
1.下面的代码不会生成多余的锁存器。
module test (out1, a, b, c, sel);
input a, b, c;
output out1;
input[1:0] sel;
reg out1;
always@(a or b or c or sel) begin
if (sel ==2'b10) out1 = a;
else if (sel == 2'b01) out1 = b;
else if (sel == 2'b11) out1 = c;
end
endmodule
( )
A:对 B:错
答案:B
2.下面的代码不存在RTL与综合后门级网表仿真不一致问题。
module compare(equal, a, b);
parameter size = 1;
output equal;
input [size-1:0] a, b;
reg equal;
always @(*)
begin
equal = (a == b);
end
endmodule
( )
A:错 B:对 3.下面的代码,会生成级联电路。
module test(SEL,A,B,C,D,Y);
input [1:0] SEL;
input A,B,C,D;
output Y;
reg Y;
always@(SEL,A,B,C,D) begin
if(SEL==2'b00)
Y=A;
else if(SEL==2'b01)
Y=B;
else if(SEL==2'b10)
Y=C;
else
Y=D;
end
endmodule
( )
A:错 B:对

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(157) dxwkbang
返回
顶部