简体   繁体   English

系统Verilog仿真与执行

[英]System Verilog simulation versus execution

Much ado is made about SystemVerilog (SV) being used for both programming chips and simulating SV code. 关于SystemVerilog(SV)用于编程芯片和模拟SV代码的问题很多。 This economy of language constructs has caused a bit of confusion for me: Section 9.2.2 of the SV Reference states 语言结构的这种经济性给我带来了一些困惑:SV参考文献的第9.2.2节说明

"There are four forms of always procedures: always, always_comb, always_latch, and always_ff. All forms of always procedures repeat continuously throughout the duration of the simulation." “总有四种形式的程序:always,always_comb,always_latch和always_ff。所有形式的always程序在整个模拟过程中不断重复。”

Certainly, though, these constructs also specify the creation of combinatorial and latched logic. 当然,这些结构当然也指定了组合和锁存逻辑的创建。 So is the SV standard aimed mainly at simulation, leaving it up to the chip OEMs to advise customers which SV constructs will result in actual hardware, as Altera has done here ? 那么SV标准主要是针对模拟,还是由芯片OEM提供给客户建议哪些SV结构会产生实际硬件,就像Altera在这里做的那样?

Altera makes CPLDs and FPGAs, some of which are not too expensive (hence my drive to learn SV). Altera制造CPLD和FPGA,其中一些并不太昂贵(因此我开始学习SV)。 That subset of SV constructs blessed by Altera as synthesisable would compile in Quartus into a form suitable for downloading to a chip. 由Altera祝福的SV构造子集可合成将在Quartus中编译成适合下载到芯片的形式。 Altera labels other constructs, such as many assertions (section 16 of the above reference), as "Supported. Ignored for synthesis." Altera标记其他构造,例如许多断言(上面引用的第16节),“支持。忽略合成”。 with concurrent assertions as an example. 以并发断言为例。

So my conclusion, pending new information gained here, is that I may use, for instance, concurrent assertions for a test bench module only, but immediate assertions can be used anywhere. 因此,我的结论是,在此处获得的新信息之外,我可以使用例如仅针对测试平台模块的并发断言,但是可以在任何地方使用立即断言。

Basically I am trying to get a picture of how SV works, and how I may best interpret the SV standard, quoted above. 基本上我试图了解SV如何工作,以及我如何最好地解释上面引用的SV标准。 Thanks. 谢谢。

The Verilog languages are quite low level so when designing hardware for FPGA or ASIC we have combinatorial logic and sequential logic. Verilog语言水平很低,因此在为FPGA或ASIC设计硬件时,我们有组合逻辑和顺序逻辑。 Assertions in any tools are really for verification, the concept is to high level to be able to get the hardware you want. 任何工具中的断言都是真正用于验证的,概念是高级别的,以便能够获得您想要的硬件。

SystemVerilog is not just for simulation, but using the correct subset for design will allow RTL and a post synthesis gates file to match in simulation. SystemVerilog不仅适用于仿真,而且使用正确的设计子集将允许RTL和后合成门文件在仿真中匹配。 The way you write SystemVerilog design will determine what the synthesis tools generate. 编写SystemVerilog设计的方式将决定合成工具生成的内容。 Flip-flops and latches will only be created if you have implied them. 只有在您隐含它们时才会创建触发器和锁存器。 Different tools may optimise the combinatorial sections differently but if written using best practices then they should all be functionally equivalent. 不同的工具可以不同地优化组合部分,但如果使用最佳实践编写,那么它们应该在功能上都是等同的。

Verilog in a day gives a guide on design. Verilog在一天中提供了设计指南。 The SystemVerilog LRM does not split the spec between synthesisable components and verification but the unofficial guide to synthesising SystemVerilog is a good guide. SystemVerilog LRM不会在可合成组件和验证之间拆分规范,但合成SystemVerilog非官方指南是一个很好的指南。

To the part of the question regarding usage of the different always blocks. 关于使用不同的always块的问题的一部分。

From Verilog we have: 从Verilog我们有:

always @*             // For combinatorial logic
always @(posedge clk) // For flip-flops (sequential) Logic

Implying a latch involved an incomplete if/else branch and was quite difficult tell if it was a accident or actually intended. 暗示一个闩锁涉及一个不完整的if / else分支,并且很难说它是一个意外还是实际意图。

//Latch from bug or actually intended?
always @* begin
  if (enable) begin
    //..
  end
end

System verilog has kept the simple always for backwards compatibility with verilog code but added three types so the designer can be explicit in there design intent. 系统verilog always保持简单, always向后兼容verilog代码,但添加了三种类型,因此设计人员可以明确设计意图。

always_comb  //For Combinatorial logic
always_latch //For implying latches
always_ff    //For implying flip-flops (sequential logic)

always_comb has stricter rules than always @* for triggering in simulation to further minimise RTL to Gate level simulation mismatch. always_comb具有比always @*更为严格的规则,用于在仿真中触发,以进一步最小化RTL到门级仿真不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM