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
15
votes
1 answer

Better indentation in two-mode-mode in Emacs

I am using Emacs to modify code which is interleaving Perl and Verilog. I am using two-mode-mode to switch between the two, which works as expected. The problem is that the perl code is indicated on a line by line basis with //; as shown here: This…
Megan
  • 151
  • 2
15
votes
8 answers

Why is Verilog not considered a programming language?

In class the professor said that students shouldn't say that they learned to program in Verilog. He said something like Verilog isn't used to program it's used to design. So how is Verilog different from other programming languages?
node ninja
  • 31,796
  • 59
  • 166
  • 254
15
votes
6 answers

Microcontroller + Verilog/VHDL simulator?

Over the years I've worked on a number of microcontroller-based projects; mostly with Microchip's PICs. I've used various microcontroller simulators, and while they can be very helpful at times, I often find myself frustrated. In real life…
Brandon Fosdick
  • 15,673
  • 4
  • 21
  • 20
15
votes
3 answers

What is inferred latch and how it is created when it is missing else statement in if condition. Can anybody explain briefly?

I tried to figure out the inferred latch and why it is needed internally, but I couldn't find any resources with enough detail.
user3429606
  • 187
  • 1
  • 1
  • 9
15
votes
4 answers

How to create a string from a pre-processor macro

I have a preprocessor macro that represents a hierarchical path into my design. Example: `define HPATH top.chip.block I need to construct a string which holds the value of `HPATH, so in my example the string should equal top.chip.block. Is there a…
dwikle
  • 6,820
  • 1
  • 28
  • 38
15
votes
5 answers

Assert statement in Verilog

I'm completely new to Verilog, so bear with me. I'm wondering if there is an assert statement in Verilog. In my testbench, I want to be able to assert that the outputs of modules are equal to certain values. For example, mymodule m(in,…
gsgx
  • 12,020
  • 25
  • 98
  • 149
15
votes
4 answers

How does Verilog behave with negative numbers?

For instance, say I have a reg [7:0] myReg I assign it the value -8'D69 I know Verilog stores it as 2's complement so it should be stored as 10111011 The question I have now is if I were to perform an operation on it, say myReg/2 Would it evaluate…
wonton
  • 7,568
  • 9
  • 56
  • 93
14
votes
3 answers

How to sign-extend a number in Verilog

I'm working on a simple sign-extender in Verilog for a processor I'm creating for Computer Architecture. Here's what I've got so far: [EDIT: Changed the selection statement slightly] `timescale 1ns / 1ps module SignExtender( CLK, extend, extended…
Alex Mullans
  • 1,699
  • 2
  • 17
  • 34
14
votes
3 answers

Conditional instantiation of verilog module

Is it possible to instantiate a module conditionally in verliog ? example : if (en==1) then module1 instantiation else module2 instantiation
vlsi2013
  • 169
  • 1
  • 2
  • 5
13
votes
2 answers

Modify verilog mode indentation

I am trying to have verilog mode indent everything using 2 spaces except decls and always. This is what I added to my .emacs: ;; `define are not indented …
igon
  • 3,016
  • 1
  • 22
  • 37
13
votes
3 answers

Using a generate with for loop in verilog

I'm trying to understand why we use generate in verilog along with a for loop. Using a generate and for loop together: reg [3:0] temp; genvar i; generate for (i = 0; i < 3 ; i = i + 1) begin: always @(posedge sysclk) begin temp[i] <=…
CDN
  • 157
  • 1
  • 2
  • 7
13
votes
2 answers

What SystemVerilog features should be avoided in synthesis?

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…
nguthrie
  • 2,615
  • 6
  • 26
  • 43
13
votes
4 answers

Verilog sequence of non blocking assignments

Say the following code section (same block): A <= 1 A <= 2 Will variable A always be assigned 2? or will there be a race condition and 1 or 2 will be assigned ? My understanding of non blocking assignment is that it is up to the hardware to assign…
nehz
  • 2,172
  • 2
  • 23
  • 36
12
votes
2 answers

Incrementing Multiple Genvars in Verilog Generate Statement

I'm trying to create a multi-stage comparator in verilog and I can't figure out how to increment multiple genvars in a single generate loop. I'm trying the following: genvar i,j; //Level 1 generate j=0; for (i=0;i<128;i=i+1) begin: level1Comp …
Adam
  • 463
  • 2
  • 6
  • 14
12
votes
5 answers

Does anybody have quantitative data on VHDL versus Verilog use?

VHDL and Verilog serve the same purpose, but most engineers favor one of both languages. I want to find out who favors which language. There are dozens of myths and common wisdoms about the separation between Verilog and VHDL. (ASIC / FPGA, Europe /…
Philippe
  • 3,700
  • 1
  • 21
  • 34