Questions tagged [verilog]

For use with the Verilog hardware-description language. Also tag with the IDE or fpga used, if applicable.

From Wikipedia:

Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction.

Logic synthesis

Automated tools are able to translate Verilog code meeting certain restrictions into a gate-level description of the circuit that can then be implemented in an FPGA or IC. The task is in some ways similar to the task of a compiler for conventional programming languages, but such tools for Verilog are known as "synthesis tools". Language constructs and coding styles that can be processed by synthesis tools are known as "synthesizable". Constructs that are not synthesizable may be used for testbenches, reference models, or debug instrumentation.

When asking a question, please specify whether you are looking for a synthesizable solution.

Sometimes referred to as Verilog HDL, not to be confused with VHDL.

Standardization

Verilog was initially a proprietary system developed by Gateway Design Automation (later acquired by Cadence Design Systems). Verilog became an open standard under the auspices of Open Verilog International (OVI). OVI became part of Accellera, a non-profit organization that develops standards for modeling and verifying system-level designs. Accellera contributes standards to the IEEE once they are mature, and Verilog became standardized as IEEE 1364. The last version was IEEE 1364-2005 (not available as a free download). IEEE 1364 Verilog has been superseded by IEEE 1800 SystemVerilog.

Tags specific to Verilog

6035 questions
6
votes
2 answers

Syntax for using an array of wires as input

I have the following module: module add_8bit ( output wire co, output wire [7:0] r, input wire ci, input wire [7:0] x, input wire [7:0] y ); I am trying to use it via the following code: …
Cheetah
  • 13,785
  • 31
  • 106
  • 190
6
votes
1 answer

How to infer block RAM in Verilog

I've got one very specific problem with a project that has been haunting me for days now. I have the following Verilog code for a RAM module: module RAM_param(clk, addr, read_write, clear, data_in, data_out); parameter n = 4; parameter w =…
stevendesu
  • 15,753
  • 22
  • 105
  • 182
6
votes
2 answers

How to get array of values as plusargs?

How to get the array of values as arguments. I need get an array of commands of undefined size from the command line. How to get these arguments into an array or queue? Eg: +CMDS=READ,WRITE,READ_N_WRITE It should be taken to an array.
bachu
  • 61
  • 1
  • 4
6
votes
2 answers

Icarus verilog dump memory array ($dumpvars)

I try to dump an array (reg [31:0] data [31:0]) but I can't do it successfully. I've tried the way that is in the iverilog wiki: integer idx; for (idx = 0; idx < 32; idx = idx + 1) $dumpvars(0,cpu_tb.cpu0.cpu_dp.cpu_regs.data[idx]); It works,…
gon1332
  • 1,930
  • 1
  • 24
  • 30
6
votes
4 answers

How to define a parameterized multiplexer using SystemVerilog

I am trying to create a module which switches x input data packets to a single output packet according to a one hot input. If x was a fixed value of 4, I would just create a case statement, case (onehot) 4'b0001 : o_data = i_data[0]; 4'b0010 :…
user2646276
6
votes
2 answers

How do I access an internal reg inside a module?

I have this architechture/topology in Verilog: How can I access the internal reg IntReg, that isn't a input/output in IntModule, in SystemVerilog? always @(posedge clk) begin $display ("[Time %0t ps] IntReg value = %x", $time,…
Filipe Utzig
  • 121
  • 1
  • 5
6
votes
1 answer

Parameter warning: truncated value with size 32 to match size of target

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…
DevGoldm
  • 828
  • 12
  • 28
6
votes
2 answers

Synchronous reset design in fpga as the limiting factor for timing constraints

I've got an fpga design that utilizes synchronous resets (I prefer synchronous resets to asynchronous for reasons discussed elsewhere). I have four different clock domains in the design and I utilize a single button to generate my reset signal,…
Doov
  • 863
  • 2
  • 12
  • 25
6
votes
2 answers

Shifting 2D array Verilog

I dont know what doesnt work on the following code, but it wont synthesize: reg [7:0] FIFO [0:8]; always@(posedge clk) begin if(wr & !rd & !full) begin FIFO[0:8] <= {data_in, FIFO[1:8]}; end end I tried to index the FIFO other ways…
zsidanyi
  • 105
  • 1
  • 2
  • 6
6
votes
2 answers

Tick Counter Verilog

I was wondering how can i write a verilog program for a tick counter. When the fast input is low, the output tick is high for one cycle every 150 ms (every 7500000 cycles) The clk period is 20ns. If the fast input is high, tick should go high for…
intensified
  • 159
  • 3
  • 4
  • 10
6
votes
2 answers

Why are nonblocking assignments not allowed in Verilog functions?

I have read that use of nonblocking assignments is not allowed in Verilog functions. Can anyone suggest a plausible explanation for this?
Akash
  • 89
  • 3
  • 8
5
votes
1 answer

Connecting a module output to a register

I have tried connecting a module output to a register, as follows: module test ( input rst_n, input clk, output reg [7:0] count ); always @(posedge clk or negedge rst_n) begin if(!rst_n) begin count <= 7'h0; end else begin …
Randomblue
  • 112,777
  • 145
  • 353
  • 547
5
votes
4 answers

How can I calculate propagation delay through series of combinational circuits using Verilog and FPGA?

I'm new to FPGA and HDL but I'm trying to learn and cant figure this out. How can I calculate or estimate propagation delay though several levels of combination logic. Can I only determine this empirically or can I figure it out at design time. …
Frank Dejay
  • 689
  • 5
  • 13
  • 17
5
votes
4 answers

verilog always, begin and end evaluation

I'm trying to learn Verilog using Pong P. Chu's book. I have a question about how an always block is evaluated and implemented. A style in the authors code is confusing me. In this example he codes an FSM with two output registers 'y1' and 'y2'.…
Frank Dejay
  • 689
  • 5
  • 13
  • 17
5
votes
3 answers

combinatorial hardware multiplication in verilog

Suppose I have a multiplier code like this, module multiply( output [63:0] result, input [31:0] a, input [31:0] b ); assign result = a * b; endmodule This produces a lot of gates. What preferable…
e19293001
  • 2,783
  • 9
  • 42
  • 54