English 中文(简体)
查找verilog 2001模块声明语法
原标题:Looking for verilog 2001 module declaration grammar

I can find several v2k full grammars with google -- but either I am losing my mind or they are all broken in the same way with regard to port declarations. Example input:

module foo ( 
    input x, 
     output [2:0] y);
endmodule;

I can t find a grammar which will parse that syntax, but they will accept things like this as a port in the list_of_port:

         { name[3:0], name2[2:0]} 
.. or ..   .name( othername )

也就是说,我希望在模块实例化端口绑定的语法中看到的东西是为模块端口声明提供的。

示例

http://www.externsoft.ch/download/verilog.html#module_declaration

http://www.syncad.com/VeriLogger_bnf_Syntax_Verilog_2001.htm#list_of_ports

我想我可以查看icarus源代码,或者Perl::Verilog。不过,我希望能得到一个确认,即上面的语法已经被破坏了——或者,如果没有,有人能指出我遗漏了什么吗。一个正确语法的来源将是伟大的。。。

最佳回答

您的第一个代码块使用在IEEE 1364-2001(第12.3.3节)和所有更高版本中有效的list_of_port_declarations语法。第一个链接的语法不完整,第二个链接看起来包含此构造

您的第二个代码块绝对有效。在模块定义中看起来像实例端口的语法是显式端口构造。不经常使用,当您希望在外部呈现与在内部使用的信号接口不同的信号接口时,会使用这些接口。以下是几个例子:

module mod1(portA);
input portA; //Implicit port named portA connected to implicit wire portA
endmodule

这里,portA是隐式的,并继承输入声明中的属性,因为它共享相同的标识符portA。

module mod2(.expA(sigA));
wire sigA;
endmodule

module top;
wire sigB;
mod2 modInst(.expA(sigB));
endmodule

在这个例子中,我们为mod2模块使用了一个显式端口。内部expA连接到sigA,但正如您在实例modInst中看到的,我们使用外部名称来命名连接。

module mod3 (.expA({sigC,sigD}), sigF, .expB(sigG[1],sigB[3:0]));
output reg [3:0] sigC, sigD;
input wire [1:0] sigG;
input wire [7:0] sigB;
output wire sigF;
endmodule

这也是有效的。端口expA采用sigC和sigD串联的宽度。与端口expB相同。

问题回答

暂无回答




相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes ...

XML DOM parsing br tag

I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...

Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

Locating specific string and capturing data following it

I built a site a long time ago and now I want to place the data into a database without copying and pasting the 400+ pages that it has grown to so that I can make the site database driven. My site ...

热门标签