您的位置:首页 > 其它

Verilog简单的组合逻辑设计

2015-06-01 22:37 316 查看
先用notepad++写好模块源代码,代码如下:

module compare(equal,a,b);
input a,b;
output equal;
assign equal = (a==b)?1:0;
endmodule


测试模块用于检测模块设计是否正确,代码如下:

`timescale 1ns/1ns
//`include "./compare.v"
module t;
reg a,b;
wire equal;
initial
begin
a = 0;
b = 0;
#100 a=0; b=1;
#100 a=1; b=1;
#100 a=1; b=0;
#100 a=0; b=0;
#100 $stop;
end

compare m(.equal(equal),.a(a),.b(b));
endmodule


组合逻辑仿真波形如下:



由仿真图可知,模块设计正确。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: