+ Post New Thread
Results 1 to 10 of 10

11th September 2019, 14:51 #1
 Join Date
 Aug 2019
 Posts
 11
 Helped
 0 / 0
 Points
 109
 Level
 1
Facing some error in Verilog HDL coding of Standard deviation calculation?
The standard deviation (SD, also represented by the lower case Greek letter sigma σ for the population standard deviation or the Latin letter s for the sample standard deviation) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values.
I have a code for calculating standard deviation, everything in the codes looks ok, but when I am running the code I am getting some errors, I am using vivado 2017.4 for verilog HDL coding. The screen shot of the error and code.rar is attatched. please help me to solve the problem.

11th September 2019, 16:27 #2
 Join Date
 Sep 2013
 Location
 USA
 Posts
 7,368
 Helped
 1728 / 1728
 Points
 31,824
 Level
 43
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Did you look at the xvlog.log file that the error suggests you look at?
It seems to indicate you've written your code incorrectly.
My guess would be you tried to write a software like implementation in Verilog.

Advertisement

11th September 2019, 16:50 #3
 Join Date
 Sep 2019
 Location
 Germany
 Posts
 7
 Helped
 0 / 0
 Points
 44
 Level
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Also, the zip file you've attached doesn't contain source files. They seem to be located outside the vivado project folder.

11th September 2019, 16:51 #4
 Join Date
 Aug 2019
 Posts
 11
 Helped
 0 / 0
 Points
 109
 Level
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Thank you adsee for the reply, I am getting some errors like
1) cannot set both range and type on function declaration
2) root scope declaration is not allowed in verilog 95/2K mode
I dont know how solve these kinds of errors.
copying the xvlog.log file for more information
INFO: [VRFC 102263] Analyzing Verilog file "C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/fifo.v" into library xil_defaultlib
INFO: [VRFC 10311] analyzing module fifo
INFO: [VRFC 102263] Analyzing Verilog file "C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/sqrt.v" into library xil_defaultlib
ERROR: [VRFC 101342] root scope declaration is not allowed in verilog 95/2K mode [C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/math.v:6]
ERROR: [VRFC 10465] cannot set both range and type on function declaration [C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/math.v:14]
ERROR: [VRFC 101342] root scope declaration is not allowed in verilog 95/2K mode [C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/math.v:14]
INFO: [VRFC 10311] analyzing module sqrt
ERROR: [VRFC 101775] range must be bounded by constant expressions [C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/sqrt.v:66]
ERROR: [VRFC 101040] module sqrt ignored due to previous errors [C:/Users/KKHP/Desktop/emd_model_journal_final/stan_devi/sqrt.v:10]

Advertisement

11th September 2019, 17:58 #5
 Join Date
 Sep 2013
 Location
 USA
 Posts
 7,368
 Helped
 1728 / 1728
 Points
 31,824
 Level
 43
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Yes, I saw those errors, but can't comment on them as post #3 noted the source is outside the project.
Look at your source and see why the things like the range are not constant.
Like I said you can't treat Verilog as if it is C even though the syntax looks similar. Verilog describes hardware and hardware can't change during run time, that would be like taking a circuit board and swapping parts in and out and rewiring it while it's running.
If you decide you can post the code for sqrt.v and math.v then you need to understand you can't later request it be deleted from the forum moderators won't accept requests to delete later, but don't expect any useful help without the code.

11th September 2019, 19:28 #6
 Join Date
 Aug 2019
 Posts
 11
 Helped
 0 / 0
 Points
 109
 Level
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
real_time_stdevmaster.zip
Please find the attachment, which includes all the codes.

12th September 2019, 03:14 #7
 Join Date
 Feb 2015
 Posts
 1,021
 Helped
 287 / 287
 Points
 6,244
 Level
 18
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
looks like you have clog/pow declared in a header which is included before the module. Verilog doesn't allow this and the functions are ignored. Using these incorrectly declared functions in a range also generates an error.
(SystemVerilog allows what you want. IIRC, Verilog has an interesting way of resolving functions and the error you hit is a byproduct)

12th September 2019, 12:39 #8
 Join Date
 Aug 2019
 Posts
 11
 Helped
 0 / 0
 Points
 109
 Level
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Thank you, everyone. Although, I have copied the data from the .v, verilog to .sv system verilog file and converted the design to system verilog based design. program run with XX as the output in the vivado simulator. means not getting the desired output.
** If I mix verilog and system verilog design sources will it work (extra question).

Advertisement

12th September 2019, 13:47 #9
 Join Date
 Jan 2008
 Location
 Germany
 Posts
 1,279
 Helped
 277 / 277
 Points
 8,564
 Level
 22
 Blog Entries
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
All Verilog constructs should work within a file marked .sv. But the opposite is not true.
FPGA enthusiast!

12th September 2019, 18:12 #10
 Join Date
 Aug 2019
 Posts
 11
 Helped
 0 / 0
 Points
 109
 Level
 1
Re: Facing some error in Verilog HDL coding of Standard deviation calculation?
Instead of `include "math.v" in the code, i just paste the contents of math.v in the bottom side of the verilog module. So, now in case verilog also it is not showing error, but,in the vivado simulator showing output as XX. In the variance.v module instead of
function reg [`MAXIMUM_FUNC_WIDTH1:0] pow(input integer base, input integer index);, i have written function [`MAXIMUM_FUNC_WIDTH1:0] pow(input integer base, input integer index);. means removed reg. because it was showing error like can not set both range and type on function. But at the end output is XX please help me to solve the problem.
+ Post New Thread
Please login