Questions tagged [verilog]
Verilog is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design, verification, and implementation of digital logic chips.
5,083
questions
0
votes
1answer
12 views
question mark ? in verilog support multi bit select signal?
y = sel ? x : y
I always assume that sel should be a one bit data, 1 or 0, true or false.
But my teammates insist that sel can be more than one bit. He used the original 4 bit signal as sel instead, ...
0
votes
0answers
20 views
LED not lighting up on my DE10Lite verilog FPGA design
I am trying to make use of the FP_FUNCTIONS Intel FPGA IP to multiply two inputs, and display the output on LEDs. However, my codes couldn't light the LED up.
module multiplier (A, B, Clock, Reset, ...
0
votes
1answer
36 views
How to automatically convert port signals of verilog sub modules using python?
Let's say there is a TOP module, one logic (logic1) and one test logic (logic2) like in the left picture.
I want to exclude test logic like in the right picture (all verilog form).
At first, If we ...
0
votes
1answer
24 views
Verilog array offset
module inst_mem(inst_out, pc_addr_out, clk, rstb);
output reg [31:0] inst_out;
input clk, rstb;
input [7:0] pc_addr_out;
reg [31:0] array[7:0];
//integer n = 0;
...
0
votes
0answers
16 views
data transmission through zynq and I2s transmitter core [closed]
My design will use an Zybo board FPGA with a SSM2603 Audio codec. Xilinx provide separate I2S transmitter and receiver cores, each of which generates an SCK bit clock signal.Can you help me for ...
0
votes
1answer
18 views
Casting wire vector to integer in verilog
In an example like this
function module(
input [3:0] in
output out);
for(integer i = in; i < in+10; i += 1) begin
// do stuff
end
endfunction
How would in be cast to i?
...
0
votes
0answers
28 views
Adding an input carry then generating a sum and a carry
For 4'b1011 I need to add an input carry and generate a sum and a carry. I keep getting an error message saying that a value cannot be assigned to input carry_in whenever I try to compile the code, so ...
1
vote
1answer
38 views
Error (10170): Verilog HDL syntax error at Test1.sv(29) near text: “program”; expecting a description
Trying to test a Verilog module via System Verilog. I'm analysing the RTL Simulation and I get the error:
Error (10170): Verilog HDL syntax error at Test1.sv(29) near text:
"program"; ...
0
votes
1answer
38 views
How can I do more accurate calculation ln(1+x) in verliog
I want to calculate ln(1+x)in verilog A.
I know that the code is
y = ln(1+x);
But if the x value becomes very small(ex x=3.52e-18), the y value becomes zero.
In MATLAB, I can calculate like
y=log1p(...
0
votes
0answers
27 views
hamming decode how can i write a verilog code that will take an input of 7 bit word and detect the error using even parity and correct it
module Hamming_Decoder_MD3(H_word , error , correct);
input [6:0]H_word; //receiver msg
output [2:0]error; // calculate the error in the msg if occur
output [6:0]correct; // the coorect msg
integer ...
-3
votes
1answer
27 views
What do these Verilog lines of codes do? [closed]
I am working on Verilog Project in which I came across the following code, I am confused on how this code is actually working. How is the 'case' statement actually functioning?
module mux2A(select,a,b,...
0
votes
1answer
29 views
32-bit adder subtractor model compile error: Illegal Lvalue
I am designing a 32 adder/subtractor using the following specification.
Inputs are connected to FFs with synchronous reset and an enable signal. The output from these registers are connected to the ...
0
votes
2answers
46 views
Operands in verilog
I am trying to implement a PID controller using Verilog, but I faced some problems in the coding.
I try to set the position as a parameter like shown in the screens shot:
but, I faced an error which ...
0
votes
0answers
29 views
Understanding System Verilog Diagram? [closed]
I saw the following System-Verilog code:
and the simulation result was:
Which I don't understand, when rst goes 1 at first, then always_ff is triggered which means the current_state will be first_st,...
-1
votes
0answers
28 views
Assigning specific bit in verilog [closed]
I am trying to assign the last 6 bit of "a" to "bit_stream" but it is giving me 1'hzz for all values when I compile them
code is
module IS (input clk, input [31:0] a, output reg[0:...
0
votes
0answers
40 views
always_ff in SystemVerilog, how does it work?
Given the following code:
1 always_ff @(posedge clk) begin
2 z1<=y1; y1<=x1;
3 z3=y3; y3=x3;
4 end
which claim is correct? (I wrote them to understand)
lines 1 & 2 are connected at ...
-1
votes
0answers
29 views
Desinging a content addressable memory (cam) in verilog
currently learning verilog and what I'm trying to do is designing a content addressable memory (cam) in the following ways:
Fully parallel
Bit serial - Word parallel
Bit parallel - Word serial
So ...
-1
votes
0answers
27 views
How can this 2^2 x 16 (8 byte) memory circuit be changed so that the size is 32 megabytes? [closed]
How can this be expanded to be 32 megabytes?
enter image description here
-2
votes
0answers
43 views
How can I expand this 2^3 x 8 bit RAM Verilog code to 32 MB? [closed]
'timescale lns/lps
module RAM(
input clk;
input [7:0] data_in;
input wr;
input rd;
input [2:0] add;
output [7:0] data_out
);
reg [7:0] ram [0:7]
always @(posedge clk)
begin
...
0
votes
2answers
59 views
For loop with binary numbers
I want to use a for loop in Verilog to get from binary 0000000 to 0011111. I have a problem with the increment part of the for loop. How should I exactly move to get to the 0011111?
I tried the ...
-1
votes
0answers
37 views
Craeting a JK Flip Flop in Verilog using if/else or case with reset=0
I want to create a JK flip flop with asynchronous reset = 0.
The first way is if-else
module JK_Behavior_a(output reg Q, input J,K,CLK, rst);
//Q(t+1)=JQ'+K'Q
//when Q=0, Q(t+1)=J
//When Q=1 Q(t+1)=K'
...
0
votes
1answer
23 views
Verilog compiler errors in Modelsim when simulating register file
I'm trying to write some verilog code to create a register file containing 32 32-bit registers.
Register File Input/Output
Here is my code below:
module regfile (clk, we, ra1, ra2, wa, wd, rd1, rd2);
...
-1
votes
1answer
40 views
How to fix the error “Cannot assign to non-variable…”?
I'm writing a verilog code for the convolution layer in a CNN, and i'm getting the following errors:
1)ERROR:HDLCompiler:257 - "D:\DSD_CEP_verilog\convolution_normal.v"
Line 52: Cannot ...
1
vote
1answer
34 views
How to disable indentation upon entering a semicolon, in Emacs under verilog mode?
Has anyone figured out which Emacs customization variable to twiddle, in order to prevent indentation occurring when you enter a semicolon while editing a (System)Verilog file in verilog mode?
Thanks,
...
-1
votes
0answers
37 views
Test bench for a array of input system verilog
Can someone please help me with the testbench for this code? This seems to work correct with a 10X10 matrix but as I increase the size of the matrix to 20X20 it seems to get stuck at 0fs. I would need ...
-1
votes
0answers
26 views
I cannot see some signals within a bus during simultaion - verilog
I designed a module named wishbone, responsible for some actions (it is a top module which is supposed to interconnect other modules to accomplish a certain function). Also, within the wishbone module,...
-6
votes
0answers
129 views
A Xilinx FPGA with device number XC5VLX110 has a main clock frequency of 50 MHz [closed]
A Xilinx FPGA with device number XC5VLX110 has a main clock frequency of 50 MHz. The clock is to be used to synchronize counting operations in a display system. Recommend your design idea, suitable ...
0
votes
1answer
51 views
Why are “if..else” statements not encouraged within systemverilog assertion property?
I am writing an assertion check for the following structure
Basically, I want to check that output is equal to d1 when select signal is 0 and output is equal to d2 when select signal is 1.
I did ...
1
vote
1answer
36 views
Assignment one item from two?
I've been studying Verilog for a while and recently came across a kind of statement that I do not understand. Here is an example:
reg s_axis_data_tready_reg = 1'b0, s_axis_data_tready_next;
Looks ...
-1
votes
0answers
54 views
$fgetc SystemVerilog function doesn't read from stdin
In the following testbench
module for_loop;
int c;
initial begin
$display("Write Here!");
c = $fgetc('h8000_0000);
$display(c);
end
endmodule
I get the output:
...
1
vote
2answers
48 views
I don't understand this define macro with replication
I have SystemVerilog code in which replication is used that I don't understand. Please be thorough with your answer.
parameter WIDTH = 6;
logic [WIDTH-1:0] flag, flag2;
`define ZERO_X(n, m) {{m-$bits(...
0
votes
1answer
62 views
VHDL equivalent of Verilog's Event Type and Event trigger ->event_a;
How can I write the following code in VHDL??
`timescale 1ns/10ps
module tb;
event event_a;
initial begin
#20 ->event_a;
#30 ->event_a;
#90 ->event_a;
#100;
$...
0
votes
1answer
41 views
How does adding 1'b1 to 8 bit reg work in Verilog?
I am absolute beginner in Verilog and I am wondering how does the addition statement work in this piece of program.
reg [7:0] hcount;
...
always @(posedge clk) begin
if(!n_rst) begin
...
0
votes
1answer
50 views
Why does my bidirectional port only give my output but 8'hxx for input?
I'm trying to use a inout port for the dataBus of RAM. I have designed the RAM with a distinct input port for dataBUs_in and output dataBus_out. Later linked them to a bidirection port in the top ...
0
votes
1answer
52 views
Synthesized for loop in always_ff block
I want to write the following code to be more readable and nicer looking.
always_ff @(posedge clk or negedge rst_n)
if(!rst_n)
line_pipe <= 0;
else
begin
...
1
vote
1answer
58 views
Binary to Grey Code and Grey to Binary using mode switch
I am implementing Code converter with a mode switch such that mode 0 implies binary to grey code and mode 1 implies grey to binary conversion.
My design and testbench is as shown below.
Design
...
0
votes
1answer
38 views
verilog module renaming using precompiler
I want to name a module using a `define directive
It seems to work if I use a macro like :
`define module_rename(NAME,TAG) ``NAME``TAG
module `module_rename(foo,_A) (...);
but it fails (in quartus) ...
1
vote
1answer
33 views
EDA Playground EPWave $dumpfile
I am trying to simulate my design in EDA Playground. I tested my design file and testbench file in my local computer using ModelSim (not from EDA) and it was successful. However, I tried to do the ...
0
votes
1answer
35 views
Using `define inside Case statement not working
I am trying to use a `define inside a Verilog case statement for my design, but the edaplayground compiler throws the following error for all the lines wherever the `define is used:
ERROR VCP2000 &...
1
vote
1answer
45 views
How to write consecutive case statements?
I got an assignment to make a 4-bit booth multiplier with unsigned inputs in Verilog.
I've only used verilog a few times before this, so I'm not too familiar in writing case statements in it.
module ...
-1
votes
0answers
58 views
How to design a 32 bit carry look-ahead adder using behavioral Verilog coding
I'm having some complications on designing a 32 bit carry look-ahead adder using behavioral Verilog coding.
I could write code in data flow way for a 4 bit look-ahead adder and here is my code :
...
-1
votes
1answer
51 views
ERROR :near “initial”: syntax error, unexpected initial [closed]
This is my code, and I get this compile error:
ERROR :near "initial": syntax error, unexpected initial
How do I fix this error?
module pract_wildcardequality();
logic [3:0] a,b;
function ...
0
votes
1answer
92 views
Verilog parameters with parametric width
It isn't hard to agree that parametrized module design is a good practice and data width is a good starting point.
I have been defining constants 0 and 1 of required bus or operand widths for years. ...
0
votes
1answer
32 views
System Verilog number multiplication?
How can I multiply by -1 in system Verilog? Inside an ALU?
I tried:
logic [DPWIDTH-1:0] alu_result;
always_comb
case (alusel)
ALU_REV: alu_result = alu_a * (-1);
endcase
But for ...
0
votes
1answer
32 views
How to count in system verilog?
In System Verilog I have multiple States in which some states are being used twice, how could I know if it's my first time passing by this state or that it's second time?
For example if it's my second ...
-1
votes
0answers
41 views
APB design and testbench port declaration issue using verilog and xilinx vivado
I am trying to design a APB write cycle using Verilog and Xilinx vivado. I am new to verilog, so there are 100 percent possibility that my logic must be wrong. i am getting an error in testbench file ...
0
votes
1answer
45 views
4-bit register using D flip-flop with enable and asynchronous reset
I am modelling a 4-bit register using D flip-flops with enable and asynchronous reset. It contains 4 D FF and 4 2:1 Mux. I used structural Verilog to model the circuit.
My design is shown below.
...
0
votes
1answer
42 views
Get the size of an interface in systemverilog
I have an interface with 2 modports, and the interface consists of multiple wires, hence when used as modport of a module it translates to multiple inputs and multiple outputs.
Is there a way to get ...
2
votes
1answer
75 views
4 bit register with enable and asynchronous reset
I am modelling a 4 bit register with enable and asynchronous reset . The register has three one bit input namely clk, reset and enable, one four bit input, D and one four bit output Q using verilog.
...
0
votes
2answers
51 views
Warning: Inferring latch for variable 'w_addra_t' (in Verilog/SystemVerilog with FOR loop)
I have an inferred latch problem after synthesis when I designed a simple dual port RAM block. Due to large code size, I have just embedded this always block code as follows:
integer i;
always_latch
...