Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Signal Initialization Confusion

Reply
Thread Tools

Signal Initialization Confusion

 
 
Analog_Guy
Guest
Posts: n/a
 
      08-11-2006
I have a really simple setup to test the initialization of signals, and
am a little confused as to the simulator results.

When the compiled design is loaded into the simulator (ModelSim), sig2
is initialized at 'U' and sig3 is initialized at '1'.

sig2 is initialized in the signal declaration part of the top-level
file, whereas sig3 is initialized in the entity port. Why is there a
difference in the simulator? Here is the code:

CLIENT:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE ieee.std_logic_unsigned.ALL;

ENTITY client IS
PORT(
sig2 : OUT std_logic;
sig3 : OUT std_logic := '1'
);
END client ;
--
ARCHITECTURE struct OF client IS
BEGIN
END struct;




SERVER:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE ieee.std_logic_unsigned.ALL;

ENTITY server IS
PORT(
sig2 : IN std_logic;
sig3 : IN std_logic
);
END server ;
--
ARCHITECTURE struct OF server IS
BEGIN
END struct;





TOP-LEVEL:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE ieee.std_logic_unsigned.ALL;

ENTITY test_top IS
END test_top ;

LIBRARY test;

ARCHITECTURE struct OF test_top IS
-- Internal signal declarations
SIGNAL sig2 : std_logic := '1';
SIGNAL sig3 : std_logic;

-- Component Declarations
COMPONENT client
PORT (
sig2 : OUT std_logic ;
sig3 : OUT std_logic := '1'
);
END COMPONENT;
COMPONENT server
PORT (
sig2 : IN std_logic ;
sig3 : IN std_logic
);
END COMPONENT;

BEGIN
-- Instance port mappings.
I0 : client
PORT MAP (
sig2 => sig2,
sig3 => sig3
);
I1 : server
PORT MAP (
sig2 => sig2,
sig3 => sig3
);

END struct;

 
Reply With Quote
 
 
 
 
Ajeetha
Guest
Posts: n/a
 
      08-12-2006
Your sig2 is an output from client model and hence that will win over
the local signal initialization done at top_level. Since sig2 is not
being driven by your client model, it stays at U.


Sig3 is initialized by the client model's output itself.

Does that explain?

Regards
Ajeetha, CVC
www.noveldv.com
* A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
h**p://www.systemverilog.us/
* SystemVerilog Assertions Handbook
* Using PSL/Sugar


Analog_Guy wrote:
> I have a really simple setup to test the initialization of signals, and
> am a little confused as to the simulator results.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array/Struct Initialization Confusion quadraticformula C++ 2 06-16-2008 05:01 AM
array initialization in initialization list. toton C++ 5 09-28-2006 05:13 PM
Initialization of non-integral type in initialization list anongroupaccount@googlemail.com C++ 6 12-11-2005 09:51 PM
Initialization via ctor vs. initialization via assignment Matthias Kaeppler C++ 2 07-18-2005 04:25 PM
Default Initialization Vs. Value Initialization JKop C++ 10 09-22-2004 07:26 PM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57