Questions tagged [system-verilog]
SystemVerilog is a unified hardware design, specification, and verification language based on extensions to Verilog.
3,372
questions
1
vote
1
answer
37
views
How to skip the first line of a CSV file while reading it in SystemVerilog?
I am trying to read a CSV file in SystemVerilog and parse them and assign the values to an associative array. I want to skip the first line of the CSV file while reading it. I am using the following ...
0
votes
0
answers
21
views
Verification of memory and CSR prior to RAL and UVM
My question is that a typical system Verilog testbench for a DUT does not support any RAL constructs since It arose later after the discovery of UVM and is compatible only with UVM , but the need to ...
0
votes
0
answers
15
views
How can I create an ignore_bins for a functional coverage cross to exclude any bins where a coverpoint falls within an external array list?
Say I have an unpacked array of an enumerated type:
client_e read_only_clients[] = {CLIENT1, CLIENT2};
And this covergroup:
covergroup cg with function sample ( client_e client, dir_e dir );
...
0
votes
1
answer
55
views
Parameterizing the Width of Array Elements in SystemVerilog
Is it possible to parameterize the width of array elements in SystemVerilog?
Currently, I am doing the following:
localparam N = 5;
localparam int widths[0:N - 1] = '{32, 16, 8, 4, 2};
localparam ...
0
votes
1
answer
23
views
SystemVerilog Arrays
is this array declaration valid bit[31:0] shadow_mem[bit[31:0]]; But what this means? We usally declare it as bit[31:0] shadow_mem[31:0]; are the two declarations different. what is the purpose of ...
0
votes
1
answer
35
views
Whether the execution order is guaranteed when the statements in fork join_any and the statements following them are executed at the same time
module test();
reg a,b,c,d;
initial begin
fork
#5 $display("Fork Time is %0t",$time);
#10 $display("Fork Time is %0t",$time);
#15 $display("Fork ...
1
vote
1
answer
47
views
4-bit counter on EPWave
I did a 4-bit counter module in Verilog, and I need to represent on EPWave the following steps:
the clock is toggled every 1 second
the counter works for 5 seconds, then the reset is on, then the ...
-1
votes
0
answers
39
views
Merging bins of different coverpoints [closed]
Suppose I have 2 coverpoints as follows:
cp1: coverpoint signal_a
{
bins a1 = {1};
bins a2 = {2};
}
cp2: coverpoint signal_b
{
bins b1 = {1};
bins b2 = {2};
}
I want to create a ...
1
vote
1
answer
66
views
How to output a 5 bit number from a ripple-carry adder/subtractor into a 5 bit decoder to account for overflow in Verilog?
I am working on a project that will take two 4-bit numbers between 0-9 and add/subtract them to be displayed in a seven segment display. Here is a big picture idea of what I am trying to create
My ...
0
votes
1
answer
74
views
SVA for verifying that two signals are equivalent after some delays
I have an SVA question :
Let's say we have signal wpo, and 19-21 clocks cycles later, we have wpo(the value at time 0) == out. How to write an SVA for that.
I tried this but it doesn't work
logic [103:...
-2
votes
0
answers
81
views
Verilog Peak detection, variable peak_det does not assert
What is the problem with this code for peak detection? I want to have a trigger for every peak. the input of this block is an enveloped form signal.
module Peak(
input clk,
input ...
-1
votes
0
answers
52
views
Variable '/tailLight_tb/i_intf/li', driven via a port connection, is multiply driven. See testbench.sv(33)
For the given design and its layered testbench in SystemVerilog, I am getting the following errors.
This is the entire program for reference.
https://edaplayground.com/x/uUhq
# ** Error (suppressible):...
0
votes
1
answer
41
views
cannot assign a packed type to an unpacked type
I have a mixed simulation with the Vivado 2022.1 simulator:
using a VHDL library I should not change (mytypes.vhd):
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package ...
0
votes
2
answers
58
views
In SystemVerilog - What's the difference between "tran" and "alias"? [closed]
I am trying to connect to bi-directional ports and I saw there are 2 solutions for this. tran primitive and alias statement. However, I don't understand the difference between them.
module tran_mod (i,...
1
vote
1
answer
46
views
Error: cannot be driven by primitives or continuous assignment
I am trying to create a state machine in Verilog, and I am getting these errors:
error: reg state; cannot be driven by primitives or continuous assignment.
error: Port 6 (state) of mealy_machine is ...
1
vote
1
answer
80
views
Dynamic delay in Verilog/SystemVerilog
I need to make a delay statement that the quantity of the delay varies with time, it could possibly increase or decrease. I need a statement to occur when the simulation time is equal to some variable ...
2
votes
2
answers
58
views
Check all bits set/unset
I'm new to Verilog, and I'm taking my first steps with FPGA "programming".
I have a parametrized module definition similar to that:
module foobar #(
parameter BITS = 4
) (...);
reg[...
0
votes
0
answers
57
views
Mirrored value doesn't match the desired value while running default sequence uvm_reg_hw_reset_seq in ral test
I am new to RAL and I am running the default uvm_reg_hw_reset_seq in my test. The test is failing for a register with non zero reset value. It is passing for others which have 0 as the reset value. I ...
1
vote
1
answer
49
views
Trouble instantiating and assigning in generate block
I am having trouble understanding how modules inside generate blocks are instantiated.
I am trying to implement a sequence detector that detects 1010. For this, I am trying to use 2 D flip flops. ...
-1
votes
0
answers
26
views
Can this matrix keypad Verilog code be rewriten so that it works with switches instead?
I'm trying to make sense of an Verilog FPGA project I'm interested in and want to understand. Except the inputs are taken from a matrix keypad, the code for which is below. Is there any way to rewrite ...
0
votes
1
answer
64
views
Passing a string array to a module
Can i use a string array here like this in a generate loop.
My string is this.
// Code your testbench here
// or browse Examples
module tb();
string inp_filename [4] = {"file1", "...
1
vote
1
answer
41
views
Explain why fork-join behaves differently when #10 begin A = 1'b0; B = 1'b1;end, and to #10; begin A = 1'b0; B = 1'b1; end [duplicate]
Please notice the semicolon after #10 delay in the second case.
I thought I understood fork-join, but after these outputs, I don't think I do. Can someone please explain why the semicolon is causing ...
0
votes
1
answer
91
views
Absolute value with axi interface
I have an interferometer wave and want to rectify it.
The code is not performing absolute value correctly.
What is the problem with this code?
`timescale 1ns / 1ps
module abs(
input clk,
output [...
-1
votes
0
answers
20
views
How do I get PyCDE to generate SystemVerilog which is compatible with Icarus Verilog?
I am interested in using PyCDE for generating some combinatorial logic to be synthesized in an FPGA. However, I am having trouble simulating the generated System Verilog output with Icarus. ...
0
votes
1
answer
56
views
How to interrupt an uncompleted delay in SystemVerilog
I want to apply a different rising and falling delay to a signal using the following code:
timeunit 1ns;
timeprecision 1ps;
parameter real delay_en_rising_us = 100.0; //...
1
vote
2
answers
42
views
Randomizing unequal times of each field of a class
Suppose I have 2 fields in a class, both rand or randc. But I want one field to randomize once and another field to randomize multiple times. Is it possible?
I have two fields: addr and data. I wanted ...
1
vote
1
answer
43
views
iverilog : Can't find task randomize in class Packet
I am new to System Verilog, and I was trying out some code where I am trying to randomize a 3-bit bus.
The code goes like this:
class Packet;
rand bit [2:0]data;
endclass
module top_tb;
initial
...
1
vote
2
answers
72
views
Index-based Array Right Shifter using concatenation; Error: range is not allowed in prefix
I am trying to implement an array Right Shifter.
It accepts an array of integers, then right shifts everything to the right-side of specified index position, and inserts a specified integer value at ...
0
votes
1
answer
56
views
Ignore some bins from the cross coverage in SystemVerilog
I have the following variables:
bit [3 : 0] pstrb;
write_t pwrite; // WRITE, READ, UNKNOWN
secure_t psecure; // SEC, NONSEC, UNKNOWN
I want to define the crosspoint and cross. I also want to add some ...
0
votes
1
answer
50
views
Suitable assertion in (System)Verilog default of case statement that should never occur [closed]
What kind of assertion is suitable for dealing with the default case of a SystemVerilog case statement?
Here are a few approaches that come to mind:
default:
$display("this should never occur&...
-2
votes
2
answers
42
views
How do I fix this foreach loop variable syntax error?
I am trying to use foreach in SystemVerilog. What I am doing wrong here?
`define size 3:0 //variable
module tb;
reg [7:0] temp;
initial begin
temp=8'd25;
$display("%d",temp[`...
1
vote
1
answer
43
views
Getting unexpected output for state machine code
module mealy(input x_in,rst_n,clk, output reg y_out);
parameter s0 = 2'b00, s1 = 2'b01 , s2 = 2'b10;
reg [1:0] p_state,n_state;
always@(posedge clk,negedge rst_n) begin
if(!rst_n) p_state <= ...
0
votes
1
answer
42
views
An abstract class cannot be instantiated in module
I am seeing following error while trying to instantiate a new() function.
Error-[SV-ACCNBI] An abstract class cannot be instantiated
model_dpi_module, "umc_uvc_ptr = new("umc_uvc_ptr", ...
1
vote
1
answer
38
views
4-bit register always shows output 0
module register(input [7:0] inp, input load,clk,clr, output reg [7:0] out);
always@(posedge clk or posedge clr) begin
if(clr)
out <= 8'b00000000;
else if(load)
out<= inp;...
0
votes
1
answer
77
views
$fscanf function not working properly with CSV string input
I am trying to use the $fscanf function to read a CSV file in SystemVerilog.
This is the format of the CSV file:
REG_1,0xab4556
REG_2,0x124d
and so on...
I have to scan these values and assign them ...
0
votes
1
answer
93
views
SystemVerilog Delay Interruption
I have a question, hopefully somebody can help me.
In systemVerilog I have an input "en" and an output signal "en_delayed". The signals are not necessarily ports, they can be ...
-1
votes
0
answers
30
views
Vivado failed to find vcs_mx simulator executable
I am trying to run simulations in vivado using the vcs simulator.
whilst trying to Compile simulation Libraries, I have been prompted that language specific compilation is not supported, so though my ...
0
votes
1
answer
120
views
SystemVerilog Module, why does reset not reset
I am coding a SystemVerilog module that stores data in 2 memories for Matrix Vector Multiplication. I am running a provided testbench from my prof but I have been stuch trying to debug a memory ...
0
votes
1
answer
61
views
Why does this simulate continuous assignment with delay of 2 as if had delay of 3
I have this system verilog code, that does continuous assignment for some simple operations with delays and a simple testbench with clocks.
`timescale 1ns/1ps
module delays(input logic a, b);
...
1
vote
1
answer
44
views
Generating random value for 255 wire bus
I wanted to verify connectivity (using SystemVerilog) of a 255-wire bus from source to destination. To this effect, I wanted to drive random values on the source bus and ensure the corresponding ...
0
votes
0
answers
60
views
Evaluation at posedge of SVA assertions
I am trying to write a really simple assertion in systemverilog like the following :
test_name : assert property(
@(bus_A)
disable iff (!resetn)
flag_bus_canChange
);
I want ...
-1
votes
0
answers
29
views
Can break be used in task? [duplicate]
New to Verilog and SystemVerilog. Working in ModelSim starter edition 2020.
I'm trying to make a task in testbench that is supposed to mimic APB master that reads from slave to test my apb2uart design....
1
vote
4
answers
60
views
How to declare a global variable-sized and variable-valued one-dimensional array of localparam in Verilog/SystemVerilog?
I want to declare an array of parameters called WEIGHT inside a module. However, the size of the array as well as its values depend on a parameter for the module called NFFT. Here is a code snippet of ...
0
votes
2
answers
67
views
Packed array element assignment when using default
My array is declared and initialized to zero like this:
logic [7:0] example1 [4] = '{default : 4'h0};
I want to assign a specific bit of packed array to 'x' for all of the array elements, so I am ...
0
votes
2
answers
249
views
How to write data into bram and read data from bram?
I am trying to understand how writing and reading take place in BRAM memory under certain controlling situations. Please tell me if there is any conceptual mistake in my code:
module bram_dual(...
1
vote
1
answer
59
views
Effect of double semicolon termination
We have a set of code where a line in SystemVerilog is terminated with a double semicolon vs. a single semicolon. There is some debate as to the effect of having an extra semicolon in the HDL.
What ...
-1
votes
0
answers
43
views
SV Assertion (SVA) using time unit delays for asynchronous signals? [duplicate]
I would like to write an assertion in SystemVerilog language, that would look this way:
A |-> ##(Access time in nanoseconds) $stable(B) until C
My signal B can toggle few times during the delay, ...
1
vote
1
answer
57
views
Is static variable initialization order specified in SystemVerilog for variables in different packages?
I'm trying to find out whether static variable initialization order is specified in SystemVerilog. Starting from 6.8 Variable declarations I didn't find anything:
Setting the initial value of a ...
-1
votes
1
answer
73
views
Unexpected Queue Randomization with UVM environment
This is my code -> eda playground
When the code below activate, class "trasn packet queue" in uvm_scoreboard is changed when "monitor" send value as anlaysis_port. i just give a ...
1
vote
1
answer
59
views
Foreach loop with string array
I want the code to be same as:
addr = `TX_B+'h00;
addr = `TX_B+'h04;
addr = `TX_B+'h08;
addr = `TX_B+'h0C;
addr = `TX_B+'h10;
by using foreach (or others that achieve same effect)
but it can't work. ...