Verilog HDL建模(带VDD&VSS)——转发

【Verilog HDL】基础知识之开关级建模

//设计块
module CMOS_nor(out, a, b);
    input a, b;
    output out;
    
    //定义电源
    supply1 Vdd;
    supply0 Gnd;
    
    //实例化PMOS开关
    pmos (c, Vdd, b);
    pmos (out, c, a);
    
    nmos (out, Gnd, a);
    nmos (out, Gnd, b); 
endmodule

//激励块
module tb_CMOS_nor();
    reg A, B;
    wire OUT;
    
    CMOS_nor nor1(.out(OUT), .a(A), .b(B));
    
    initial begin
        A = 1'b0;
        B = 1'b0;
        #10 A = 1'b0;  B = 1'b1;
        #10 A = 1'b1;  B = 1'b0;
        #10 A = 1'b1;  B = 1'b1;
    end
    
    initial 
        $monitor($time ,"OUT = %b, A = %b, B = %b", OUT, A, B);
 
endmodule

//设计块
module mux2_1(out, s, in0, in1);
 
output out;
input  s, in0, in1;
 
wire sbar;  //s的取反
 
not (sbar, s);
 
cmos(out, in0, sbar, s);
cmos(out, in1, s, sbar);
endmodule

//程序块
//定义CMOS反相器
module CMOS_not(out, in);
 
    output out;
    input  in;
    supply1 Vdd;
    suppiy0 Gnd;
    
    pmos(out, Vdd, in);
    nmos(out, Gnd, in);
endmodule
 
//定义CMOS锁存器
module cff(q, qbar, d, clk);
 
    output q, qbar;
    input d, clk;
    
    wire e;
    wire nclk;
 
    CMOS_not nt1(nclk, clk);
 
    cmos(e, d, clk, nclk);
    cmos(e, q, nclk, clk);
endmodule

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值