Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - HELP!a bug in testbench

 
Thread Tools Search this Thread
Old 06-03-2009, 09:49 PM   #1
Cool HELP!a bug in testbench


I'm writing a testbench.There are several bugs i dont understand.

The compiler shows as following:
No feasible entries for subprogram "conv_integer".
Bad expression in left operand of infix expression "-".
Bad right hand side (infix expression) in variable assignment.

And they all commence on the red line.Thanks!

-- Provide message block and check the result
sti_datain: PROCESS
VARIABLE tmp_din: STD_LOGIC_VECTOR(63 DOWNTO 0);
VARIABLE tmp_dout: STD_LOGIC_VECTOR(63 DOWNTO 0);
VARIABLE tmp_len: STD_LOGIC_VECTOR(63 DOWNTO 0);
VARIABLE len_cout: INTEGER;

FILE vector_file: text IS IN "Short.txt";
VARIABLE l: LINE; --define the line buffer
VARIABLE good, good_val: BOOLEAN; --status of read operation

BEGIN

-- skip four-line commencement
READLINE(vector_file, l);
READLINE(vector_file, l);
READLINE(vector_file, l);
READLINE(vector_file, l);

WHILE NOT ENDFILE(vector_file) Loop

WAIT UNTIL len_vld='1';
READLINE(vector_file, l);
HREAD(l,tmp_len,good);
ASSERT good
report"Bad message length value";
data_in<=tmp_len;
len_cout := conv_integer(tmp_len)/64-1;

--skip one line to read Msg
READLINE(vector_file, l);

L1:for i in 0 downto len_cout LOOP
READLINE(vector_file, l);
HREAD(l, tmp_din, good);
ASSERT good REPORT "Bad message message block value";
data_in<=tmp_din;
wait for MsgPeriod;
end loop L1;

--skip one line to read digest_out
READLINE(vector_file, l);

WAIT UNTIL digest_out_vld='1';

READLINE(vector_file, l);
HREAD(l, tmp_dout, good_val);
ASSERT good_val REPORT "Bad digest vector value 1";
ASSERT (tmp_dout=digest_out) REPORT "Output mismatch 1";
WAIT FOR DgtPeriod;
READLINE(vector_file, l);
HREAD(l, tmp_dout, good_val);
ASSERT good_val REPORT "Bad digest vector value 2";
ASSERT (tmp_dout=digest_out) REPORT "Output mismatch 2";
WAIT FOR DgtPeriod;
READLINE(vector_file, l);
HREAD(l, tmp_dout, good_val);
ASSERT good_val REPORT "Bad digest vector value 3";
ASSERT (tmp_dout=digest_out) REPORT "Output mismatch 3";
WAIT FOR DgtPeriod;
READLINE(vector_file, l);
HREAD(l, tmp_dout, good_val);
ASSERT good_val REPORT "Bad digest vector value 4";
ASSERT (tmp_dout=digest_out) REPORT "Output mismatch 4";

END Loop;

WAIT;

END PROCESS;


laSiA
laSiA is offline   Reply With Quote
Old 06-04-2009, 09:51 PM   #2
JohnDuq
Member
 
Join Date: Dec 2008
Posts: 83
Default
conv_Integer is defined in the Std_Logic_Arith library.

use ieee.std_logic_arith.all

Check out this link for some good tips:

http://www.synthworks.com/papers/vhd...mapld_2003.pdf


Once the compiler doesn't know what to do with that function it gets confused on the rest of the line too.


JohnDuq
JohnDuq is offline   Reply With Quote
Old 06-05-2009, 02:19 AM   #3
laSiA
Junior Member
 
Join Date: Jun 2009
Posts: 2
Default
I declare that library in the beginning.So,that's not the problem.Any other suggestion?


laSiA
laSiA is offline   Reply With Quote
Old 06-05-2009, 01:41 PM   #4
JohnDuq
Member
 
Join Date: Dec 2008
Posts: 83
Default
From http://www.cs.sfu.ca/~ggbaker/refere...v_integer.html

The conv_integer function
function conv_integer(arg: integer) return integer;
function conv_integer(arg: unsigned) return integer;
function conv_integer(arg: signed) return integer;
function conv_integer(arg: std_ulogic) return small_int;

These functions convert the arg argument to an integer. If the argument contains any undefined elements, a runtime warning is produced and 0 is returned.

The function provided by the std_logic_arith library can't convert a std_logic_vector to an integer because it is impossible to determine if it represents an unsigned or signed value. Functions that do this are included in the std_logic_unsigned and std_logic_signed libraries.


JohnDuq
JohnDuq is offline   Reply With Quote
Old 06-05-2009, 09:54 PM   #5
JohnDuq
Member
 
Join Date: Dec 2008
Posts: 83
Default
www dot cs dot sfu dot ca/~ggbaker/reference/std_logic/arith/conv_integer.html

The conv_integer function
function conv_integer(arg: integer) return integer;
function conv_integer(arg: unsigned) return integer;
function conv_integer(arg: signed) return integer;
function conv_integer(arg: std_ulogic) return small_int;

These functions convert the arg argument to an integer. If the argument contains any undefined elements, a runtime warning is produced and 0 is returned.

The function provided by the std_logic_arith library can't convert a std_logic_vector to an integer because it is impossible to determine if it represents an unsigned or signed value. Functions that do this are included in the std_logic_unsigned and std_logic_signed libraries.


JohnDuq
JohnDuq is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xilinx 7.1 and testbench error boitsas Software 0 01-15-2008 04:14 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46