verilog 生成块_如何高效的编写Verilog——终极版
生活随笔
收集整理的這篇文章主要介紹了
verilog 生成块_如何高效的编写Verilog——终极版
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
為了高效的編寫Verilog,通常有些編輯器插件可以自動生成代碼,比如自動端口定義,自動連線,自動實(shí)例化等等。公司的環(huán)境有很好用的自動化插件,想給自己的電腦也整個(gè)怎么做。比如Emacs中有個(gè)插件叫verilog-mode。但是博主習(xí)慣了用Vim,查詢后發(fā)現(xiàn)Vim也可以調(diào)用這個(gè)插件來實(shí)現(xiàn)自動化。verilog-mode開發(fā)者網(wǎng)站在這里,更多內(nèi)容去上網(wǎng)查詢。https://www.veripool.org/wiki/verilog-mode這個(gè)是vim官網(wǎng)上的一個(gè)插件,但是有一些小bug,但是有好用的autodefine功能,這兩個(gè)可以配合著用,寫代碼的時(shí)候可以完全不用在意reg和wire類型的定義,直接寫assign和always塊,最后autodefine一下就可以了。更多內(nèi)容點(diǎn)擊上面的視頻觀看。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:需要在開發(fā)環(huán)境中安裝Emacs,支持Windows和Linux。更多配置操作點(diǎn)擊上方視頻觀看。歡迎去關(guān)注硅農(nóng) B站同名賬號,硅農(nóng),更多視頻敬請期待,還有不要忘記三連三連啊。
Windows Emacs安裝包:
鏈接:https://pan.baidu.com/s/1zPnschbDy1fIJRkTYiyWYQ提取碼:5u2t總結(jié)
以上是生活随笔為你收集整理的verilog 生成块_如何高效的编写Verilog——终极版的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vector简单应用
- 下一篇: docker 查看镜像_Docker 核