verilog 生成块_如何高效的编写Verilog——终极版
生活随笔
收集整理的這篇文章主要介紹了
verilog 生成块_如何高效的编写Verilog——终极版
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為了高效的編寫Verilog,通常有些編輯器插件可以自動生成代碼,比如自動端口定義,自動連線,自動實例化等等。公司的環境有很好用的自動化插件,想給自己的電腦也整個怎么做。比如Emacs中有個插件叫verilog-mode。但是博主習慣了用Vim,查詢后發現Vim也可以調用這個插件來實現自動化。verilog-mode開發者網站在這里,更多內容去上網查詢。https://www.veripool.org/wiki/verilog-mode這個是vim官網上的一個插件,但是有一些小bug,但是有好用的autodefine功能,這兩個可以配合著用,寫代碼的時候可以完全不用在意reg和wire類型的定義,直接寫assign和always塊,最后autodefine一下就可以了。更多內容點擊上面的視頻觀看。https://www.vim.org/scripts/script.php?script_id=4067自動化前module test (/*AUTOARG*/);input clk;input rst_n; input i;output douty;parameter DWIDTH=32;/*AUTOREG*//*AUTOWIRE*/assign doutx = i;always @(posedge clk or negedge rst_n)begin if(!rst_n)begin douty <= 1'd0; end else douty <= doutx;endassign doutx = i & o[DWODTH-1];foo u_foo(/*autoinst*/);endmodule//Local Variables://verilog-library-directories:("." "foo")//End:module foo(/*AUTOARG*/);input i;output [DWIDTH-1:0] o;endmodule//Local Variables://verilog-library-directories:(".")//End:自動化后module test (/*AUTOARG*/ // Outputs douty, // Inputs clk, rst_n, i );input clk;input rst_n; input i;output douty;parameter DWIDTH=32;/*AUTOREG*/// Beginning of automatic regs (for this module's undeclared outputs)reg douty;// End of automatics/*AUTOWIRE*/// Beginning of automatic wires (for undeclared instantiated-module outputs)wire [DWIDTH-1:0] o; // From u_foo of foo.v// End of automaticsassign doutx = i;always @(posedge clk or negedge rst_n)begin if(!rst_n)begin douty <= 1'd0; end else douty <= doutx;endassign doutx = i & o[DWODTH-1];foo u_foo(/*autoinst*/ // Outputs .o (o[DWIDTH-1:0]), // Inputs .i (i));endmodule//Local Variables://verilog-library-directories:("." "foo")//End:module foo(/*AUTOARG*/ // Outputs o, // Inputs i );input i;output [DWIDTH-1:0] o;endmodule//Local Variables://verilog-library-directories:(".")//End:需要在開發環境中安裝Emacs,支持Windows和Linux。更多配置操作點擊上方視頻觀看。歡迎去關注硅農 B站同名賬號,硅農,更多視頻敬請期待,還有不要忘記三連三連啊。
Windows Emacs安裝包:
鏈接:https://pan.baidu.com/s/1zPnschbDy1fIJRkTYiyWYQ提取碼:5u2t總結
以上是生活随笔為你收集整理的verilog 生成块_如何高效的编写Verilog——终极版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vector简单应用
- 下一篇: docker 查看镜像_Docker 核