VCS v5.2 bug? 
Author Message
 VCS v5.2 bug?

The following code snippet illustrates what appears to be a bug in VCS
v5.2. Has anyone else ever encountered this behaviour before?

/****************************************************************************

   The following code illustrates an apparent bug in the VCS v5.2
simulator.
   The check for whether or not the memory[0] array element was set
correctly
   fails; yet the $display statement immediately after the check shows
the
   memory[0] element actually has been set correctly.

   I've noted that if the $display and the check are reversed, the
$display
   is incorrect but the check passes.

   This appears to be a problem with the simulator's internal scheduler.

***************************************************************************/

module bug_test;

reg [1:0] temp;

initial begin

 /********** First test. */

 $display("Running first test.\n");

 // Try setting memory array in other module using hierarchical
 // references & concatenation.
 temp = 2'h3;
 top.memory.memory[0] = {2'h0,temp};
 top.memory.memory[0] = {top.memory.memory[0],temp};

 // Check that setting was made correctly
 if (top.memory.memory[0] != {2{temp}}) begin
  $display("ERROR! top.memory.memory[0] failed to get");
  $display("set correctly!");
 end else begin
  $display("PASS! top.memory.memory[0] set correctly.");
 end

 // Display the value that was checked
 $display("top.memory.memory[0] = %h",top.memory.memory[0]);

 /********** Second test. */

 $display("\nRunning second test.\n");

 // Try setting memory array in other module using hierarchical
 // references & concatenation.
 temp = 2'h3;
 top.memory.memory[1] = {2'h0,temp};
 top.memory.memory[1] = {top.memory.memory[1],temp};

 // Display the value that will be checked
 $display("top.memory.memory[1] = %h",top.memory.memory[1]);

 // Check that setting was made correctly
 if (top.memory.memory[1] != {2{temp}}) begin
  $display("ERROR! top.memory.memory[1] failed to get");
  $display("set correctly!");
 end else begin
  $display("PASS! top.memory.memory[1] set correctly.");
 end

 // Display the value that was checked
 $display("top.memory.memory[1] = %h",top.memory.memory[1]);

 $finish;

end

endmodule

// Module containing a memory array
module memory;

reg [3:0] memory [0:1];

endmodule

// Module to instantiate test and memory modules
module top;

 bug_test bug_test();
 memory memory();

endmodule



Sat, 08 Mar 2003 03:00:00 GMT  
 VCS v5.2 bug?

Quote:
> The following code snippet illustrates what appears to be a bug in VCS
> v5.2. Has anyone else ever encountered this behaviour before?

As a data point, your test claims to PASS w/ Icarus Verilog.

  icarus.com % iverilog -s top test1.v
  icarus.com % ./a.out
  Running first test.

  PASS! top.memory.memory[0] set correctly.
  top.memory.memory[0] = f

  Running second test.

  top.memory.memory[1] = f
  PASS! top.memory.memory[1] set correctly.
  top.memory.memory[1] = f

That's no guarantee, though, your program looks OK. Try adding to your
diagnostic print a printout of the value {2{temp}} and see. Print it
in binary, not hex. Also, when doing diagnostic comparisons, it is often
best to use !== or === instead of != or ==.

--
Steve Williams                "The woods are lovely, dark and deep.


http://www.picturel.com       And lines to code before I sleep."



Sat, 08 Mar 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help on VCS + VirSim (GUI for VCS)

2. Simulator differences -- apparent VCS bug

3. Vds doc V5.3 ( To sell doc v5.3 )

4. TASM32 v5.0 STRUC bgu (<- a bug in my Keytronic keyboard)

5. TASM32 v5.0 STRUC bgu (<- a bug in my Keytronic keyboard)

6. Another MS fortran V5.1 bug!?

7. BUGS, BUGS, BUGS, BUGS, C4 BUGS

8. PopupMenu bug, menu bug, apple bug (worm)?

9. ? on importing vcs (Vcards?)

10. VCS over WAN

11. VCS DDE Server error

12. VCS unlock prob(C5EE)

 

 
Powered by phpBB® Forum Software