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

Reply

VHDL - Procedures in testbench confusion

 
Thread Tools Search this Thread
Old 08-25-2004, 08:34 AM   #1
Default Procedures in testbench confusion


Hi,

I am rather confused about the use of procedures in testbenches. My
intention is to model an I2C-bus with pullup resistors. My testbench
consists of a testprocess with a couple of procedures;reset, do
something, check that, do something else, check that etc.
If I set the I2C SCL and SDA line to 'H' in the reset-procedure and
then to '0' in another later procedure, everything is fine. But if set
them to 'H' outside the test-process, in the parallell part of the
code, both are 'U' from the very beginning of the simulation.
Both SCL and SDA are declared std_logic so why isnt the conflict
between 'H' and '0' resolved? And why are they 'U' from the beginning,
not just from the point in time were they are set to '0'?

I am sure that there is a very basic answer to this question and I
would be grateful if someone could provide it.

Regards, Peter


Peter Hermansson
  Reply With Quote
Old 08-25-2004, 09:32 AM   #2
Jonathan Bromley
 
Posts: n/a
Default Re: Procedures in testbench confusion
On 25 Aug 2004 00:34:59 -0700, (Peter
Hermansson) wrote:

>Hi,
>
>I am rather confused about the use of procedures in testbenches. My
>intention is to model an I2C-bus with pullup resistors. My testbench
>consists of a testprocess with a couple of procedures;reset, do
>something, check that, do something else, check that etc.
>If I set the I2C SCL and SDA line to 'H' in the reset-procedure and
>then to '0' in another later procedure, everything is fine. But if set
>them to 'H' outside the test-process, in the parallell part of the
>code, both are 'U' from the very beginning of the simulation.
>Both SCL and SDA are declared std_logic so why isnt the conflict
>between 'H' and '0' resolved? And why are they 'U' from the beginning,
>not just from the point in time were they are set to '0'?


Every process in VHDL represents a driver on each signal assigned
within that process. Continuous assignments, like your external
pullup assignments, are processes too. So, at time 0 you have
your pullup process assigning 'H', and your test process assigning
the initial value of the signal, which is 'U'. Since 'U' is the
strongest of all std_logic values, you see 'U' until the test
process assigns a different value.

Since it's a test bench, one possible solution is to give the I2C
signals initial values:

signal SCL, SDA: std_logic := 'H'; -- or 'Z' if you have a pullup

This means that the initial value of SCL and SDA *in every process
that drives them* is 'H'.

I don't really see why the external pullup process is useful. Your
test process must drive the signal to '0' when it wants zero, and
then to either 'H' or 'Z' when it wants the pullup to drive 1.
Consequently, you save yourself nothing by adding the external
pullup process.

HTH
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


Jonathan Bromley
  Reply With Quote
Old 08-25-2004, 03:15 PM   #3
Peter Hermansson
 
Posts: n/a
Default Re: Procedures in testbench confusion
Jonathan Bromley <> wrote in message news:<>. ..
>
> I don't really see why the external pullup process is useful. Your
> test process must drive the signal to '0' when it wants zero, and
> then to either 'H' or 'Z' when it wants the pullup to drive 1.
> Consequently, you save yourself nothing by adding the external
> pullup process.
>
> HTH
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services
>
> Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
> Tel: +44 (0)1425 471223 mail:
> Fax: +44 (0)1425 471573 Web: http://www.doulos.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.



Thanks!

/Peter


Peter Hermansson
  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
confusion with credit towards the Mobile certification. giddy MCTS 0 07-23-2008 05:29 AM
Xilinx 7.1 and testbench error boitsas Software 0 01-15-2008 04:14 PM
6.1 Confusion Emir DVD Video 2 11-16-2005 08:02 PM
DVDs with THX calibration procedures? Nic DVD Video 11 05-27-2004 12:54 PM
Lockup/Reboot confusion Bloke_in_a_box A+ Certification 2 05-12-2004 06:56 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