home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / vhdl / 623 < prev    next >
Encoding:
Text File  |  1993-01-04  |  5.5 KB  |  196 lines

  1. Newsgroups: comp.lang.vhdl
  2. Path: sparky!uunet!noc.near.net!viewlog.viewlogic.com!sunder
  3. From: sunder@viewlogic.com (Sunder Singhani)
  4. Subject: Re: type conversion and configuration
  5. Message-ID: <1993Jan4.225957.26359@viewlogic.com>
  6. Sender: news@viewlogic.com
  7. Nntp-Posting-Host: saab
  8. Organization: Viewlogic Systems, Inc., Marlboro, MA
  9. References: <1992Dec30.130712.5464@phcomgw.seri.philips.nl>
  10. Date: Mon, 4 Jan 1993 22:59:57 GMT
  11. Lines: 183
  12.  
  13. > I compiled them on VANTAGE spreadsheet and Model Technology V-System
  14. > and got different results.
  15. > -EXAMPLE 1
  16. > **********
  17. > LIBRARY ieee;
  18. > USE ieee.std_logic_1164.ALL;
  19. > PACKAGE bizarre IS
  20. > CONSTANT X : std_ulogic:= std_ulogic'(to_x01(bit_vector'("00"))(1));
  21. > CONSTANT Y : std_ulogic:= to_x01(bit_vector'("00"))(1);
  22. > END bizarre;
  23. > One of the tools gives the report below while the other compiles it OK.
  24. > Error: LINE 6 * More than one interpretation found for this indexed expression
  25. > Error: LINE 8 * More than one interpretation found for this indexed expression
  26. > My opinion is that there is no ambiguity.
  27. > At worse the indexing operation needs to explicitly know the type and then only
  28. > line 6 is OK.
  29.  
  30. The above IS ambiguous. Explanation follows -
  31. Here are the few lines included from ieee.std_logic_1164 VHDL file
  32. to help explain the problem.
  33.  
  34. -- 1    FUNCTION To_X01  ( s : std_logic_vector  ) RETURN  std_logic_vector;
  35. -- 2    FUNCTION To_X01  ( s : std_ulogic_vector ) RETURN  std_ulogic_vector;
  36. -- 3    FUNCTION To_X01  ( s : std_ulogic        ) RETURN  X01;
  37. -- 4    FUNCTION To_X01  ( b : BIT_VECTOR        ) RETURN  std_logic_vector;
  38. -- 5    FUNCTION To_X01  ( b : BIT_VECTOR        ) RETURN  std_ulogic_vector;
  39. -- 6    FUNCTION To_X01  ( b : BIT               ) RETURN  X01;
  40.  
  41. Of these you are choosing 4, 5 explicitly by using type qualification -
  42. ie bit_vector'("00"). 5 returns std_logic_vector and 4 returns std_ulogic_vector.
  43. The first one when indexed gives you an element of std_ulogic, and the latter
  44. gives std_logic. Now, std_logic is a subtype of std_ulogic, which implies
  45. both have the same base type which is std_ulogic. Hence, you end up
  46. with two interpretations, which is erroneous. The final type qualification
  47. doesn't help in line 6 - std_ulogic'...  In fact that is redundant, 'cos
  48. the LHS type is std_ulogic, and can be used to resolve overloading.
  49.  
  50. So, one of the systems is showing incorrect behavior (bug!). Our (Viewlogic)
  51. full VHDL analyser caught this ambiguity correctly.
  52.  
  53. A workaraound -
  54.  
  55. PACKAGE bizarre IS
  56.  
  57.    CONSTANT X_ARR : std_ulogic_vector := to_x01(bit_vector'("00"));
  58.    CONSTANT X : std_ulogic:= X_ARR(1);
  59.  
  60. END bizarre;
  61.  
  62.  
  63.  
  64. > -EXAMPLE 2
  65. > **********
  66. > -----------------------------------------
  67. > ENTITY circuit IS 
  68. > END circuit;
  69. > -----------------------------------------
  70. > ENTITY framegen IS 
  71. > PORT (
  72. >       dclreg  : IN bit_vector(7 DOWNTO 0)
  73. >      );
  74. > END framegen;
  75. > -----------------------------------------
  76. > ARCHITECTURE cpu68302 OF framegen IS
  77. > BEGIN --architecture
  78. > END cpu68302;
  79. > -----------------------------------------
  80. > ENTITY micint IS 
  81. > PORT (
  82. >       dclreg  : OUT bit_vector(7 DOWNTO 0)
  83. >      );
  84. > END micint;
  85. > -----------------------------------------
  86. > ARCHITECTURE structural OF circuit IS
  87. > COMPONENT micint
  88. > PORT (
  89. >       dclreg  : OUT bit_vector(7 DOWNTO 0)
  90. >      );
  91. > END COMPONENT;
  92. > FOR c1:micint USE ENTITY WORK.micint(structural);
  93. > COMPONENT framegen
  94. > PORT (
  95. >       dclreg  : IN bit_vector(7 DOWNTO 0)
  96. >      );
  97. > END COMPONENT;
  98. > SIGNAL dclreg  : bit_vector(7 DOWNTO 0);
  99. > BEGIN
  100. > C1 : micint
  101. > PORT MAP(
  102. >        dclreg   =>  dclreg
  103. >         );
  104. > C2 : framegen
  105. > PORT MAP(
  106. >        dclreg   =>  dclreg
  107. >         );
  108. > END structural;
  109. > -----------------------------------------
  110. > ARCHITECTURE structural OF micint IS
  111. > BEGIN --architecture
  112. > END structural;
  113. > -----------------------------------------
  114. > CONFIGURATION conf68302_0 OF circuit IS
  115. > FOR structural
  116. >     FOR c2 : framegen 
  117. >         USE ENTITY WORK.framegen(cpu68302);
  118. >     END FOR;
  119. > END FOR;
  120. > END conf68302_0;
  121. > DESCRIPTION
  122. > I have a testbench named circuit made of 2 components
  123. > framegen and micint.
  124. > The component c1 is bound to the entity micint by a 
  125. > configuration specification.
  126. > The component c2 is bound to the entity framegen by
  127. > a configuration declaration.
  128. > For one tool i notice that if i reanalyze the architecture
  129. > of micint, then the configuration declaration must be reanalyzed,
  130. > whereas the other tool does not recompile the configuration.
  131. > Now per LRM PARAGRAPH 11.4 a given library unit is potentially
  132. > affected by a change in any library unit whose name is referenced
  133. > within the given library unit....
  134. > If a library unit is changed,then all library units potentially
  135. > affected by such changes must be reanalyzed before they can be 
  136. > used again.
  137. > HERE micint is not referenced at all in configuration
  138. > called conf68302_0.
  139. > To my opinion there is no need to reanalyze the configuration
  140. > after a change in a design unit which does not affect it.
  141.  
  142. YOU ARE RIGHT!! In fact if you have a configuration specification 
  143. (not declaration), the enclosing design unit doesn't depend on the 
  144. architecture at all (even if you name the architecture) according to 
  145. new VHDL92 rules. This makes more sense, 'cos you didn't step inside 
  146. the architecture to configure it. And this is the way we support it.
  147.  
  148.  
  149. -- 
  150. Sunder Singhani
  151. Viewlogic Systems,
  152. ssinghani@viewlogic.com
  153.  
  154. -- 
  155. -- 
  156. Sunder Singhani
  157. Viewlogic Systems,
  158. ssinghani@viewlogic.com
  159.  
  160.