Questions tagged [system-verilog]

SystemVerilog is a unified hardware design, specification, and verification language based on extensions to Verilog.

SystemVerilog is a unified hardware description language () and verification language. Its two primary uses are to describe logical circuits targeted towards field-programmable gate arrays (FPGAs - ), programmable logic devices (PLD) and application-specific integrated circuits (ASICs - ) and to develop tests and environments to validate these circuit descriptions.

It is defined by IEEE 1800-2017 and with the exception of keywords, is a backwards-compatible superset of , IEEE 1364-2005.

2591 questions
29
votes
6 answers

packed vs unpacked vectors in system verilog

Looking at some code I'm maintaining in System Verilog I see some signals that are defined like this: node [range_hi:range_lo]x; and others that are defined like this: node y[range_hi:range_lo]; I understand that x is defined as packed, while y is…
Nathan Fellman
  • 108,984
  • 95
  • 246
  • 308
29
votes
1 answer

Difference among always_ff, always_comb, always_latch and always

I am totally confused among these 4 terms: always_ff, always_comb, always_latch and always. How and for what purpose can these be used?
user2138826
  • 301
  • 1
  • 3
  • 4
27
votes
6 answers

How to interpret blocking vs non blocking assignments in Verilog?

I am a little confused about how blocking and non blocking assignments are interpreted when it comes to drawing a hardware diagram. Do we have to infer that a non blocking assignment gives us a register? Then according to this statement c <= a+b , c…
infinitloop
  • 2,583
  • 6
  • 34
  • 50
27
votes
2 answers

Indexing vectors and arrays with +:

I am seeing a code in SystemVerilog which has something like this: if(address[2*pointer+:2]) do_something; How should I understand the +: when indexing this vector? I found that it is called bit slicing, but I can't find an explanation about it.
DOS
  • 411
  • 2
  • 5
  • 9
26
votes
8 answers

VHDL/Verilog related programming forums?

Hardware design with VHDL or Verilog is more like programming nowadays. However, I see SO members are not so actively talking about VHDL/Verilog programming. Is there any forum dealing with hardware design with Verilog/VHDL/SystemVerilog or SystemC?
prosseek
  • 155,475
  • 189
  • 518
  • 818
24
votes
2 answers

ADDRESS WIDTH from RAM DEPTH

I am implementing a configurable DPRAM where RAM DEPTH is the parameter. How to determine ADDRESS WIDTH from RAM DEPTH? I know the relation RAM DEPTH = 2 ^ (ADDRESS WIDTH) i.e ADDRESS WIDTH = log (base 2) RAM DEPTH. How to implement the log (base 2)…
Ashwini
  • 255
  • 1
  • 3
  • 7
20
votes
2 answers

What is `+:` and `-:`?

What are the +: and -: Verilog/SystemVerilog operators? When and how do you use them? For example: logic [15:0] down_vect; logic [0:15] up_vect; down_vect[lsb_base_expr +: width_expr] up_vect [msb_base_expr +: width_expr] down_vect[msb_base_expr…
e19293001
  • 2,313
  • 7
  • 36
  • 52
20
votes
5 answers

Difference of SystemVerilog data types (reg, logic, bit)

There are different data types in systemverilog that can be used like the following: reg [31:0] data; logic [31:0] data; bit [31:0] data; How does the three of them differ?
e19293001
  • 2,313
  • 7
  • 36
  • 52
16
votes
3 answers

Verilog: How to instantiate a module

If I have a Verilog module 'top' and a verilog module 'subcomponent' how do I instantiate subcomponent in top? top: module top( input clk, input rst_n, input enable, input [9:0] data_rx_1, input [9:0]…
Morgan
  • 18,407
  • 6
  • 54
  • 78
15
votes
2 answers

$size, $bits, verilog

What is the difference between $size and $bits operator in verilog.? if I've variables, [9:0]a,[6:0]b,[31:0]c. c <= [($size(a)+$size(b)-1]-:$bits(b)]; What will be the output at 'c' from the above expression?
Suhas
  • 199
  • 2
  • 3
  • 14
14
votes
2 answers

How to define and initialize a vector containing only ones in Verilog?

If I want to declare a 128 bit vector of all ones, which one of these methods is always correct? wire [127:0] mywire; assign mywire = 128'b1; assign mywire = {128{1'b1}}; assign mywire = 128'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
Veridian
  • 3,278
  • 10
  • 38
  • 73
14
votes
3 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,290
  • 1
  • 21
  • 34
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,388
  • 3
  • 23
  • 42
12
votes
2 answers

What's the best way to tell if a bus contains a single x in verilog?

I have a test bench that monitors a bus. Some of signals within the bus can be 1'bx. For a variety of reasons I need to know if any of the signals within the bus are 1'bx. What's the best way to test (not for synthesis -- only for simulation…
Doov
  • 733
  • 2
  • 7
  • 24
11
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
  • 453
  • 1
  • 5
  • 14
1
2 3
99 100