FPGA Verilog LED 常亮 + (使用子模塊範例)

版权声明:本文为博主 ( 黃彥霖 ) 原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38884324/article/details/81161219

前言:

單純 LED 持續一直亮…


程式碼一:


module key_test
(
    output[3:0]           led        // 宣告四顆 LED 燈
);

    assign led = 4'b0011;    // 讓兩顆 LED 燈持續一直亮著

endmodule 

程式碼二:

上層模塊:

module top_test
(
    output wire [3:0] led // 宣告四顆 LED 燈
);

    sub_test u1(
        .led(led)
    );

endmodule 

子模塊:

module sub_test
(   
     output wire [3:0] led
);

    assign led = 4'b1100;    // 讓兩顆 LED 燈持續一直亮著'

endmodule 

猜你喜欢

转载自blog.csdn.net/weixin_38884324/article/details/81161219
今日推荐