您身边的网站建设专家
成功案例

【建站服务】甘南网站建设_企业网站制作公司_高端网站设计开发-甘南上往-域名申请

日期: 2022-09-21 03:22:15 浏览数:20


上往建站提供服务器空间服务商百度快照排名网站托管百度推广运营,致力于设计外包服务与源代码定制开发360推广搜狗推广,增加网站的能见度及访问量提升网络营销的效果,主营:网站公司,百度推广公司电话,官网搭建服务,网站服务企业排名,服务器空间,英文域名等业务,专业团队服务,效果好。


甘南网站建设_企业网站制作公司_高端网站设计开发-甘南上往

网站建设.png

         DOUT ;

(3) 当然,信号 DOUT 的声明完全可以合并成一句:

output reg      DOUT ;

(4) 还有一种更简洁且常用的方法来声明端口,即在 module 声明时就陈列出端口及其类型。reg 型端口要么在 module 声明时声明,要么在 module 实体中声明,例如以下 2 种写法是等效的。

实例

module pad(
    input        DIN, OEN ,
    input [1:0]  PULL ,
    inout        PAD ,
    output reg   DOUT
    );
 
module pad(
    input        DIN, OEN ,
    input [1:0]  PULL ,
    inout        PAD ,
    output       DOUT
    );
 
    reg        DOUT ;

inout 端口仿真

对包含有 inout 端口类型的 pad 模型进行仿真。pad 模型完整代码如下:

实例

module pad(
    //DIN, pad driver when pad configured as output
    //OEN, pad direction(1-input, o-output)
    input        DIN, OEN ,
    //pull function (00,01-dispull, 10-pullup, 11-pulldown)
    input [1:0]  PULL ,
    inout        PAD ,
    //pad load when pad configured as input
    output reg   DOUT
    );
 
    //input:(not effect pad external input logic), output: DIN->PAD
    assign       PAD = OEN? 'bz : DIN ;
 
    //input:(PAD->DOUT)
    always @(*) begin
        if (OEN == 1) begin //input
            DOUT   = PAD ;
        end
        else begin
            DOUT   = 'bz ;
        end
    end
 
    //use tristate gate in Verilog to realize pull up/down function
    bufif1  puller(PAD, PULL[0], PULL[1]);
 
endmodule

testbench代码如下:

实例

`timescale 1ns/1ns



`timescale 1ns/1ns

 

module test ;

    reg          DIN, OEN ;

    reg [1:0]    PULL ;

    wire         PAD ;

    wire         DOUT ;

 

    reg          PAD_REG ;

    assign       PAD = OEN ? PAD_REG : 1'bz ; //

 

    initial begin

        PAD_REG   = 1'bz ;        //pad with no dirve at first

        OEN       = 1'b1 ;        //input simulation

        #0 ;      PULL      = 2'b10 ;   //pull down

        #20 ;     PULL      = 2'b11 ;   //pull up

        #20 ;     PULL      = 2'b00 ;   //dispull

        #20 ;     PAD_REG   = 1'b0 ;

        #20 ;     PAD_REG   = 1'b1 ;

 

        #30 ;     OEN       = 1'b0 ;    //output simulation

                  DIN       = 1'bz ;

        #15 ;     DIN       = 1'b0 ;

        #15 ;     DIN       = 1'b1 ;

    end

 

    pad     u_pad(

        .DIN     (DIN) ,

        .OEN     (OEN) ,

        .PULL    (PULL) ,

        .PAD     (PAD) ,

        .DOUT    (DOUT)

    );

 

    initial begin

        forever begin

            #100;

            if ($time >= 1000)  $finish ;

        end

    end

 

endmodule // test

仿真结果如下:



甘南网站建设_企业网站制作公司_高端网站设计开发-甘南上往


上往建站提供搭建网站域名注册官网备案服务网店详情页设计企业网店专业网络店铺管理运营全托管公司咨询电话,服务器空间,微信公众号托管网页美工排版,致力于域名申请竞价托管软文推广全网营销,提供标准级专业技术保障,了却后顾之忧,主营:虚拟主机网站推广百度竞价托管网站建设上网建站推广服务网络公司有哪些等业务,专业团队服务,效果好。

服务热线:400-111-6878 手机微信同号:18118153152(各城市商务人员可上门服务)


全国咨询热线:400-111-6878

地址:全国各地都有驻点商务

Copyright © 2021 通陆科技

网站建设上往建站