关于非门的Verilog功能实现与modelsim联合仿真心得

1.Verilog代码实现

//file name not_gate
//file function : 实现非门的逻辑运算
//file version : 1.0v
//date : 2023/3/30
//Author : ZihangNie
//********************************************************************

module not_gate (

    // input signal
	input   a ,             //输入信号a

	//output signal  
	output  y               //输出信号y

) ;

assign   y =  ~ a ;

endmodule 

2 test_bench文件仿真

//file name : tb_not_gate 
//file funciton : 非门的仿真文件
//file version : 2023/3/30
//Author :ZihangNie

//*********************************
`timescale   1ns/1ps  

module  tb_not_gate ();

//input define 
reg          a; 
reg          sys_clk;
reg          sys_rst_n;
//output define 
wire         y ;

//初始化操作

initial begin 
//先对信号进行初始化

sys_clk = 1'b0 ;
sys_rst_n = 1'b0 ;
      a = 1'b0 ;

#200
    sys_rst_n = 1'b1;
	        a = 1'b1;
#200
            a=  1'b0;
    $stop ;
end

always #10 sys_clk =  ~sys_clk;
//对模块进行例化



not_gate u_not_gate(
    .a(a),
	.y(y)




);
endmodule

time_scale  后面跟的是时间单位和仿真的精度

 实现预期的功能

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值