test bench


Test bench

Postby Vitaliy » Wed, 23 Nov 2005 05:54:12 GMT

I'm trying to simulate this in Cadence:

I don't have any problems with that,I can compile the files using
"ncvhdl -v93". I can also import the files in Synopsis and get gate
level as expected.

However, when I try to compile
I get this error.
ncvhdl: 05.10-p004: (c) 1995-2003 Cadence Design Systems, Inc.
ncvhdl_p: *internal* (expecting FUNCTION of PROCEDURE).
Please contact Cadence Design Systems about this problem and provide
enough information to help us reproduce is it.

I'm really stuck on this. Any help would be much appreciated.

Re: Test bench

Postby wpiman@aol.com » Wed, 23 Nov 2005 07:04:14 GMT

For one thing....

  procedure my_printout(a   : std_logic_vector(31 downto 0);
                        b   : std_logic_vector(31 downto 0);
                        prod: std_logic_vector(63 downto 0)) is

You need to declare the direction of these signals in a procedure. ie.

procedure my_printout(a   : IN std_logic_vector(31 downto 0);

I am not sure if that is the whole issue or not- but that is what jumps

Re: Test bench

Postby Vitaliy » Wed, 23 Nov 2005 12:33:38 GMT

Thanks. I'll try that tomorrow and post the result if that was enough
to solve the problem.

Re: Test bench

Postby Vitaliy » Thu, 24 Nov 2005 09:45:59 GMT

Unfortunately, that did not help.

Re: Test bench

Postby Mike Treseler » Thu, 24 Nov 2005 10:07:13 GMT

Both compile fine when I do this.

--   a1: entity WORK.add32 port map(sum_in, bb, cin, psum, cout);
--   a2: entity WORK.fadd port map(sum_in(31), topbit, cout,topout,nc1);

      -- Mike Treseler

Re: Test bench

Postby Vitaliy » Thu, 24 Nov 2005 12:21:39 GMT

But would it make sense to modify source file to get the test bench to
work? Because source file seems to be fine, at least based on what I
see in Synopsis, and if those two lines are commented out, wouldn't
that change the functionality (btw, did you create WORK subdirectory?
depending on whether you use Linux or Windows(does Cadence even run on
Windows? not sure), you might need it). And did you have those two
files (fadd.vhdl and add32.vhdl) in the same directory as bmul32.vhdl?
Because that could be a reason bmul32.vhdl did not compile.
Thanks for the help, I will try that tomorrow,

Re: Test bench

Postby Mike Treseler » Thu, 24 Nov 2005 16:21:12 GMT

Step one is to find the error.

Did you?
Those were not mentioned in your posting.

      -- Mike Treseler

Re: Test bench

Postby Vitaliy » Fri, 25 Nov 2005 01:58:59 GMT

Yes, I did.

Sorry, missed it in the first post.

Here is the code for fadd.vhdl
library IEEE;
use IEEE.std_logic_1164.all;

entity fadd is               -- full adder stage, interface
  port(a    : in  std_logic;
       b    : in  std_logic;
       cin  : in  std_logic;
       s    : out std_logic;
       cout : out std_logic);
end entity fadd;

architecture circuits of fadd is  -- full adder stage, body
begin  -- circuits of fadd
  s <= a xor b xor cin after 1 ns;
  cout <= (a and b) or (a and cin) or (b and cin) after 1 ns;
end architecture circuits; -- of fadd

here is the code for add32.vhdl

library IEEE;
use IEEE.std_logic_1164.all;
entity add32 is             -- simple 32 bit ripple carry adder
  port(a    : in  std_logic_vector(31 downto 0);
       b    : in  std_logic_vector(31 downto 0);
       cin  : in  std_logic;
       sum  : out std_logic_vector(31 downto 0);
       cout : out std_logic);
end entity add32;

architecture circuits of add32 is
  signal c : std_logic_vector(0 to 30); -- internal carry signals
begin  -- circuits of add32
  a0: entity WORK.fadd port map(a(0), b(0), cin, sum(0), c(0));
  stage: for I in 1 to 30 generate
             as: entity WORK.fadd port map(a(I), b(I), c(I-1) , sum(I),
         end generate stage;
  a31: entity WORK.fadd port map(a(31), b(31), c(30) , sum(31), cout);
end architecture circuits;  -- of add32

Re: Test bench

Postby Mike Treseler » Fri, 25 Nov 2005 04:25:57 GMT

That significantly improves the performance.

       -- Mike Treseler
69 steptoe Wed Nov 23 /evtfs/home/tres/vhdl/play > vsim -c bmul32_test
Reading /steptoe/usr1/modeltech/tcl/vsim/pref.tcl
# Loading /steptoe/usr1/modeltech/linux/../std.standard
# Loading /steptoe/usr1/modeltech/linux/../std.textio(body)
# Loading /steptoe/usr1/modeltech/linux/../ieee.std_logic_1164(body)
# Loading /steptoe/usr1/modeltech/linux/../ieee.std_logic_textio(body)
# Loading /steptoe/usr1/modeltech/linux/../ieee.std_logic_arith(body)
# Loading work.bmul32_test(circuits)
# Loading work.bmul32(circuits)
# Loading work.badd32(circuits)
# Loading work.add32(circuits)
# Loading work.fadd(circuits)
VSIM 1> run 1 us
# Driver starting.
# a=11111111, b=11111111,  prod=0123456787654321, cntr=0001,  at=319 ns
# a=22222222, b=22222222,  prod=048D159E0C83FB73, cntr=0010,  at=639 ns
# a=44444444, b=44444444,  prod=1234567876543210, cntr=0100,  at=959 ns

Re: Test bench

Postby Vitaliy » Wed, 30 Nov 2005 14:03:35 GMT

I have a feeling that my school doesn't have all the proper
libraries/licenses then.
Thank You, Mike.

Re: Test bench

Postby Jim Lewis » Thu, 01 Dec 2005 02:01:57 GMT

Your syntax looks fine.  Perhaps you found a tool bug.
None the less you still have to get your work done, so
here are some suggestions.

First if you are using vhdl-93 on the design, use vhdl-93
compile switches for the testbench also.

Next I would check the line number on which the error is being
reported.  I am guessing that it is:
 >  end my_printout;

The syntax for this is:
vhdl-87:  end [designator] ;
vhdl-93:  end [subprogram_kind] [designator] ;

Given the error message you presented, it seems that
when the compiler is seeing the subprogram designator
(my_printout) it is also expecting it to be preceded
with the subprogram_kind (procedure).

If you are compiling everything with vhdl-93, then try
the following:
end procedure my_printout ;

If the above does not work, or you want to be compatible
with vhdl-87, or you hate typing, you might want to try:
end ;


Jim Lewis
Director of Training             mailto: XXXX@XXXXX.COM 
SynthWorks Design Inc.            http://www.**--****.com/ 

Expert VHDL Training for Hardware Design and Verification

Re: Test bench

Postby Jim Lewis » Thu, 01 Dec 2005 02:08:47 GMT

You also might ask your prof or system admins where the
current version of the tools are.  It seems odd that the
latest date in the copyright date is 2003 when tools are
typically updated several times a year.


Jim Lewis
Director of Training             mailto: XXXX@XXXXX.COM 
SynthWorks Design Inc.            http://www.**--****.com/ 

Expert VHDL Training for Hardware Design and Verification

test bench

Postby whereismelvin » Fri, 21 Nov 2008 17:20:47 GMT

I wrote a testbench in which i declared a variable ic as bit_vector (3
to 0). now when i tried putting
ic:=ic + 1 inside a loop it shows  operator argument type mismatch.
I treid declaring it as signed and unsigned.

Re: test bench

Postby Tricky » Fri, 21 Nov 2008 18:12:32 GMT

Im guessing you are using the following:

use ieee.std_logic_arith.all;
use iee.std_logic_unsigned.all;
use iee.std_logic_signed.all;

replace all of these with ieee.numeric_std.all;

then, done declare ic as a bit_vector, declare it as unsigned/signed
and it should work.


  variable ic   : unsigned(3 downto 0) := "0000";  --or put the
initial state in the reset path
  ic := ic + 1;
end process;

this will work fine.

Test bench

Postby john » Wed, 25 Feb 2009 04:49:09 GMT


I am using ISE10.1 and simulating the code using its own behavioral
simulator. It generated the VDHL test code for me which I modified and
developed later. The Spartan is reading an 8 bit parallel data bus and
write it to a RAM.  I assigned the 8 bit parallel data bus with some
numbers in the VHDL test bench and can see them in the simulator.

Now, What I want to know is

1.	How can I make the VHDL test bench file to read my made text file
and write the output results in the some text file too. Using ISE and
Modelsim? How can I define the location where I want o store the file?

Similar Threads:

1.Cool test bench generator for testing some devices which describe by Verilog or VHDL

2.Writing synthesizable Test bench code for Board testing

Hi all,

I am stuck with a problem, I have been working on SATA HOST core
development, now i want to develope a test file that i could download
to a board and test the core, this requires my test file to be
synthesized and i am not getting any idea on this...

Basically I will need to generate some mechanism that will help me to
send the FIS(Frame Information Structure), from the DUT. During
functinal testing, i have been doing this with the help of tb_top file,
where i have a CNTRL signal that helps me do this, but now i am not
getting how to do this on Board level.

If any one is got an idea, it would be of great help

3.A simple system C test-bench for an AIS detect DUT

I would like to share a recent work, which I did in systemC.
Comments are very wellcome as this is one of my first systemc
verification project.

4.about use of different test benches..!!

How do one see merger of these language test benches...!!

> SC with SV or E
> E with SV
> C with SV

I don't have much experience so would like to experiences of other

I would like to know:

> What are things need to be taken care while writing test benches when we merge codes.
> What are the things need to be avoided.

5.abt test bench

confusion in test bench , plz give some good example for test becnch

6. using VHDL configurations in a verilog test bench

7. Are all the new features in System Verilog for no synthesis , test bench purpose

8. Help with test Bench

Return to vhdl


Who is online

Users browsing this forum: No registered users and 84 guest