UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant kp1998_
Participant
229 Views
Registered: ‎06-11-2019

how to provide 1000 samples as input to the testbench

Hello

I want to give 1000 input values in the test bench through a text file.

Is this possible and if i am using the inputs values through a text file in my code how to provide 10 ns delay for each samples and and how to use it in my code for performing various computations.

Please provide some example for this.

Thank you

0 Kudos
5 Replies
221 Views
Registered: ‎06-21-2017

Re: how to provide 1000 samples as input to the testbench

What HDL language are you using? 

0 Kudos
Participant kp1998_
Participant
217 Views
Registered: ‎06-11-2019

Re: how to provide 1000 samples as input to the testbench

Hello
I am using Verilog HDL language, i know that by using $readmemh function, hexadecimal values can be read from a text file, just wanted to know how to use the values that are read from the text file as input for the code
0 Kudos
Scholar markcurry
Scholar
173 Views
Registered: ‎09-16-2009

Re: how to provide 1000 samples as input to the testbench

I'd start with something like:

localparam WIDTH = 8;
localparam DEPTH = 1000;

reg [ WIDTH - 1 : 0 ] input_data [ DEPTH - 1 : 0 ];
initial $readmemh( "input_data.hex", input_data );

reg [ WIDTH - 1 : 0 ] current_data; reg [ $clog2( DEPTH ) - 1 : 0 ] rd_ptr = 0; always @( posedge clk ) // clk = 100 MHz begin current_data <= input_data[ rd_ptr ]; rd_ptr <= rd_ptr + 1'b1; end

Untested, but a start...

Regards,

Mark

 

0 Kudos
Participant kp1998_
Participant
156 Views
Registered: ‎06-11-2019

Re: how to provide 1000 samples as input to the testbench

Hello
Thank you for the help.
I tried this code in my testbench, error is that vivado doesnt support $readmem function.
I think it only supports $readmemh and $readmemb functions.
0 Kudos
Scholar markcurry
Scholar
139 Views
Registered: ‎09-16-2009

Re: how to provide 1000 samples as input to the testbench

The $readmem was just a typo - editted post to correct.

Regards,

Mark

0 Kudos