verilog

What SystemVerilog features should be avoided in synthesis?

Deadly 提交于 2020-07-15 02:58:27
问题 SystemVerilog introduced some very useful constructs to improve coding style. However, as one of my coworkers always says, "You are not writing software, you are describing hardware." With that in mind, what features of the language should be avoided when the end result needs to be synthesized? This paper shows what features are currently synthesizable by the Synopsys tools, but to be safe I think one should only use the features that are synthesizable by all of the major vendors. Also, what

What SystemVerilog features should be avoided in synthesis?

随声附和 提交于 2020-07-15 02:58:08
问题 SystemVerilog introduced some very useful constructs to improve coding style. However, as one of my coworkers always says, "You are not writing software, you are describing hardware." With that in mind, what features of the language should be avoided when the end result needs to be synthesized? This paper shows what features are currently synthesizable by the Synopsys tools, but to be safe I think one should only use the features that are synthesizable by all of the major vendors. Also, what

Call task from another Verilog module

♀尐吖头ヾ 提交于 2020-05-31 05:54:23
问题 I'm trying to learn Verilog and I have a Verilog module and what I wish to do is then call another file and run that from within my current module. So I have my module like: module maths(); //register etc details initial begin `include "add.v" end endmodule and my add.v file that is being called from the maths module is like: task add; A = $random; B = $random; C = A + B; $display("Answer: %d", C); endtask But I am receiving the errors from the task file near "task": syntax error, unexpected

Constant padding in Verilog

末鹿安然 提交于 2020-05-16 01:56:05
问题 Here is the example behavioral Verilog code in question module constant; reg [7:0] foo; initial begin foo = 1'bz; $display("%H", foo); end endmodule Icarus Verilog gave me $ iverilog -o constant constant.v $ ./constant 0Z However, according to this website (and the lecturer of an FPGA course I am taking), If number is smaller than the size constant, then it will be padded to the left with zeros. If the most significant bit of a specified number has an unknown (x) or high-impedance (z) value,

Producing a clock glitch in a Verilog design

倖福魔咒の 提交于 2020-05-15 05:36:09
问题 I am designing a chip using Verilog. I have a 3-bit counter. I want that when the counter is in its 8th loop, there should be a clock glitch , and thereafter work normally. What could be the possible ways of producing a clock glitch in a Verilog design? 回答1: One way to inject glitches on a clock signal is to use force and release from your testbench: module tb; reg clk; reg [2:0] cnt; reg reset; always begin #5 clk <= 0; #5 clk <= 1; end always @(posedge clk or posedge reset) begin if (reset)

Error while creating a module that implements a register file that does vector subtraction (Verilog)

风流意气都作罢 提交于 2020-04-18 03:46:55
问题 I am very new to Verilog and I have been given a task to create a module that implements a register file with subtraction functionality. I do have an basic idea (I think) I do know that I need to do this by supplying the output of a XOR gate bundle as the second operand of the adder and a cary-in that is 1 (high or true) when the operation is subtraction and 0 (low or false) when it is anything else. I dont know how to do this. Any help would be appreciated. Here is what I have so far: module

$display vs $strobe vs $monitor in verilog? [closed]

左心房为你撑大大i 提交于 2020-04-04 06:37:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Closed last year . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. What is the difference between $display vs $strobe vs $monitor in verilog? When in the event queue does each apply, and how do the statements interact? Can any statement inhibit another? 回答1: I'll be nice and

[高级篇] 在qucs中使用verilog

痴心易碎 提交于 2020-03-01 05:00:40
为了确保能够正确运行,请确保你现在程序版本为 Qucs 0.0.18 其实将verilog程序放入qucs并不是一件复杂的事情,qucs已经足够简化我们的工作,我们只需要将模块的源代码复制到当前qucs的工作目录下qucs就能进行一系列智能的操作,包括自动添加到工程,以及能够自动识别我们verilog的模块的端口列表。 打开qucs,现在Verilog标签下没有任何文件,我们只需要将我们的verilog的.v文件拷贝过来qucs就能自动识别了。 一个verilog的半加器代码,这里verilog标签下已经识别到我们的文件了,如果qucs没有刷新在Projects下重新点击一下工程的名字就能看到文件添加过来了。 然后鼠标点击一下这个main.v,之后鼠标移到我们的原理图上就会出现一个子电路,四个端口,和我们程序里的两个输入两个输出一致。 qucs非常漂亮! 然后我们进行一个数字的仿真. 注意,在digital simulation中我们需要将model的值修改为verilog,因为还有一个选项是VHDL,所以理论上VHDL的代码也能仿真。 点击OK之后我们就算做好工作了,然后仿真一下,用真值表显示一下我们的半加器是否正确。 qucs 0.0.18的仿真比老版本的快速多 了,而且以前版本偶尔会出现仿真卡住的现象也消失了,新版本做的修改还是挺大的。 这个仿真可以将模块用于电路中

Verilog: Non-integer parameters

你离开我真会死。 提交于 2020-02-24 04:25:24
问题 I have a parameter as follows: parameter PARAM = 7'd69; When I try to assign that value to the register below: reg [6:0] r; Like this: r <= PARAM; I get synthesis warnings: Warning (10230): ... truncated value with size 32 to match size of target (7) - This I assume is because PARAM is being interpreted as an integer because it is defined as a parameter. Is there any way to define PARAM as 7 bits wide? I could always pass this in as a 7 bit input to my module but I was wondering if there is a

How I can find maximum number in verilog array

强颜欢笑 提交于 2020-02-07 18:58:53
问题 So, I have a reg[7:0] corr_Output[0:63]; which is filled with values in my module. How I can find maximum number in this array at one CLK cycle? I wrote a 8 bit comparator: module Comparator2D( input [7:0] X1, input [7:0] indexX1, input [7:0] X2, input [7:0] indexX2, output [7:0] Y, output [7:0] indexY ); always begin if (X1 > X2) begin Y = X1; indexY = indexX1; end else begin Y = X2; indexY = indexX2; end end endmodule But I dont know how I should instantiate this module in my top design? I