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
6
votes
5 answers

Ones count system-verilog

I have a wire vector with 64 bits; wire [63:0] sout; I want to compute the sum of these bits or, equivalently, count the number of ones. What is the best way to do this? (it should be synthesizable)
Void Star
  • 2,401
  • 4
  • 32
  • 57
6
votes
1 answer

How to write a testbench to loop through 4 inputs?

I have to create the Verilog code and testbench for this schematic. I have the design for it here. module prob1(input wire a,b,c,d, output wire out); assign out = (a||d)&&(!d&&b&&c); endmodule Here is what I have for the testbench so…
user2680027
6
votes
1 answer

Defining interface inside a package

In IEEE Std 1800-2012 we can find description of packages and such information: Types, nets, variables, tasks, functions, sequences, properties, and checkers may be declared within a package I was wondering, if there is any particular reason why…
Qiu
  • 5,651
  • 10
  • 49
  • 56
6
votes
1 answer

Are SystemVerilog arrays passed by value or reference?

By default, does SystemVerilog pass arrays by value or reference? For example: int array[5] = '{0,1,2,3,4}; some_function(array); // <-- value or reference?
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
6
votes
2 answers

SystemVerilog foreach syntax for looping through lower dimension of multidimensional array

What is the standard way of looping through the lower dimension of a multidimensional array? With the higher dimension fixed. In the following example: automatic int i = 2; foreach (my_req[i][j]) begin // <-- WARNING $display("i:%0d,j:%0d",…
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
6
votes
1 answer

What should '{default:'1} do in system verilog?

I have an array that I would like to initialize to all 1. To do this, I used the following code snippet: logic [15:0] memory [8]; always_ff @(posedge clk or posedge reset) begin if(reset) begin memory <= '{default:'1}; end else…
nguthrie
  • 2,615
  • 6
  • 26
  • 43
6
votes
2 answers

Handing reset in SystemVerilog assertions

How are the following two properties different? property p1; @(posedge clk) disable iff (Reset) b ##1 c; endproperty property p2; @(posedge clk) (~Reset & b) ##1 c; endproperty assert property (p1); assert property (p2);
Ari
  • 7,251
  • 11
  • 40
  • 70
6
votes
1 answer

What is parasitic state machine in Johnson counter

module johnson #(parameter N=8) (output logic [N-1:0] q, input logic clk,reset); always_ff @(posedge clk,posedge reset) if(reset) q<=0; else q<={~q[0],q[N-1:1]}; endmodule Above is the systemverilog HDL for an 8-bit…
Vaibhav Sundriyal
  • 567
  • 5
  • 11
  • 18
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
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
2 answers

returning queue from function in systemverilog

I can't compile this code: function integer[$] get_register_name; integer ret[$]; ret.push_back(1); ret.push_back(2); return ret; endfunction Is it possible to return a…
e19293001
  • 2,783
  • 9
  • 42
  • 54
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
2 answers

Are there any good dependency management tools that aren't language specific?

I'm looking for dependency management tool that isn't specific to Java or any other language. We use SystemVerilog, a hardware description language, to create stand-alone modules. We tag releases of those modules at various milestones. Higher level…
Chris
  • 81
  • 2
5
votes
3 answers

systemverilog unpacked array concatenation

I'm trying to create an unpacked array like this: logic [3:0] AAA[0:9]; I'd like to initialize this array to the following values: AAA = '{1, 1, 1, 1, 2, 2, 2, 3, 3, 4}; For efficiency I'd like to use repetition constructs, but that's when things…
dsula
  • 185
  • 1
  • 2
  • 8