Verilog HDL语言设计一个比较电路
发布时间
阅读量:
阅读量
- 设计一个比较电路,当输入的一位8421BCD码大于4时****,输出为1,否则为0,进行功能仿真,查看仿真结果,将Verilog代码和仿真波形图********整理入实验报告。****
代码****:****
module yanxu12(in,out);
input wire[3:0] in;
output reg out;
always @(in)
begin
if(in>4)
out<=1;
else
out<=0;
end
endmodule
`timescale 1ns/1ns
module test ();
reg[3:0] in;
wire out;
yanxu12 U(in,out);
initial
begin
#10 in[3:0]=4'b1000;
#10 in[3:0]=4'b0000;
#10 in[3:0]=4'b0110;
#10 in[3:0]=4'b0001;
#60 $stop;
end
endmodule
仿真图:

全部评论 (0)
还没有任何评论哟~
