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.

3298 questions
1
vote
2 answers

Mixing nonblocking and blocking assignments in an always_ff block of an arbiter

I'm unable to wrap my head around Example 10-3 in SystemVerilog For Design book by Stuart Sutherland (and co.). See line 232 of : https://code.google.com/p/vak-opensource/source/browse/trunk/hardware/systemverilog/utopia-example/squat.sv?r=185 Here…
edc
  • 99
  • 1
  • 8
1
vote
1 answer

Systemverilog dynamic casting issues

I've a code snippet like following in my testbench function void write_to_port( my_data_type_base data ); my_data_type_extended data_ext; if(!$cast(data_ext, data)); `uvm_error(get_type_name(), "failed to cast"); …
newbie
  • 4,639
  • 10
  • 32
  • 45
1
vote
1 answer

Casting struct to logic

This is related to my previous question. Consider the following module declaration: module DFF(d, q, CLK, RESET); parameter W = 2; input [W-1:0] d; input CLK; input RESET; output…
Ari
  • 7,251
  • 11
  • 40
  • 70
1
vote
1 answer

Constraining an entire array in SystemVerilog based on another array

Is it possible to constraint an entire array in SystemVerilog to have the same value as another array? I tried this: class some_class; rand bit array1[10][10]; rand bit array2[10][10]; constraint arrays_c { array1 == array2; …
Tudor Timi
  • 7,453
  • 1
  • 24
  • 53
1
vote
2 answers

Passing string values to SystemVerilog parameter

I have a problem in passing a string value to a generic parameter in SystemVerilog. The modules are instantiated as shown below. The memory writes some values to FILE_OUT, which is a generic parameter. I need to produce two different files -…
dmm
  • 99
  • 1
  • 3
  • 8
1
vote
1 answer

Missing output on register file simulation

I'm trying to simulate a register file. My issues is that I am not getting an output for aData or bData. I suspect I have an issue with my assignments, but I'm not sure. My code for the module: `timescale 1ns / 1ps module registerfile( input [4:0]…
BlueSolrac
  • 2,191
  • 2
  • 12
  • 9
1
vote
2 answers

How to properly cast arrays in SystemVerilog?

The bit-stream casting in SystemVerilog for arrays and structs does not seem very safe. For example, the following casting issue will only be caught at runtime (which could be hours into the simulation): bit [31:0] bit_queue[$]; logic [31:0]…
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
1
vote
1 answer

How to use verilog $deposit with indexes

How can $deposit be used when the path includes the index from the generate loop. When I try: for(int idx=0; idx<`NUM_OF_ENGIES; idx++) $deposit(i_engines_array.engines_loop[i].engine_top.soft_reset_n, 1'b0); I get the…
Meir
  • 287
  • 1
  • 4
  • 15
1
vote
2 answers

Fold-Unfold block of code / comment section in Emacs for UVM / SystemVerilog

I currently use emacs for UVM testbench environment development. I use verilog-mode with solarized theme. I like my current setup, however I would like to improve the functionality of emacs. I would like to add fold-unfold functionality for block…
wisemonkey
  • 571
  • 3
  • 15
  • 29
1
vote
1 answer

SystemVerilog better way to copy a class

Which of the two copy functions are better? A. Using reference to a function parameter: function void copy(ref MyClass copyme); MyClass copyme = new this; endfunction B. Returning a newly instantiated copy: function MyClass copy(); return…
e19293001
  • 2,783
  • 9
  • 42
  • 54
1
vote
2 answers

Memory allocation in system verilog for dynamic array - new() / randomize() functions

I am having a class packet with a dynamic array. I would like to know if the new / randomize function of the class object can allocate memory for the dynamic array. class packet; rand int data[]; constraint c_data_size { data.size == 2; }; endclass…
Raghav
  • 766
  • 16
  • 24
1
vote
1 answer

How do I make use of multipliers to generate a simple adder?

I'm trying to synthesize an Altera circuit using as few logic elements as possible. Also, embedded multipliers do not count against logic elements, so I should be using them. So far the circuit looks correct in terms of functionality. However, the…
geft
  • 615
  • 1
  • 6
  • 18
1
vote
2 answers

using assign statement for `define statement

I am using assign statement of verilog for assigning `define as below in my driver module. `define SPI_MASTER_P_IF spi_vif.spi_master_p.spi_master_p_cb `define SPI_MASTER_N_IF spi_vif.spi_master_n.spi_master_n_cb `define SPI_MASTER_IF class…
user3383729
  • 27
  • 1
  • 5
1
vote
2 answers

SVA:Clock gating during SV assertion

I have an SV assertion which checks the property as below propert my_property; @(posedge clk) disable iff(reset) $rose(halt) ##0 ((rx_prio) > (expec_prio)) ##[0:$] $rose(rdy) |-> ##[1:100] (my_prio[rx_prio]==1'b1); endproperty:my_property I have…
Suhas
  • 319
  • 2
  • 5
  • 14
1
vote
5 answers

Binary to Gray Conversion

module binarytogray #( parameter PTR=2 )( input logic [PTR:0] binary_value, output logic [PTR:0] gray_value ); genvar i; generate for(i=0;i
Vaibhav Sundriyal
  • 567
  • 5
  • 11
  • 18
1 2 3
99
100